diff --git a/resource-manager/aad/2021-05-01/client.go b/resource-manager/aad/2021-05-01/client.go index e41b802b17e..dae8202d2a9 100644 --- a/resource-manager/aad/2021-05-01/client.go +++ b/resource-manager/aad/2021-05-01/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices" "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/oucontainer" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { OuContainer *oucontainer.OuContainerClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { domainServicesClient, err := domainservices.NewDomainServicesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DomainServices client: %+v", err) diff --git a/resource-manager/aad/2021-05-01/domainservices/client.go b/resource-manager/aad/2021-05-01/domainservices/client.go index 382ef33ebc6..2ec0f2c282d 100644 --- a/resource-manager/aad/2021-05-01/domainservices/client.go +++ b/resource-manager/aad/2021-05-01/domainservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DomainServicesClient struct { Client *resourcemanager.Client } -func NewDomainServicesClientWithBaseURI(api environments.Api) (*DomainServicesClient, error) { +func NewDomainServicesClientWithBaseURI(api sdkEnv.Api) (*DomainServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "domainservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DomainServicesClient: %+v", err) diff --git a/resource-manager/aad/2021-05-01/oucontainer/client.go b/resource-manager/aad/2021-05-01/oucontainer/client.go index 3590bd3e96f..80fb55e9adb 100644 --- a/resource-manager/aad/2021-05-01/oucontainer/client.go +++ b/resource-manager/aad/2021-05-01/oucontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OuContainerClient struct { Client *resourcemanager.Client } -func NewOuContainerClientWithBaseURI(api environments.Api) (*OuContainerClient, error) { +func NewOuContainerClientWithBaseURI(api sdkEnv.Api) (*OuContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "oucontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OuContainerClient: %+v", err) diff --git a/resource-manager/aadb2c/2021-04-01-preview/client.go b/resource-manager/aadb2c/2021-04-01-preview/client.go index 6ee237ed2d2..d5eeb7d4490 100644 --- a/resource-manager/aadb2c/2021-04-01-preview/client.go +++ b/resource-manager/aadb2c/2021-04-01-preview/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { Tenants *tenants.TenantsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { tenantsClient, err := tenants.NewTenantsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Tenants client: %+v", err) diff --git a/resource-manager/aadb2c/2021-04-01-preview/tenants/client.go b/resource-manager/aadb2c/2021-04-01-preview/tenants/client.go index b008dbebf55..c703cae7cda 100644 --- a/resource-manager/aadb2c/2021-04-01-preview/tenants/client.go +++ b/resource-manager/aadb2c/2021-04-01-preview/tenants/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) HashiCorp Inc. All rights reserved. @@ -14,7 +14,7 @@ type TenantsClient struct { Client *resourcemanager.Client } -func NewTenantsClientWithBaseURI(api environments.Api) (*TenantsClient, error) { +func NewTenantsClientWithBaseURI(api sdkEnv.Api) (*TenantsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tenants", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TenantsClient: %+v", err) diff --git a/resource-manager/advisor/2020-01-01/client.go b/resource-manager/advisor/2020-01-01/client.go index 141c7c70c00..6a87b5034af 100644 --- a/resource-manager/advisor/2020-01-01/client.go +++ b/resource-manager/advisor/2020-01-01/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/advisor/2020-01-01/metadata" "github.com/hashicorp/go-azure-sdk/resource-manager/advisor/2020-01-01/suppressions" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { Suppressions *suppressions.SuppressionsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { configurationsClient, err := configurations.NewConfigurationsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Configurations client: %+v", err) diff --git a/resource-manager/advisor/2020-01-01/configurations/client.go b/resource-manager/advisor/2020-01-01/configurations/client.go index c2b3df6d8b8..b4d8c5d31c3 100644 --- a/resource-manager/advisor/2020-01-01/configurations/client.go +++ b/resource-manager/advisor/2020-01-01/configurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationsClient struct { Client *resourcemanager.Client } -func NewConfigurationsClientWithBaseURI(api environments.Api) (*ConfigurationsClient, error) { +func NewConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationsClient: %+v", err) diff --git a/resource-manager/advisor/2020-01-01/generaterecommendations/client.go b/resource-manager/advisor/2020-01-01/generaterecommendations/client.go index 92ebc0d9aee..e4913437014 100644 --- a/resource-manager/advisor/2020-01-01/generaterecommendations/client.go +++ b/resource-manager/advisor/2020-01-01/generaterecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GenerateRecommendationsClient struct { Client *resourcemanager.Client } -func NewGenerateRecommendationsClientWithBaseURI(api environments.Api) (*GenerateRecommendationsClient, error) { +func NewGenerateRecommendationsClientWithBaseURI(api sdkEnv.Api) (*GenerateRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "generaterecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GenerateRecommendationsClient: %+v", err) diff --git a/resource-manager/advisor/2020-01-01/getrecommendations/client.go b/resource-manager/advisor/2020-01-01/getrecommendations/client.go index f8522a89c7b..79212a49190 100644 --- a/resource-manager/advisor/2020-01-01/getrecommendations/client.go +++ b/resource-manager/advisor/2020-01-01/getrecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GetRecommendationsClient struct { Client *resourcemanager.Client } -func NewGetRecommendationsClientWithBaseURI(api environments.Api) (*GetRecommendationsClient, error) { +func NewGetRecommendationsClientWithBaseURI(api sdkEnv.Api) (*GetRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "getrecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GetRecommendationsClient: %+v", err) diff --git a/resource-manager/advisor/2020-01-01/metadata/client.go b/resource-manager/advisor/2020-01-01/metadata/client.go index ae9beba2367..1230345bc18 100644 --- a/resource-manager/advisor/2020-01-01/metadata/client.go +++ b/resource-manager/advisor/2020-01-01/metadata/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MetadataClient struct { Client *resourcemanager.Client } -func NewMetadataClientWithBaseURI(api environments.Api) (*MetadataClient, error) { +func NewMetadataClientWithBaseURI(api sdkEnv.Api) (*MetadataClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "metadata", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MetadataClient: %+v", err) diff --git a/resource-manager/advisor/2020-01-01/suppressions/client.go b/resource-manager/advisor/2020-01-01/suppressions/client.go index 50030d57ba7..fcb99b92098 100644 --- a/resource-manager/advisor/2020-01-01/suppressions/client.go +++ b/resource-manager/advisor/2020-01-01/suppressions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SuppressionsClient struct { Client *resourcemanager.Client } -func NewSuppressionsClientWithBaseURI(api environments.Api) (*SuppressionsClient, error) { +func NewSuppressionsClientWithBaseURI(api sdkEnv.Api) (*SuppressionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "suppressions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SuppressionsClient: %+v", err) diff --git a/resource-manager/advisor/2022-10-01/advisorscore/client.go b/resource-manager/advisor/2022-10-01/advisorscore/client.go index 3fe28d7ca2c..38dd25cefd2 100644 --- a/resource-manager/advisor/2022-10-01/advisorscore/client.go +++ b/resource-manager/advisor/2022-10-01/advisorscore/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AdvisorScoreClient struct { Client *resourcemanager.Client } -func NewAdvisorScoreClientWithBaseURI(api environments.Api) (*AdvisorScoreClient, error) { +func NewAdvisorScoreClientWithBaseURI(api sdkEnv.Api) (*AdvisorScoreClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "advisorscore", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AdvisorScoreClient: %+v", err) diff --git a/resource-manager/advisor/2022-10-01/client.go b/resource-manager/advisor/2022-10-01/client.go index a01d3298f16..09c9a9a3bf1 100644 --- a/resource-manager/advisor/2022-10-01/client.go +++ b/resource-manager/advisor/2022-10-01/client.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/advisor/2022-10-01/prediction" "github.com/hashicorp/go-azure-sdk/resource-manager/advisor/2022-10-01/suppressions" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -27,7 +27,7 @@ type Client struct { Suppressions *suppressions.SuppressionsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { advisorScoreClient, err := advisorscore.NewAdvisorScoreClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AdvisorScore client: %+v", err) diff --git a/resource-manager/advisor/2022-10-01/configurations/client.go b/resource-manager/advisor/2022-10-01/configurations/client.go index c2b3df6d8b8..b4d8c5d31c3 100644 --- a/resource-manager/advisor/2022-10-01/configurations/client.go +++ b/resource-manager/advisor/2022-10-01/configurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationsClient struct { Client *resourcemanager.Client } -func NewConfigurationsClientWithBaseURI(api environments.Api) (*ConfigurationsClient, error) { +func NewConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationsClient: %+v", err) diff --git a/resource-manager/advisor/2022-10-01/generaterecommendations/client.go b/resource-manager/advisor/2022-10-01/generaterecommendations/client.go index 92ebc0d9aee..e4913437014 100644 --- a/resource-manager/advisor/2022-10-01/generaterecommendations/client.go +++ b/resource-manager/advisor/2022-10-01/generaterecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GenerateRecommendationsClient struct { Client *resourcemanager.Client } -func NewGenerateRecommendationsClientWithBaseURI(api environments.Api) (*GenerateRecommendationsClient, error) { +func NewGenerateRecommendationsClientWithBaseURI(api sdkEnv.Api) (*GenerateRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "generaterecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GenerateRecommendationsClient: %+v", err) diff --git a/resource-manager/advisor/2022-10-01/getrecommendations/client.go b/resource-manager/advisor/2022-10-01/getrecommendations/client.go index f8522a89c7b..79212a49190 100644 --- a/resource-manager/advisor/2022-10-01/getrecommendations/client.go +++ b/resource-manager/advisor/2022-10-01/getrecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GetRecommendationsClient struct { Client *resourcemanager.Client } -func NewGetRecommendationsClientWithBaseURI(api environments.Api) (*GetRecommendationsClient, error) { +func NewGetRecommendationsClientWithBaseURI(api sdkEnv.Api) (*GetRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "getrecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GetRecommendationsClient: %+v", err) diff --git a/resource-manager/advisor/2022-10-01/metadata/client.go b/resource-manager/advisor/2022-10-01/metadata/client.go index ae9beba2367..1230345bc18 100644 --- a/resource-manager/advisor/2022-10-01/metadata/client.go +++ b/resource-manager/advisor/2022-10-01/metadata/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MetadataClient struct { Client *resourcemanager.Client } -func NewMetadataClientWithBaseURI(api environments.Api) (*MetadataClient, error) { +func NewMetadataClientWithBaseURI(api sdkEnv.Api) (*MetadataClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "metadata", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MetadataClient: %+v", err) diff --git a/resource-manager/advisor/2022-10-01/prediction/client.go b/resource-manager/advisor/2022-10-01/prediction/client.go index 9c19783db9b..43ffb354f0c 100644 --- a/resource-manager/advisor/2022-10-01/prediction/client.go +++ b/resource-manager/advisor/2022-10-01/prediction/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PredictionClient struct { Client *resourcemanager.Client } -func NewPredictionClientWithBaseURI(api environments.Api) (*PredictionClient, error) { +func NewPredictionClientWithBaseURI(api sdkEnv.Api) (*PredictionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "prediction", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PredictionClient: %+v", err) diff --git a/resource-manager/advisor/2022-10-01/suppressions/client.go b/resource-manager/advisor/2022-10-01/suppressions/client.go index 50030d57ba7..fcb99b92098 100644 --- a/resource-manager/advisor/2022-10-01/suppressions/client.go +++ b/resource-manager/advisor/2022-10-01/suppressions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SuppressionsClient struct { Client *resourcemanager.Client } -func NewSuppressionsClientWithBaseURI(api environments.Api) (*SuppressionsClient, error) { +func NewSuppressionsClientWithBaseURI(api sdkEnv.Api) (*SuppressionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "suppressions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SuppressionsClient: %+v", err) diff --git a/resource-manager/advisor/2023-01-01/advisorscore/client.go b/resource-manager/advisor/2023-01-01/advisorscore/client.go index 3fe28d7ca2c..38dd25cefd2 100644 --- a/resource-manager/advisor/2023-01-01/advisorscore/client.go +++ b/resource-manager/advisor/2023-01-01/advisorscore/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AdvisorScoreClient struct { Client *resourcemanager.Client } -func NewAdvisorScoreClientWithBaseURI(api environments.Api) (*AdvisorScoreClient, error) { +func NewAdvisorScoreClientWithBaseURI(api sdkEnv.Api) (*AdvisorScoreClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "advisorscore", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AdvisorScoreClient: %+v", err) diff --git a/resource-manager/advisor/2023-01-01/client.go b/resource-manager/advisor/2023-01-01/client.go index b3bf0ac6ec3..4486ffcca1f 100644 --- a/resource-manager/advisor/2023-01-01/client.go +++ b/resource-manager/advisor/2023-01-01/client.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/advisor/2023-01-01/prediction" "github.com/hashicorp/go-azure-sdk/resource-manager/advisor/2023-01-01/suppressions" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -27,7 +27,7 @@ type Client struct { Suppressions *suppressions.SuppressionsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { advisorScoreClient, err := advisorscore.NewAdvisorScoreClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AdvisorScore client: %+v", err) diff --git a/resource-manager/advisor/2023-01-01/configurations/client.go b/resource-manager/advisor/2023-01-01/configurations/client.go index c2b3df6d8b8..b4d8c5d31c3 100644 --- a/resource-manager/advisor/2023-01-01/configurations/client.go +++ b/resource-manager/advisor/2023-01-01/configurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationsClient struct { Client *resourcemanager.Client } -func NewConfigurationsClientWithBaseURI(api environments.Api) (*ConfigurationsClient, error) { +func NewConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationsClient: %+v", err) diff --git a/resource-manager/advisor/2023-01-01/generaterecommendations/client.go b/resource-manager/advisor/2023-01-01/generaterecommendations/client.go index 92ebc0d9aee..e4913437014 100644 --- a/resource-manager/advisor/2023-01-01/generaterecommendations/client.go +++ b/resource-manager/advisor/2023-01-01/generaterecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GenerateRecommendationsClient struct { Client *resourcemanager.Client } -func NewGenerateRecommendationsClientWithBaseURI(api environments.Api) (*GenerateRecommendationsClient, error) { +func NewGenerateRecommendationsClientWithBaseURI(api sdkEnv.Api) (*GenerateRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "generaterecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GenerateRecommendationsClient: %+v", err) diff --git a/resource-manager/advisor/2023-01-01/getrecommendations/client.go b/resource-manager/advisor/2023-01-01/getrecommendations/client.go index f8522a89c7b..79212a49190 100644 --- a/resource-manager/advisor/2023-01-01/getrecommendations/client.go +++ b/resource-manager/advisor/2023-01-01/getrecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GetRecommendationsClient struct { Client *resourcemanager.Client } -func NewGetRecommendationsClientWithBaseURI(api environments.Api) (*GetRecommendationsClient, error) { +func NewGetRecommendationsClientWithBaseURI(api sdkEnv.Api) (*GetRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "getrecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GetRecommendationsClient: %+v", err) diff --git a/resource-manager/advisor/2023-01-01/metadata/client.go b/resource-manager/advisor/2023-01-01/metadata/client.go index ae9beba2367..1230345bc18 100644 --- a/resource-manager/advisor/2023-01-01/metadata/client.go +++ b/resource-manager/advisor/2023-01-01/metadata/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MetadataClient struct { Client *resourcemanager.Client } -func NewMetadataClientWithBaseURI(api environments.Api) (*MetadataClient, error) { +func NewMetadataClientWithBaseURI(api sdkEnv.Api) (*MetadataClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "metadata", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MetadataClient: %+v", err) diff --git a/resource-manager/advisor/2023-01-01/prediction/client.go b/resource-manager/advisor/2023-01-01/prediction/client.go index 9c19783db9b..43ffb354f0c 100644 --- a/resource-manager/advisor/2023-01-01/prediction/client.go +++ b/resource-manager/advisor/2023-01-01/prediction/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PredictionClient struct { Client *resourcemanager.Client } -func NewPredictionClientWithBaseURI(api environments.Api) (*PredictionClient, error) { +func NewPredictionClientWithBaseURI(api sdkEnv.Api) (*PredictionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "prediction", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PredictionClient: %+v", err) diff --git a/resource-manager/advisor/2023-01-01/suppressions/client.go b/resource-manager/advisor/2023-01-01/suppressions/client.go index 50030d57ba7..fcb99b92098 100644 --- a/resource-manager/advisor/2023-01-01/suppressions/client.go +++ b/resource-manager/advisor/2023-01-01/suppressions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SuppressionsClient struct { Client *resourcemanager.Client } -func NewSuppressionsClientWithBaseURI(api environments.Api) (*SuppressionsClient, error) { +func NewSuppressionsClientWithBaseURI(api sdkEnv.Api) (*SuppressionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "suppressions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SuppressionsClient: %+v", err) diff --git a/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/client.go b/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/client.go index ddb6ffaae0a..548c7aaf2ef 100644 --- a/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/client.go +++ b/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AlertProcessingRulesClient struct { Client *resourcemanager.Client } -func NewAlertProcessingRulesClientWithBaseURI(api environments.Api) (*AlertProcessingRulesClient, error) { +func NewAlertProcessingRulesClientWithBaseURI(api sdkEnv.Api) (*AlertProcessingRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "alertprocessingrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AlertProcessingRulesClient: %+v", err) diff --git a/resource-manager/alertsmanagement/2021-08-08/client.go b/resource-manager/alertsmanagement/2021-08-08/client.go index a88b7672789..6c61e5ef5df 100644 --- a/resource-manager/alertsmanagement/2021-08-08/client.go +++ b/resource-manager/alertsmanagement/2021-08-08/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { AlertProcessingRules *alertprocessingrules.AlertProcessingRulesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { alertProcessingRulesClient, err := alertprocessingrules.NewAlertProcessingRulesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AlertProcessingRules client: %+v", err) diff --git a/resource-manager/alertsmanagement/2023-03-01/client.go b/resource-manager/alertsmanagement/2023-03-01/client.go index 3fb17cc72ac..19338401bf6 100644 --- a/resource-manager/alertsmanagement/2023-03-01/client.go +++ b/resource-manager/alertsmanagement/2023-03-01/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/alertsmanagement/2023-03-01/prometheusrulegroups" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { PrometheusRuleGroups *prometheusrulegroups.PrometheusRuleGroupsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { prometheusRuleGroupsClient, err := prometheusrulegroups.NewPrometheusRuleGroupsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building PrometheusRuleGroups client: %+v", err) diff --git a/resource-manager/alertsmanagement/2023-03-01/prometheusrulegroups/client.go b/resource-manager/alertsmanagement/2023-03-01/prometheusrulegroups/client.go index 59407e91d1c..8f73c3e5c07 100644 --- a/resource-manager/alertsmanagement/2023-03-01/prometheusrulegroups/client.go +++ b/resource-manager/alertsmanagement/2023-03-01/prometheusrulegroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrometheusRuleGroupsClient struct { Client *resourcemanager.Client } -func NewPrometheusRuleGroupsClientWithBaseURI(api environments.Api) (*PrometheusRuleGroupsClient, error) { +func NewPrometheusRuleGroupsClientWithBaseURI(api sdkEnv.Api) (*PrometheusRuleGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "prometheusrulegroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrometheusRuleGroupsClient: %+v", err) diff --git a/resource-manager/analysisservices/2017-08-01/analysisservices/client.go b/resource-manager/analysisservices/2017-08-01/analysisservices/client.go index 099b540e1dd..22274166f57 100644 --- a/resource-manager/analysisservices/2017-08-01/analysisservices/client.go +++ b/resource-manager/analysisservices/2017-08-01/analysisservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AnalysisServicesClient struct { Client *resourcemanager.Client } -func NewAnalysisServicesClientWithBaseURI(api environments.Api) (*AnalysisServicesClient, error) { +func NewAnalysisServicesClientWithBaseURI(api sdkEnv.Api) (*AnalysisServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "analysisservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AnalysisServicesClient: %+v", err) diff --git a/resource-manager/analysisservices/2017-08-01/client.go b/resource-manager/analysisservices/2017-08-01/client.go index 49b7517cec5..a83d6c65013 100644 --- a/resource-manager/analysisservices/2017-08-01/client.go +++ b/resource-manager/analysisservices/2017-08-01/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/analysisservices" "github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { Servers *servers.ServersClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { analysisServicesClient, err := analysisservices.NewAnalysisServicesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AnalysisServices client: %+v", err) diff --git a/resource-manager/analysisservices/2017-08-01/servers/client.go b/resource-manager/analysisservices/2017-08-01/servers/client.go index a1e11668771..0788963b1fb 100644 --- a/resource-manager/analysisservices/2017-08-01/servers/client.go +++ b/resource-manager/analysisservices/2017-08-01/servers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServersClient struct { Client *resourcemanager.Client } -func NewServersClientWithBaseURI(api environments.Api) (*ServersClient, error) { +func NewServersClientWithBaseURI(api sdkEnv.Api) (*ServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServersClient: %+v", err) diff --git a/resource-manager/apimanagement/2021-08-01/api/client.go b/resource-manager/apimanagement/2021-08-01/api/client.go index 6d9c8390b45..9057eaa0d46 100644 --- a/resource-manager/apimanagement/2021-08-01/api/client.go +++ b/resource-manager/apimanagement/2021-08-01/api/client.go @@ -1,18 +1,26 @@ package api -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiClientWithBaseURI(endpoint string) ApiClient { - return ApiClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiClientWithBaseURI(api sdkEnv.Api) (*ApiClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "api", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiClient: %+v", err) } + + return &ApiClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/api/constants.go b/resource-manager/apimanagement/2021-08-01/api/constants.go index f6a133ddf2b..63b7ebe8c1d 100644 --- a/resource-manager/apimanagement/2021-08-01/api/constants.go +++ b/resource-manager/apimanagement/2021-08-01/api/constants.go @@ -1,6 +1,10 @@ package api -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -99,6 +129,19 @@ func PossibleValuesForContentFormat() []string { } } +func (s *ContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseContentFormat(input string) (*ContentFormat, error) { vals := map[string]ContentFormat{ "graphql-link": ContentFormatGraphqlNegativelink, @@ -140,6 +183,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, @@ -174,6 +230,19 @@ func PossibleValuesForSoapApiType() []string { } } +func (s *SoapApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSoapApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSoapApiType(input string) (*SoapApiType, error) { vals := map[string]SoapApiType{ "graphql": SoapApiTypeGraphql, @@ -206,6 +275,19 @@ func PossibleValuesForVersioningScheme() []string { } } +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVersioningScheme(input string) (*VersioningScheme, error) { vals := map[string]VersioningScheme{ "header": VersioningSchemeHeader, diff --git a/resource-manager/apimanagement/2021-08-01/api/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/api/method_createorupdate.go new file mode 100644 index 00000000000..6906b67a6ba --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/api/method_createorupdate.go @@ -0,0 +1,103 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiClient) CreateOrUpdate(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ApiClient) CreateOrUpdateThenPoll(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/api/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/api/method_createorupdate_autorest.go deleted file mode 100644 index cf276d9f58f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/api/method_createorupdate_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package api - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiClient) CreateOrUpdate(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ApiClient) CreateOrUpdateThenPoll(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiClient) preparerForCreateOrUpdate(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c ApiClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/api/method_delete.go b/resource-manager/apimanagement/2021-08-01/api/method_delete.go new file mode 100644 index 00000000000..19f24f35d16 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/api/method_delete.go @@ -0,0 +1,79 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + DeleteRevisions *bool + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.DeleteRevisions != nil { + out.Append("deleteRevisions", fmt.Sprintf("%v", *o.DeleteRevisions)) + } + return &out +} + +// Delete ... +func (c ApiClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/api/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/api/method_delete_autorest.go deleted file mode 100644 index 0971572259e..00000000000 --- a/resource-manager/apimanagement/2021-08-01/api/method_delete_autorest.go +++ /dev/null @@ -1,100 +0,0 @@ -package api - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - DeleteRevisions *bool - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.DeleteRevisions != nil { - out["deleteRevisions"] = *o.DeleteRevisions - } - - return out -} - -// Delete ... -func (c ApiClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiClient) preparerForDelete(ctx context.Context, id ApiId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/api/method_get.go b/resource-manager/apimanagement/2021-08-01/api/method_get.go new file mode 100644 index 00000000000..f750fb8e0ec --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/api/method_get.go @@ -0,0 +1,51 @@ +package api + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +// Get ... +func (c ApiClient) Get(ctx context.Context, id ApiId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/api/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/api/method_get_autorest.go deleted file mode 100644 index cd4943ce66a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/api/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package api - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ApiContract -} - -// Get ... -func (c ApiClient) Get(ctx context.Context, id ApiId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiClient) preparerForGet(ctx context.Context, id ApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/api/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/api/method_getentitytag.go new file mode 100644 index 00000000000..5d65ab7fc88 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/api/method_getentitytag.go @@ -0,0 +1,46 @@ +package api + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/api/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/api/method_getentitytag_autorest.go deleted file mode 100644 index 326d2bb9cdf..00000000000 --- a/resource-manager/apimanagement/2021-08-01/api/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package api - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiClient) preparerForGetEntityTag(ctx context.Context, id ApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/api/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/api/method_listbyservice.go new file mode 100644 index 00000000000..2b6a6ad37f7 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/api/method_listbyservice.go @@ -0,0 +1,133 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiContract +} + +type ListByServiceCompleteResult struct { + Items []ApiContract +} + +type ListByServiceOperationOptions struct { + ExpandApiVersionSet *bool + Filter *string + Skip *int64 + Tags *string + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandApiVersionSet != nil { + out.Append("expandApiVersionSet", fmt.Sprintf("%v", *o.ExpandApiVersionSet)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Tags != nil { + out.Append("tags", fmt.Sprintf("%v", *o.Tags)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apis", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ApiContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/api/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/api/method_listbyservice_autorest.go deleted file mode 100644 index 114e7e5afe3..00000000000 --- a/resource-manager/apimanagement/2021-08-01/api/method_listbyservice_autorest.go +++ /dev/null @@ -1,235 +0,0 @@ -package api - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ApiContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - ExpandApiVersionSet *bool - Filter *string - Skip *int64 - Tags *string - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ExpandApiVersionSet != nil { - out["expandApiVersionSet"] = *o.ExpandApiVersionSet - } - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Tags != nil { - out["tags"] = *o.Tags - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/apis", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ApiContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ApiContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ApiContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/api/method_update.go b/resource-manager/apimanagement/2021-08-01/api/method_update.go new file mode 100644 index 00000000000..8b2e6fa4357 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/api/method_update.go @@ -0,0 +1,84 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiClient) Update(ctx context.Context, id ApiId, input ApiUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/api/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/api/method_update_autorest.go deleted file mode 100644 index b998809dc0e..00000000000 --- a/resource-manager/apimanagement/2021-08-01/api/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package api - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiClient) Update(ctx context.Context, id ApiId, input ApiUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiClient) preparerForUpdate(ctx context.Context, id ApiId, input ApiUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/client.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/client.go index 99e83188cc6..cbca867f180 100644 --- a/resource-manager/apimanagement/2021-08-01/apidiagnostic/client.go +++ b/resource-manager/apimanagement/2021-08-01/apidiagnostic/client.go @@ -1,18 +1,26 @@ package apidiagnostic -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiDiagnosticClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiDiagnosticClientWithBaseURI(endpoint string) ApiDiagnosticClient { - return ApiDiagnosticClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiDiagnosticClientWithBaseURI(api sdkEnv.Api) (*ApiDiagnosticClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apidiagnostic", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiDiagnosticClient: %+v", err) } + + return &ApiDiagnosticClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/constants.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/constants.go index 4d80cb551c7..1afde676ffa 100644 --- a/resource-manager/apimanagement/2021-08-01/apidiagnostic/constants.go +++ b/resource-manager/apimanagement/2021-08-01/apidiagnostic/constants.go @@ -1,6 +1,10 @@ package apidiagnostic -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -17,6 +21,19 @@ func PossibleValuesForAlwaysLog() []string { } } +func (s *AlwaysLog) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAlwaysLog(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAlwaysLog(input string) (*AlwaysLog, error) { vals := map[string]AlwaysLog{ "allerrors": AlwaysLogAllErrors, @@ -44,6 +61,19 @@ func PossibleValuesForDataMaskingMode() []string { } } +func (s *DataMaskingMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDataMaskingMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDataMaskingMode(input string) (*DataMaskingMode, error) { vals := map[string]DataMaskingMode{ "hide": DataMaskingModeHide, @@ -74,6 +104,19 @@ func PossibleValuesForHTTPCorrelationProtocol() []string { } } +func (s *HTTPCorrelationProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHTTPCorrelationProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseHTTPCorrelationProtocol(input string) (*HTTPCorrelationProtocol, error) { vals := map[string]HTTPCorrelationProtocol{ "legacy": HTTPCorrelationProtocolLegacy, @@ -103,6 +146,19 @@ func PossibleValuesForOperationNameFormat() []string { } } +func (s *OperationNameFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperationNameFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOperationNameFormat(input string) (*OperationNameFormat, error) { vals := map[string]OperationNameFormat{ "name": OperationNameFormatName, @@ -129,6 +185,19 @@ func PossibleValuesForSamplingType() []string { } } +func (s *SamplingType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSamplingType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSamplingType(input string) (*SamplingType, error) { vals := map[string]SamplingType{ "fixed": SamplingTypeFixed, @@ -158,6 +227,19 @@ func PossibleValuesForVerbosity() []string { } } +func (s *Verbosity) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVerbosity(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVerbosity(input string) (*Verbosity, error) { vals := map[string]Verbosity{ "error": VerbosityError, diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_createorupdate.go new file mode 100644 index 00000000000..d50634ca8da --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_createorupdate.go @@ -0,0 +1,85 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiDiagnosticClient) CreateOrUpdate(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_createorupdate_autorest.go deleted file mode 100644 index 510d94a82ae..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apidiagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiDiagnosticClient) CreateOrUpdate(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiDiagnosticClient) preparerForCreateOrUpdate(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_delete.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_delete.go new file mode 100644 index 00000000000..0fb3223f00f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_delete.go @@ -0,0 +1,76 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiDiagnosticClient) Delete(ctx context.Context, id ApiDiagnosticId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_delete_autorest.go deleted file mode 100644 index f9098fe95dd..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apidiagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiDiagnosticClient) Delete(ctx context.Context, id ApiDiagnosticId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiDiagnosticClient) preparerForDelete(ctx context.Context, id ApiDiagnosticId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_get.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_get.go new file mode 100644 index 00000000000..26dffc0cd3e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_get.go @@ -0,0 +1,51 @@ +package apidiagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +// Get ... +func (c ApiDiagnosticClient) Get(ctx context.Context, id ApiDiagnosticId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_get_autorest.go deleted file mode 100644 index 5468c122ef0..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apidiagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -// Get ... -func (c ApiDiagnosticClient) Get(ctx context.Context, id ApiDiagnosticId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiDiagnosticClient) preparerForGet(ctx context.Context, id ApiDiagnosticId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_getentitytag.go new file mode 100644 index 00000000000..312e0f37414 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_getentitytag.go @@ -0,0 +1,46 @@ +package apidiagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiDiagnosticClient) GetEntityTag(ctx context.Context, id ApiDiagnosticId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_getentitytag_autorest.go deleted file mode 100644 index 4ad28bdb6d5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apidiagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiDiagnosticClient) GetEntityTag(ctx context.Context, id ApiDiagnosticId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiDiagnosticClient) preparerForGetEntityTag(ctx context.Context, id ApiDiagnosticId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_listbyservice.go new file mode 100644 index 00000000000..125ebd65d5f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_listbyservice.go @@ -0,0 +1,125 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DiagnosticContract +} + +type ListByServiceCompleteResult struct { + Items []DiagnosticContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiDiagnosticClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/diagnostics", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DiagnosticContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiDiagnosticClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DiagnosticContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiDiagnosticClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate DiagnosticContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]DiagnosticContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_listbyservice_autorest.go deleted file mode 100644 index c58834cf8bf..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apidiagnostic - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]DiagnosticContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []DiagnosticContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiDiagnosticClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiDiagnosticClient) preparerForListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/diagnostics", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiDiagnosticClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []DiagnosticContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiDiagnosticClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DiagnosticContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiDiagnosticClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate DiagnosticContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]DiagnosticContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_update.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_update.go new file mode 100644 index 00000000000..b5341b3da3e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_update.go @@ -0,0 +1,84 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiDiagnosticClient) Update(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_update_autorest.go deleted file mode 100644 index fa90a3f37f8..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apidiagnostic/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apidiagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiDiagnosticClient) Update(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiDiagnosticClient) preparerForUpdate(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/client.go b/resource-manager/apimanagement/2021-08-01/apiissue/client.go index f63c05725de..2135eaf1043 100644 --- a/resource-manager/apimanagement/2021-08-01/apiissue/client.go +++ b/resource-manager/apimanagement/2021-08-01/apiissue/client.go @@ -1,18 +1,26 @@ package apiissue -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiIssueClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiIssueClientWithBaseURI(endpoint string) ApiIssueClient { - return ApiIssueClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiIssueClientWithBaseURI(api sdkEnv.Api) (*ApiIssueClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiissue", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiIssueClient: %+v", err) } + + return &ApiIssueClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/constants.go b/resource-manager/apimanagement/2021-08-01/apiissue/constants.go index 63548405b43..16888d5e064 100644 --- a/resource-manager/apimanagement/2021-08-01/apiissue/constants.go +++ b/resource-manager/apimanagement/2021-08-01/apiissue/constants.go @@ -1,6 +1,10 @@ package apiissue -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -25,6 +29,19 @@ func PossibleValuesForState() []string { } } +func (s *State) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseState(input string) (*State, error) { vals := map[string]State{ "closed": StateClosed, diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_createorupdate.go new file mode 100644 index 00000000000..10a6a5bca91 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissue/method_createorupdate.go @@ -0,0 +1,85 @@ +package apiissue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiIssueClient) CreateOrUpdate(ctx context.Context, id ApiIssueId, input IssueContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_createorupdate_autorest.go deleted file mode 100644 index 74810fa4260..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissue/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiissue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *IssueContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiIssueClient) CreateOrUpdate(ctx context.Context, id ApiIssueId, input IssueContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiIssueClient) preparerForCreateOrUpdate(ctx context.Context, id ApiIssueId, input IssueContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_delete.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_delete.go new file mode 100644 index 00000000000..822eaefefe3 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissue/method_delete.go @@ -0,0 +1,76 @@ +package apiissue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiIssueClient) Delete(ctx context.Context, id ApiIssueId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_delete_autorest.go deleted file mode 100644 index 77956335e4c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissue/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apiissue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiIssueClient) Delete(ctx context.Context, id ApiIssueId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiIssueClient) preparerForDelete(ctx context.Context, id ApiIssueId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_get.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_get.go new file mode 100644 index 00000000000..437b0420930 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissue/method_get.go @@ -0,0 +1,80 @@ +package apiissue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueContract +} + +type GetOperationOptions struct { + ExpandCommentsAttachments *bool +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandCommentsAttachments != nil { + out.Append("expandCommentsAttachments", fmt.Sprintf("%v", *o.ExpandCommentsAttachments)) + } + return &out +} + +// Get ... +func (c ApiIssueClient) Get(ctx context.Context, id ApiIssueId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_get_autorest.go deleted file mode 100644 index 0821e733063..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissue/method_get_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package apiissue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *IssueContract -} - -type GetOperationOptions struct { - ExpandCommentsAttachments *bool -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ExpandCommentsAttachments != nil { - out["expandCommentsAttachments"] = *o.ExpandCommentsAttachments - } - - return out -} - -// Get ... -func (c ApiIssueClient) Get(ctx context.Context, id ApiIssueId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiIssueClient) preparerForGet(ctx context.Context, id ApiIssueId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_getentitytag.go new file mode 100644 index 00000000000..fa22e539b24 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissue/method_getentitytag.go @@ -0,0 +1,46 @@ +package apiissue + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiIssueClient) GetEntityTag(ctx context.Context, id ApiIssueId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_getentitytag_autorest.go deleted file mode 100644 index 589dff977e0..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissue/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apiissue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiIssueClient) GetEntityTag(ctx context.Context, id ApiIssueId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiIssueClient) preparerForGetEntityTag(ctx context.Context, id ApiIssueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_listbyservice.go new file mode 100644 index 00000000000..faa0de569c6 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissue/method_listbyservice.go @@ -0,0 +1,129 @@ +package apiissue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]IssueContract +} + +type ListByServiceCompleteResult struct { + Items []IssueContract +} + +type ListByServiceOperationOptions struct { + ExpandCommentsAttachments *bool + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandCommentsAttachments != nil { + out.Append("expandCommentsAttachments", fmt.Sprintf("%v", *o.ExpandCommentsAttachments)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiIssueClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/issues", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]IssueContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiIssueClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiIssueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate IssueContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]IssueContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_listbyservice_autorest.go deleted file mode 100644 index 48b3a2c6d18..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissue/method_listbyservice_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package apiissue - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]IssueContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []IssueContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - ExpandCommentsAttachments *bool - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ExpandCommentsAttachments != nil { - out["expandCommentsAttachments"] = *o.ExpandCommentsAttachments - } - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiIssueClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiIssueClient) preparerForListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/issues", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiIssueClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []IssueContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiIssueClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiIssueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate IssueContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]IssueContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_update.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_update.go new file mode 100644 index 00000000000..584e3d7d164 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissue/method_update.go @@ -0,0 +1,84 @@ +package apiissue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiIssueClient) Update(ctx context.Context, id ApiIssueId, input IssueUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissue/method_update_autorest.go deleted file mode 100644 index f2e65e33867..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissue/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiissue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *IssueContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiIssueClient) Update(ctx context.Context, id ApiIssueId, input IssueUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiIssueClient) preparerForUpdate(ctx context.Context, id ApiIssueId, input IssueUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/client.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/client.go index 603bab63d7c..9c73e8cfca8 100644 --- a/resource-manager/apimanagement/2021-08-01/apiissueattachment/client.go +++ b/resource-manager/apimanagement/2021-08-01/apiissueattachment/client.go @@ -1,18 +1,26 @@ package apiissueattachment -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiIssueAttachmentClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiIssueAttachmentClientWithBaseURI(endpoint string) ApiIssueAttachmentClient { - return ApiIssueAttachmentClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiIssueAttachmentClientWithBaseURI(api sdkEnv.Api) (*ApiIssueAttachmentClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiissueattachment", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiIssueAttachmentClient: %+v", err) } + + return &ApiIssueAttachmentClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_createorupdate.go new file mode 100644 index 00000000000..9b38974fd6c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_createorupdate.go @@ -0,0 +1,85 @@ +package apiissueattachment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueAttachmentContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiIssueAttachmentClient) CreateOrUpdate(ctx context.Context, id AttachmentId, input IssueAttachmentContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_createorupdate_autorest.go deleted file mode 100644 index 0d3c8faed1f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiissueattachment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *IssueAttachmentContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiIssueAttachmentClient) CreateOrUpdate(ctx context.Context, id AttachmentId, input IssueAttachmentContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiIssueAttachmentClient) preparerForCreateOrUpdate(ctx context.Context, id AttachmentId, input IssueAttachmentContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiIssueAttachmentClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_delete.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_delete.go new file mode 100644 index 00000000000..e2c80a156a2 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_delete.go @@ -0,0 +1,76 @@ +package apiissueattachment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiIssueAttachmentClient) Delete(ctx context.Context, id AttachmentId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_delete_autorest.go deleted file mode 100644 index 0c1c547304e..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apiissueattachment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiIssueAttachmentClient) Delete(ctx context.Context, id AttachmentId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiIssueAttachmentClient) preparerForDelete(ctx context.Context, id AttachmentId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiIssueAttachmentClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_get.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_get.go new file mode 100644 index 00000000000..3e35f0e3c03 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_get.go @@ -0,0 +1,51 @@ +package apiissueattachment + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueAttachmentContract +} + +// Get ... +func (c ApiIssueAttachmentClient) Get(ctx context.Context, id AttachmentId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_get_autorest.go deleted file mode 100644 index cf5a5442e8f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apiissueattachment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *IssueAttachmentContract -} - -// Get ... -func (c ApiIssueAttachmentClient) Get(ctx context.Context, id AttachmentId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiIssueAttachmentClient) preparerForGet(ctx context.Context, id AttachmentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiIssueAttachmentClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_getentitytag.go new file mode 100644 index 00000000000..417b3e0b9bd --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_getentitytag.go @@ -0,0 +1,46 @@ +package apiissueattachment + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiIssueAttachmentClient) GetEntityTag(ctx context.Context, id AttachmentId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_getentitytag_autorest.go deleted file mode 100644 index 24756f5be27..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apiissueattachment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiIssueAttachmentClient) GetEntityTag(ctx context.Context, id AttachmentId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiIssueAttachmentClient) preparerForGetEntityTag(ctx context.Context, id AttachmentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiIssueAttachmentClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_listbyservice.go new file mode 100644 index 00000000000..bda7001b3ab --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_listbyservice.go @@ -0,0 +1,125 @@ +package apiissueattachment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]IssueAttachmentContract +} + +type ListByServiceCompleteResult struct { + Items []IssueAttachmentContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiIssueAttachmentClient) ListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/attachments", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]IssueAttachmentContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiIssueAttachmentClient) ListByServiceComplete(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueAttachmentContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiIssueAttachmentClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions, predicate IssueAttachmentContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]IssueAttachmentContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_listbyservice_autorest.go deleted file mode 100644 index 8decbc696ea..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissueattachment/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apiissueattachment - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]IssueAttachmentContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []IssueAttachmentContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiIssueAttachmentClient) ListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiIssueAttachmentClient) preparerForListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/attachments", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiIssueAttachmentClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiIssueAttachmentClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []IssueAttachmentContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiIssueAttachmentClient) ListByServiceComplete(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueAttachmentContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiIssueAttachmentClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions, predicate IssueAttachmentContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]IssueAttachmentContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/client.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/client.go index c2d875d616a..475bacaea06 100644 --- a/resource-manager/apimanagement/2021-08-01/apiissuecomment/client.go +++ b/resource-manager/apimanagement/2021-08-01/apiissuecomment/client.go @@ -1,18 +1,26 @@ package apiissuecomment -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiIssueCommentClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiIssueCommentClientWithBaseURI(endpoint string) ApiIssueCommentClient { - return ApiIssueCommentClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiIssueCommentClientWithBaseURI(api sdkEnv.Api) (*ApiIssueCommentClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiissuecomment", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiIssueCommentClient: %+v", err) } + + return &ApiIssueCommentClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_createorupdate.go new file mode 100644 index 00000000000..4151626f6b6 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_createorupdate.go @@ -0,0 +1,85 @@ +package apiissuecomment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueCommentContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiIssueCommentClient) CreateOrUpdate(ctx context.Context, id CommentId, input IssueCommentContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_createorupdate_autorest.go deleted file mode 100644 index 4b1b3d4e955..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiissuecomment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *IssueCommentContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiIssueCommentClient) CreateOrUpdate(ctx context.Context, id CommentId, input IssueCommentContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiIssueCommentClient) preparerForCreateOrUpdate(ctx context.Context, id CommentId, input IssueCommentContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiIssueCommentClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_delete.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_delete.go new file mode 100644 index 00000000000..b6cb1c7f69b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_delete.go @@ -0,0 +1,76 @@ +package apiissuecomment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiIssueCommentClient) Delete(ctx context.Context, id CommentId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_delete_autorest.go deleted file mode 100644 index ae7d6a12be4..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apiissuecomment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiIssueCommentClient) Delete(ctx context.Context, id CommentId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiIssueCommentClient) preparerForDelete(ctx context.Context, id CommentId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiIssueCommentClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_get.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_get.go new file mode 100644 index 00000000000..df6ff41fb18 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_get.go @@ -0,0 +1,51 @@ +package apiissuecomment + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueCommentContract +} + +// Get ... +func (c ApiIssueCommentClient) Get(ctx context.Context, id CommentId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_get_autorest.go deleted file mode 100644 index 97cae9d1ac1..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apiissuecomment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *IssueCommentContract -} - -// Get ... -func (c ApiIssueCommentClient) Get(ctx context.Context, id CommentId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiIssueCommentClient) preparerForGet(ctx context.Context, id CommentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiIssueCommentClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_getentitytag.go new file mode 100644 index 00000000000..a5ce802f723 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_getentitytag.go @@ -0,0 +1,46 @@ +package apiissuecomment + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiIssueCommentClient) GetEntityTag(ctx context.Context, id CommentId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_getentitytag_autorest.go deleted file mode 100644 index 7793e44727b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apiissuecomment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiIssueCommentClient) GetEntityTag(ctx context.Context, id CommentId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiIssueCommentClient) preparerForGetEntityTag(ctx context.Context, id CommentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiIssueCommentClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_listbyservice.go new file mode 100644 index 00000000000..3240d518d9c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_listbyservice.go @@ -0,0 +1,125 @@ +package apiissuecomment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]IssueCommentContract +} + +type ListByServiceCompleteResult struct { + Items []IssueCommentContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiIssueCommentClient) ListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/comments", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]IssueCommentContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiIssueCommentClient) ListByServiceComplete(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueCommentContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiIssueCommentClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions, predicate IssueCommentContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]IssueCommentContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_listbyservice_autorest.go deleted file mode 100644 index 3057cba0d58..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiissuecomment/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apiissuecomment - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]IssueCommentContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []IssueCommentContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiIssueCommentClient) ListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiIssueCommentClient) preparerForListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/comments", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiIssueCommentClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiIssueCommentClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []IssueCommentContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiIssueCommentClient) ListByServiceComplete(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueCommentContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiIssueCommentClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions, predicate IssueCommentContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]IssueCommentContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/client.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/client.go index b6859cfd757..830fe9c9333 100644 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/client.go +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/client.go @@ -1,18 +1,26 @@ package apimanagementservice -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiManagementServiceClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiManagementServiceClientWithBaseURI(endpoint string) ApiManagementServiceClient { - return ApiManagementServiceClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiManagementServiceClientWithBaseURI(api sdkEnv.Api) (*ApiManagementServiceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apimanagementservice", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiManagementServiceClient: %+v", err) } + + return &ApiManagementServiceClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/constants.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/constants.go index a263c7d5663..2828a0eda16 100644 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/constants.go +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/constants.go @@ -1,6 +1,10 @@ package apimanagementservice -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForAccessType() []string { } } +func (s *AccessType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAccessType(input string) (*AccessType, error) { vals := map[string]AccessType{ "accesskey": AccessTypeAccessKey, @@ -54,6 +71,19 @@ func PossibleValuesForCertificateSource() []string { } } +func (s *CertificateSource) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCertificateSource(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCertificateSource(input string) (*CertificateSource, error) { vals := map[string]CertificateSource{ "builtin": CertificateSourceBuiltIn, @@ -86,6 +116,19 @@ func PossibleValuesForCertificateStatus() []string { } } +func (s *CertificateStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCertificateStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCertificateStatus(input string) (*CertificateStatus, error) { vals := map[string]CertificateStatus{ "completed": CertificateStatusCompleted, @@ -121,6 +164,19 @@ func PossibleValuesForHostnameType() []string { } } +func (s *HostnameType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHostnameType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseHostnameType(input string) (*HostnameType, error) { vals := map[string]HostnameType{ "developerportal": HostnameTypeDeveloperPortal, @@ -154,6 +210,19 @@ func PossibleValuesForNameAvailabilityReason() []string { } } +func (s *NameAvailabilityReason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNameAvailabilityReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNameAvailabilityReason(input string) (*NameAvailabilityReason, error) { vals := map[string]NameAvailabilityReason{ "alreadyexists": NameAvailabilityReasonAlreadyExists, @@ -187,6 +256,19 @@ func PossibleValuesForPlatformVersion() []string { } } +func (s *PlatformVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePlatformVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePlatformVersion(input string) (*PlatformVersion, error) { vals := map[string]PlatformVersion{ "mtv1": PlatformVersionMtvOne, @@ -219,6 +301,19 @@ func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { } } +func (s *PrivateEndpointServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { vals := map[string]PrivateEndpointServiceConnectionStatus{ "approved": PrivateEndpointServiceConnectionStatusApproved, @@ -248,6 +343,19 @@ func PossibleValuesForPublicNetworkAccess() []string { } } +func (s *PublicNetworkAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { vals := map[string]PublicNetworkAccess{ "disabled": PublicNetworkAccessDisabled, @@ -284,6 +392,19 @@ func PossibleValuesForSkuType() []string { } } +func (s *SkuType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSkuType(input string) (*SkuType, error) { vals := map[string]SkuType{ "basic": SkuTypeBasic, @@ -316,6 +437,19 @@ func PossibleValuesForStoreName() []string { } } +func (s *StoreName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStoreName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseStoreName(input string) (*StoreName, error) { vals := map[string]StoreName{ "certificateauthority": StoreNameCertificateAuthority, @@ -346,6 +480,19 @@ func PossibleValuesForVirtualNetworkType() []string { } } +func (s *VirtualNetworkType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualNetworkType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVirtualNetworkType(input string) (*VirtualNetworkType, error) { vals := map[string]VirtualNetworkType{ "external": VirtualNetworkTypeExternal, diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_applynetworkconfigurationupdates.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_applynetworkconfigurationupdates.go new file mode 100644 index 00000000000..47666690d41 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_applynetworkconfigurationupdates.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplyNetworkConfigurationUpdatesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApplyNetworkConfigurationUpdates ... +func (c ApiManagementServiceClient) ApplyNetworkConfigurationUpdates(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) (result ApplyNetworkConfigurationUpdatesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/applynetworkconfigurationupdates", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ApplyNetworkConfigurationUpdatesThenPoll performs ApplyNetworkConfigurationUpdates then polls until it's completed +func (c ApiManagementServiceClient) ApplyNetworkConfigurationUpdatesThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) error { + result, err := c.ApplyNetworkConfigurationUpdates(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ApplyNetworkConfigurationUpdates: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApplyNetworkConfigurationUpdates: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_applynetworkconfigurationupdates_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_applynetworkconfigurationupdates_autorest.go deleted file mode 100644 index 7a1a5edef4d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_applynetworkconfigurationupdates_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ApplyNetworkConfigurationUpdatesOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// ApplyNetworkConfigurationUpdates ... -func (c ApiManagementServiceClient) ApplyNetworkConfigurationUpdates(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) (result ApplyNetworkConfigurationUpdatesOperationResponse, err error) { - req, err := c.preparerForApplyNetworkConfigurationUpdates(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ApplyNetworkConfigurationUpdates", nil, "Failure preparing request") - return - } - - result, err = c.senderForApplyNetworkConfigurationUpdates(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ApplyNetworkConfigurationUpdates", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ApplyNetworkConfigurationUpdatesThenPoll performs ApplyNetworkConfigurationUpdates then polls until it's completed -func (c ApiManagementServiceClient) ApplyNetworkConfigurationUpdatesThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) error { - result, err := c.ApplyNetworkConfigurationUpdates(ctx, id, input) - if err != nil { - return fmt.Errorf("performing ApplyNetworkConfigurationUpdates: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after ApplyNetworkConfigurationUpdates: %+v", err) - } - - return nil -} - -// preparerForApplyNetworkConfigurationUpdates prepares the ApplyNetworkConfigurationUpdates request. -func (c ApiManagementServiceClient) preparerForApplyNetworkConfigurationUpdates(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/applynetworkconfigurationupdates", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForApplyNetworkConfigurationUpdates sends the ApplyNetworkConfigurationUpdates request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForApplyNetworkConfigurationUpdates(ctx context.Context, req *http.Request) (future ApplyNetworkConfigurationUpdatesOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_backup.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_backup.go new file mode 100644 index 00000000000..2d68d0ef05f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_backup.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Backup ... +func (c ApiManagementServiceClient) Backup(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (result BackupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/backup", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BackupThenPoll performs Backup then polls until it's completed +func (c ApiManagementServiceClient) BackupThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) error { + result, err := c.Backup(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Backup: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Backup: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_backup_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_backup_autorest.go deleted file mode 100644 index 425460d47a1..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_backup_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BackupOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Backup ... -func (c ApiManagementServiceClient) Backup(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (result BackupOperationResponse, err error) { - req, err := c.preparerForBackup(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Backup", nil, "Failure preparing request") - return - } - - result, err = c.senderForBackup(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Backup", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// BackupThenPoll performs Backup then polls until it's completed -func (c ApiManagementServiceClient) BackupThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) error { - result, err := c.Backup(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Backup: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Backup: %+v", err) - } - - return nil -} - -// preparerForBackup prepares the Backup request. -func (c ApiManagementServiceClient) preparerForBackup(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/backup", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForBackup sends the Backup request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForBackup(ctx context.Context, req *http.Request) (future BackupOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_checknameavailability.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_checknameavailability.go new file mode 100644 index 00000000000..69c30c85560 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_checknameavailability.go @@ -0,0 +1,57 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceNameAvailabilityResult +} + +// CheckNameAvailability ... +func (c ApiManagementServiceClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input ApiManagementServiceCheckNameAvailabilityParameters) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/checkNameAvailability", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_checknameavailability_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_checknameavailability_autorest.go deleted file mode 100644 index cd62edeb4a2..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_checknameavailability_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *ApiManagementServiceNameAvailabilityResult -} - -// CheckNameAvailability ... -func (c ApiManagementServiceClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input ApiManagementServiceCheckNameAvailabilityParameters) (result CheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c ApiManagementServiceClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input ApiManagementServiceCheckNameAvailabilityParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_createorupdate.go new file mode 100644 index 00000000000..37d9326ce19 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_createorupdate.go @@ -0,0 +1,75 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c ApiManagementServiceClient) CreateOrUpdate(ctx context.Context, id ServiceId, input ApiManagementServiceResource) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ApiManagementServiceClient) CreateOrUpdateThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceResource) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_createorupdate_autorest.go deleted file mode 100644 index b374287e28f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c ApiManagementServiceClient) CreateOrUpdate(ctx context.Context, id ServiceId, input ApiManagementServiceResource) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ApiManagementServiceClient) CreateOrUpdateThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceResource) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiManagementServiceClient) preparerForCreateOrUpdate(ctx context.Context, id ServiceId, input ApiManagementServiceResource) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_delete.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_delete.go new file mode 100644 index 00000000000..e40cd93940a --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_delete.go @@ -0,0 +1,71 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ApiManagementServiceClient) Delete(ctx context.Context, id ServiceId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ApiManagementServiceClient) DeleteThenPoll(ctx context.Context, id ServiceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_delete_autorest.go deleted file mode 100644 index c8aa7ccb600..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c ApiManagementServiceClient) Delete(ctx context.Context, id ServiceId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ApiManagementServiceClient) DeleteThenPoll(ctx context.Context, id ServiceId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c ApiManagementServiceClient) preparerForDelete(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_get.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_get.go new file mode 100644 index 00000000000..a12ef17aed4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_get.go @@ -0,0 +1,51 @@ +package apimanagementservice + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceResource +} + +// Get ... +func (c ApiManagementServiceClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_get_autorest.go deleted file mode 100644 index 83af95cf755..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apimanagementservice - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ApiManagementServiceResource -} - -// Get ... -func (c ApiManagementServiceClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiManagementServiceClient) preparerForGet(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getdomainownershipidentifier.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getdomainownershipidentifier.go new file mode 100644 index 00000000000..de103cd5209 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getdomainownershipidentifier.go @@ -0,0 +1,53 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDomainOwnershipIdentifierOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceGetDomainOwnershipIdentifierResult +} + +// GetDomainOwnershipIdentifier ... +func (c ApiManagementServiceClient) GetDomainOwnershipIdentifier(ctx context.Context, id commonids.SubscriptionId) (result GetDomainOwnershipIdentifierOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getdomainownershipidentifier_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getdomainownershipidentifier_autorest.go deleted file mode 100644 index 3ee44e20f2e..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getdomainownershipidentifier_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetDomainOwnershipIdentifierOperationResponse struct { - HttpResponse *http.Response - Model *ApiManagementServiceGetDomainOwnershipIdentifierResult -} - -// GetDomainOwnershipIdentifier ... -func (c ApiManagementServiceClient) GetDomainOwnershipIdentifier(ctx context.Context, id commonids.SubscriptionId) (result GetDomainOwnershipIdentifierOperationResponse, err error) { - req, err := c.preparerForGetDomainOwnershipIdentifier(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetDomainOwnershipIdentifier", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetDomainOwnershipIdentifier", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetDomainOwnershipIdentifier(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetDomainOwnershipIdentifier", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetDomainOwnershipIdentifier prepares the GetDomainOwnershipIdentifier request. -func (c ApiManagementServiceClient) preparerForGetDomainOwnershipIdentifier(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetDomainOwnershipIdentifier handles the response to the GetDomainOwnershipIdentifier request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForGetDomainOwnershipIdentifier(resp *http.Response) (result GetDomainOwnershipIdentifierOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getssotoken.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getssotoken.go new file mode 100644 index 00000000000..2831bca105b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getssotoken.go @@ -0,0 +1,52 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetSsoTokenOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceGetSsoTokenResult +} + +// GetSsoToken ... +func (c ApiManagementServiceClient) GetSsoToken(ctx context.Context, id ServiceId) (result GetSsoTokenOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/getssotoken", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getssotoken_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getssotoken_autorest.go deleted file mode 100644 index e66d5a4b465..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_getssotoken_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetSsoTokenOperationResponse struct { - HttpResponse *http.Response - Model *ApiManagementServiceGetSsoTokenResult -} - -// GetSsoToken ... -func (c ApiManagementServiceClient) GetSsoToken(ctx context.Context, id ServiceId) (result GetSsoTokenOperationResponse, err error) { - req, err := c.preparerForGetSsoToken(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetSsoToken", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetSsoToken", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetSsoToken(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetSsoToken", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetSsoToken prepares the GetSsoToken request. -func (c ApiManagementServiceClient) preparerForGetSsoToken(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/getssotoken", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetSsoToken handles the response to the GetSsoToken request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForGetSsoToken(resp *http.Response) (result GetSsoTokenOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_list.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_list.go new file mode 100644 index 00000000000..2f75508ba8a --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_list.go @@ -0,0 +1,90 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiManagementServiceResource +} + +type ListCompleteResult struct { + Items []ApiManagementServiceResource +} + +// List ... +func (c ApiManagementServiceClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/service", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiManagementServiceResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ApiManagementServiceClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ApiManagementServiceResourceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiManagementServiceClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApiManagementServiceResourceOperationPredicate) (result ListCompleteResult, err error) { + items := make([]ApiManagementServiceResource, 0) + + resp, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_list_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_list_autorest.go deleted file mode 100644 index bc98fce7338..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiManagementServiceResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []ApiManagementServiceResource -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c ApiManagementServiceClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ApiManagementServiceClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/service", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ApiManagementServiceClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []ApiManagementServiceResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ApiManagementServiceClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ApiManagementServiceResourceOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiManagementServiceClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApiManagementServiceResourceOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]ApiManagementServiceResource, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_listbyresourcegroup.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_listbyresourcegroup.go new file mode 100644 index 00000000000..46aadae6bda --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiManagementServiceResource +} + +type ListByResourceGroupCompleteResult struct { + Items []ApiManagementServiceResource +} + +// ListByResourceGroup ... +func (c ApiManagementServiceClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/service", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiManagementServiceResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ApiManagementServiceClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ApiManagementServiceResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiManagementServiceClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ApiManagementServiceResourceOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ApiManagementServiceResource, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_listbyresourcegroup_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_listbyresourcegroup_autorest.go deleted file mode 100644 index f7776316529..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiManagementServiceResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []ApiManagementServiceResource -} - -func (r ListByResourceGroupOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c ApiManagementServiceClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ApiManagementServiceClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/service", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c ApiManagementServiceClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []ApiManagementServiceResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c ApiManagementServiceClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ApiManagementServiceResourceOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiManagementServiceClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ApiManagementServiceResourceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]ApiManagementServiceResource, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_restore.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_restore.go new file mode 100644 index 00000000000..5ea017b5905 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_restore.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestoreOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restore ... +func (c ApiManagementServiceClient) Restore(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (result RestoreOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restore", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RestoreThenPoll performs Restore then polls until it's completed +func (c ApiManagementServiceClient) RestoreThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) error { + result, err := c.Restore(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Restore: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restore: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_restore_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_restore_autorest.go deleted file mode 100644 index bb762b61349..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_restore_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RestoreOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Restore ... -func (c ApiManagementServiceClient) Restore(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (result RestoreOperationResponse, err error) { - req, err := c.preparerForRestore(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Restore", nil, "Failure preparing request") - return - } - - result, err = c.senderForRestore(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Restore", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RestoreThenPoll performs Restore then polls until it's completed -func (c ApiManagementServiceClient) RestoreThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) error { - result, err := c.Restore(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Restore: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Restore: %+v", err) - } - - return nil -} - -// preparerForRestore prepares the Restore request. -func (c ApiManagementServiceClient) preparerForRestore(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/restore", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRestore sends the Restore request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForRestore(ctx context.Context, req *http.Request) (future RestoreOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_update.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_update.go new file mode 100644 index 00000000000..9a2e8907c9b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_update.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c ApiManagementServiceClient) Update(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ApiManagementServiceClient) UpdateThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_update_autorest.go deleted file mode 100644 index c4047579231..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/method_update_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c ApiManagementServiceClient) Update(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c ApiManagementServiceClient) UpdateThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c ApiManagementServiceClient) preparerForUpdate(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/client.go b/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/client.go index eb6747c1e12..8940dc53edb 100644 --- a/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/client.go +++ b/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/client.go @@ -1,18 +1,26 @@ package apimanagementserviceskus -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiManagementServiceSkusClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiManagementServiceSkusClientWithBaseURI(endpoint string) ApiManagementServiceSkusClient { - return ApiManagementServiceSkusClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiManagementServiceSkusClientWithBaseURI(api sdkEnv.Api) (*ApiManagementServiceSkusClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apimanagementserviceskus", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiManagementServiceSkusClient: %+v", err) } + + return &ApiManagementServiceSkusClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/constants.go b/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/constants.go index d5d2b9ea3eb..d9e2bd19e1c 100644 --- a/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/constants.go +++ b/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/constants.go @@ -1,6 +1,10 @@ package apimanagementserviceskus -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForResourceSkuCapacityScaleType() []string { } } +func (s *ResourceSkuCapacityScaleType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceSkuCapacityScaleType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseResourceSkuCapacityScaleType(input string) (*ResourceSkuCapacityScaleType, error) { vals := map[string]ResourceSkuCapacityScaleType{ "automatic": ResourceSkuCapacityScaleTypeAutomatic, @@ -58,6 +75,19 @@ func PossibleValuesForSkuType() []string { } } +func (s *SkuType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSkuType(input string) (*SkuType, error) { vals := map[string]SkuType{ "basic": SkuTypeBasic, diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/method_listavailableserviceskus.go b/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/method_listavailableserviceskus.go new file mode 100644 index 00000000000..afe8ea5af07 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/method_listavailableserviceskus.go @@ -0,0 +1,89 @@ +package apimanagementserviceskus + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAvailableServiceSkusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ResourceSkuResult +} + +type ListAvailableServiceSkusCompleteResult struct { + Items []ResourceSkuResult +} + +// ListAvailableServiceSkus ... +func (c ApiManagementServiceSkusClient) ListAvailableServiceSkus(ctx context.Context, id ServiceId) (result ListAvailableServiceSkusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/skus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ResourceSkuResult `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAvailableServiceSkusComplete retrieves all the results into a single object +func (c ApiManagementServiceSkusClient) ListAvailableServiceSkusComplete(ctx context.Context, id ServiceId) (ListAvailableServiceSkusCompleteResult, error) { + return c.ListAvailableServiceSkusCompleteMatchingPredicate(ctx, id, ResourceSkuResultOperationPredicate{}) +} + +// ListAvailableServiceSkusCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiManagementServiceSkusClient) ListAvailableServiceSkusCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate ResourceSkuResultOperationPredicate) (result ListAvailableServiceSkusCompleteResult, err error) { + items := make([]ResourceSkuResult, 0) + + resp, err := c.ListAvailableServiceSkus(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListAvailableServiceSkusCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/method_listavailableserviceskus_autorest.go b/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/method_listavailableserviceskus_autorest.go deleted file mode 100644 index f5aa634c623..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/method_listavailableserviceskus_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package apimanagementserviceskus - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListAvailableServiceSkusOperationResponse struct { - HttpResponse *http.Response - Model *[]ResourceSkuResult - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListAvailableServiceSkusOperationResponse, error) -} - -type ListAvailableServiceSkusCompleteResult struct { - Items []ResourceSkuResult -} - -func (r ListAvailableServiceSkusOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListAvailableServiceSkusOperationResponse) LoadMore(ctx context.Context) (resp ListAvailableServiceSkusOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListAvailableServiceSkus ... -func (c ApiManagementServiceSkusClient) ListAvailableServiceSkus(ctx context.Context, id ServiceId) (resp ListAvailableServiceSkusOperationResponse, err error) { - req, err := c.preparerForListAvailableServiceSkus(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListAvailableServiceSkus(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListAvailableServiceSkus prepares the ListAvailableServiceSkus request. -func (c ApiManagementServiceSkusClient) preparerForListAvailableServiceSkus(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/skus", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListAvailableServiceSkusWithNextLink prepares the ListAvailableServiceSkus request with the given nextLink token. -func (c ApiManagementServiceSkusClient) preparerForListAvailableServiceSkusWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListAvailableServiceSkus handles the response to the ListAvailableServiceSkus request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceSkusClient) responderForListAvailableServiceSkus(resp *http.Response) (result ListAvailableServiceSkusOperationResponse, err error) { - type page struct { - Values []ResourceSkuResult `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAvailableServiceSkusOperationResponse, err error) { - req, err := c.preparerForListAvailableServiceSkusWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListAvailableServiceSkus(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListAvailableServiceSkusComplete retrieves all of the results into a single object -func (c ApiManagementServiceSkusClient) ListAvailableServiceSkusComplete(ctx context.Context, id ServiceId) (ListAvailableServiceSkusCompleteResult, error) { - return c.ListAvailableServiceSkusCompleteMatchingPredicate(ctx, id, ResourceSkuResultOperationPredicate{}) -} - -// ListAvailableServiceSkusCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiManagementServiceSkusClient) ListAvailableServiceSkusCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate ResourceSkuResultOperationPredicate) (resp ListAvailableServiceSkusCompleteResult, err error) { - items := make([]ResourceSkuResult, 0) - - page, err := c.ListAvailableServiceSkus(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListAvailableServiceSkusCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/client.go b/resource-manager/apimanagement/2021-08-01/apioperation/client.go index f4e640e1356..68d147befcb 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperation/client.go +++ b/resource-manager/apimanagement/2021-08-01/apioperation/client.go @@ -1,18 +1,26 @@ package apioperation -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiOperationClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiOperationClientWithBaseURI(endpoint string) ApiOperationClient { - return ApiOperationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiOperationClientWithBaseURI(api sdkEnv.Api) (*ApiOperationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apioperation", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiOperationClient: %+v", err) } + + return &ApiOperationClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_createorupdate.go new file mode 100644 index 00000000000..6dc046e355f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperation/method_createorupdate.go @@ -0,0 +1,85 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OperationContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiOperationClient) CreateOrUpdate(ctx context.Context, id OperationId, input OperationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_createorupdate_autorest.go deleted file mode 100644 index 248feffbbb9..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperation/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apioperation - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *OperationContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiOperationClient) CreateOrUpdate(ctx context.Context, id OperationId, input OperationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiOperationClient) preparerForCreateOrUpdate(ctx context.Context, id OperationId, input OperationContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_delete.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_delete.go new file mode 100644 index 00000000000..0693a0a284f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperation/method_delete.go @@ -0,0 +1,76 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiOperationClient) Delete(ctx context.Context, id OperationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_delete_autorest.go deleted file mode 100644 index 6a968ca42c0..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperation/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apioperation - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiOperationClient) Delete(ctx context.Context, id OperationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiOperationClient) preparerForDelete(ctx context.Context, id OperationId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_get.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_get.go new file mode 100644 index 00000000000..d5786d5ae91 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperation/method_get.go @@ -0,0 +1,51 @@ +package apioperation + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OperationContract +} + +// Get ... +func (c ApiOperationClient) Get(ctx context.Context, id OperationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_get_autorest.go deleted file mode 100644 index 71209f67ea1..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperation/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apioperation - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *OperationContract -} - -// Get ... -func (c ApiOperationClient) Get(ctx context.Context, id OperationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiOperationClient) preparerForGet(ctx context.Context, id OperationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_getentitytag.go new file mode 100644 index 00000000000..520a7b92e36 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperation/method_getentitytag.go @@ -0,0 +1,46 @@ +package apioperation + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiOperationClient) GetEntityTag(ctx context.Context, id OperationId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_getentitytag_autorest.go deleted file mode 100644 index fbf38551a9a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperation/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apioperation - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiOperationClient) GetEntityTag(ctx context.Context, id OperationId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiOperationClient) preparerForGetEntityTag(ctx context.Context, id OperationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_listbyapi.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_listbyapi.go new file mode 100644 index 00000000000..5620f8b7c3e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperation/method_listbyapi.go @@ -0,0 +1,129 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OperationContract +} + +type ListByApiCompleteResult struct { + Items []OperationContract +} + +type ListByApiOperationOptions struct { + Filter *string + Skip *int64 + Tags *string + Top *int64 +} + +func DefaultListByApiOperationOptions() ListByApiOperationOptions { + return ListByApiOperationOptions{} +} + +func (o ListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Tags != nil { + out.Append("tags", fmt.Sprintf("%v", *o.Tags)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByApi ... +func (c ApiOperationClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/operations", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]OperationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByApiComplete retrieves all the results into a single object +func (c ApiOperationClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { + return c.ListByApiCompleteMatchingPredicate(ctx, id, options, OperationContractOperationPredicate{}) +} + +// ListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiOperationClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate OperationContractOperationPredicate) (result ListByApiCompleteResult, err error) { + items := make([]OperationContract, 0) + + resp, err := c.ListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_listbyapi_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_listbyapi_autorest.go deleted file mode 100644 index 081748611d8..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperation/method_listbyapi_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package apioperation - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByApiOperationResponse struct { - HttpResponse *http.Response - Model *[]OperationContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByApiOperationResponse, error) -} - -type ListByApiCompleteResult struct { - Items []OperationContract -} - -func (r ListByApiOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByApiOperationResponse) LoadMore(ctx context.Context) (resp ListByApiOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByApiOperationOptions struct { - Filter *string - Skip *int64 - Tags *string - Top *int64 -} - -func DefaultListByApiOperationOptions() ListByApiOperationOptions { - return ListByApiOperationOptions{} -} - -func (o ListByApiOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByApiOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Tags != nil { - out["tags"] = *o.Tags - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByApi ... -func (c ApiOperationClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (resp ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApi(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByApi(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByApi prepares the ListByApi request. -func (c ApiOperationClient) preparerForListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/operations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByApiWithNextLink prepares the ListByApi request with the given nextLink token. -func (c ApiOperationClient) preparerForListByApiWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByApi handles the response to the ListByApi request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForListByApi(resp *http.Response) (result ListByApiOperationResponse, err error) { - type page struct { - Values []OperationContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApiWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByApiComplete retrieves all of the results into a single object -func (c ApiOperationClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { - return c.ListByApiCompleteMatchingPredicate(ctx, id, options, OperationContractOperationPredicate{}) -} - -// ListByApiCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiOperationClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate OperationContractOperationPredicate) (resp ListByApiCompleteResult, err error) { - items := make([]OperationContract, 0) - - page, err := c.ListByApi(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByApiCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_update.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_update.go new file mode 100644 index 00000000000..9b215cf692d --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperation/method_update.go @@ -0,0 +1,84 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OperationContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiOperationClient) Update(ctx context.Context, id OperationId, input OperationUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperation/method_update_autorest.go deleted file mode 100644 index 753e7e9c090..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperation/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apioperation - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *OperationContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiOperationClient) Update(ctx context.Context, id OperationId, input OperationUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiOperationClient) preparerForUpdate(ctx context.Context, id OperationId, input OperationUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/client.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/client.go index 263cb368c90..ae379c3ce4b 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/client.go +++ b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/client.go @@ -1,18 +1,26 @@ package apioperationpolicy -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiOperationPolicyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiOperationPolicyClientWithBaseURI(endpoint string) ApiOperationPolicyClient { - return ApiOperationPolicyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiOperationPolicyClientWithBaseURI(api sdkEnv.Api) (*ApiOperationPolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apioperationpolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiOperationPolicyClient: %+v", err) } + + return &ApiOperationPolicyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/constants.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/constants.go index c8bec979994..5a4b902d0cf 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/constants.go +++ b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/constants.go @@ -1,6 +1,10 @@ package apioperationpolicy -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPolicyContentFormat() []string { } } +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { vals := map[string]PolicyContentFormat{ "rawxml": PolicyContentFormatRawxml, @@ -53,6 +70,19 @@ func PossibleValuesForPolicyExportFormat() []string { } } +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { vals := map[string]PolicyExportFormat{ "rawxml": PolicyExportFormatRawxml, diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_createorupdate.go new file mode 100644 index 00000000000..a25fdb2042e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_createorupdate.go @@ -0,0 +1,85 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiOperationPolicyClient) CreateOrUpdate(ctx context.Context, id OperationId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_createorupdate_autorest.go deleted file mode 100644 index ab93439da2b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package apioperationpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiOperationPolicyClient) CreateOrUpdate(ctx context.Context, id OperationId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiOperationPolicyClient) preparerForCreateOrUpdate(ctx context.Context, id OperationId, input PolicyContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiOperationPolicyClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_delete.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_delete.go new file mode 100644 index 00000000000..f30d7d3e932 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_delete.go @@ -0,0 +1,76 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiOperationPolicyClient) Delete(ctx context.Context, id OperationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_delete_autorest.go deleted file mode 100644 index cb4dd35c12f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_delete_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package apioperationpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiOperationPolicyClient) Delete(ctx context.Context, id OperationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiOperationPolicyClient) preparerForDelete(ctx context.Context, id OperationId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiOperationPolicyClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_get.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_get.go new file mode 100644 index 00000000000..62c2e626268 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_get.go @@ -0,0 +1,80 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c ApiOperationPolicyClient) Get(ctx context.Context, id OperationId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_get_autorest.go deleted file mode 100644 index 8016e93dbbe..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_get_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apioperationpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type GetOperationOptions struct { - Format *PolicyExportFormat -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - return out -} - -// Get ... -func (c ApiOperationPolicyClient) Get(ctx context.Context, id OperationId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiOperationPolicyClient) preparerForGet(ctx context.Context, id OperationId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiOperationPolicyClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_getentitytag.go new file mode 100644 index 00000000000..88da95a1537 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_getentitytag.go @@ -0,0 +1,47 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiOperationPolicyClient) GetEntityTag(ctx context.Context, id OperationId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_getentitytag_autorest.go deleted file mode 100644 index 694655ef4b7..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package apioperationpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiOperationPolicyClient) GetEntityTag(ctx context.Context, id OperationId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiOperationPolicyClient) preparerForGetEntityTag(ctx context.Context, id OperationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiOperationPolicyClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_listbyoperation.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_listbyoperation.go new file mode 100644 index 00000000000..0f79c48d5fe --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_listbyoperation.go @@ -0,0 +1,52 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByOperation ... +func (c ApiOperationPolicyClient) ListByOperation(ctx context.Context, id OperationId) (result ListByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_listbyoperation_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_listbyoperation_autorest.go deleted file mode 100644 index 65975e5077b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/method_listbyoperation_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package apioperationpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByOperationOperationResponse struct { - HttpResponse *http.Response - Model *PolicyCollection -} - -// ListByOperation ... -func (c ApiOperationPolicyClient) ListByOperation(ctx context.Context, id OperationId) (result ListByOperationOperationResponse, err error) { - req, err := c.preparerForListByOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "ListByOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "ListByOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "ListByOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByOperation prepares the ListByOperation request. -func (c ApiOperationPolicyClient) preparerForListByOperation(ctx context.Context, id OperationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByOperation handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationPolicyClient) responderForListByOperation(resp *http.Response) (result ListByOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationsbytag/client.go b/resource-manager/apimanagement/2021-08-01/apioperationsbytag/client.go index 48716e67800..77b4aa9b323 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperationsbytag/client.go +++ b/resource-manager/apimanagement/2021-08-01/apioperationsbytag/client.go @@ -1,18 +1,26 @@ package apioperationsbytag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiOperationsByTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiOperationsByTagClientWithBaseURI(endpoint string) ApiOperationsByTagClient { - return ApiOperationsByTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiOperationsByTagClientWithBaseURI(api sdkEnv.Api) (*ApiOperationsByTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apioperationsbytag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiOperationsByTagClient: %+v", err) } + + return &ApiOperationsByTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apioperationsbytag/constants.go b/resource-manager/apimanagement/2021-08-01/apioperationsbytag/constants.go index 7a4b9772ad9..c0f30b87134 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperationsbytag/constants.go +++ b/resource-manager/apimanagement/2021-08-01/apioperationsbytag/constants.go @@ -1,6 +1,10 @@ package apioperationsbytag -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -81,6 +111,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, @@ -113,6 +156,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, diff --git a/resource-manager/apimanagement/2021-08-01/apioperationsbytag/method_operationlistbytags.go b/resource-manager/apimanagement/2021-08-01/apioperationsbytag/method_operationlistbytags.go new file mode 100644 index 00000000000..2e348997053 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperationsbytag/method_operationlistbytags.go @@ -0,0 +1,129 @@ +package apioperationsbytag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationListByTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagResourceContract +} + +type OperationListByTagsCompleteResult struct { + Items []TagResourceContract +} + +type OperationListByTagsOperationOptions struct { + Filter *string + IncludeNotTaggedOperations *bool + Skip *int64 + Top *int64 +} + +func DefaultOperationListByTagsOperationOptions() OperationListByTagsOperationOptions { + return OperationListByTagsOperationOptions{} +} + +func (o OperationListByTagsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o OperationListByTagsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o OperationListByTagsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IncludeNotTaggedOperations != nil { + out.Append("includeNotTaggedOperations", fmt.Sprintf("%v", *o.IncludeNotTaggedOperations)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// OperationListByTags ... +func (c ApiOperationsByTagClient) OperationListByTags(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions) (result OperationListByTagsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/operationsByTags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagResourceContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// OperationListByTagsComplete retrieves all the results into a single object +func (c ApiOperationsByTagClient) OperationListByTagsComplete(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions) (OperationListByTagsCompleteResult, error) { + return c.OperationListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) +} + +// OperationListByTagsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiOperationsByTagClient) OperationListByTagsCompleteMatchingPredicate(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (result OperationListByTagsCompleteResult, err error) { + items := make([]TagResourceContract, 0) + + resp, err := c.OperationListByTags(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = OperationListByTagsCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationsbytag/method_operationlistbytags_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperationsbytag/method_operationlistbytags_autorest.go deleted file mode 100644 index 0c8ab093faf..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperationsbytag/method_operationlistbytags_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package apioperationsbytag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type OperationListByTagsOperationResponse struct { - HttpResponse *http.Response - Model *[]TagResourceContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (OperationListByTagsOperationResponse, error) -} - -type OperationListByTagsCompleteResult struct { - Items []TagResourceContract -} - -func (r OperationListByTagsOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r OperationListByTagsOperationResponse) LoadMore(ctx context.Context) (resp OperationListByTagsOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type OperationListByTagsOperationOptions struct { - Filter *string - IncludeNotTaggedOperations *bool - Skip *int64 - Top *int64 -} - -func DefaultOperationListByTagsOperationOptions() OperationListByTagsOperationOptions { - return OperationListByTagsOperationOptions{} -} - -func (o OperationListByTagsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o OperationListByTagsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.IncludeNotTaggedOperations != nil { - out["includeNotTaggedOperations"] = *o.IncludeNotTaggedOperations - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// OperationListByTags ... -func (c ApiOperationsByTagClient) OperationListByTags(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions) (resp OperationListByTagsOperationResponse, err error) { - req, err := c.preparerForOperationListByTags(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForOperationListByTags(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForOperationListByTags prepares the OperationListByTags request. -func (c ApiOperationsByTagClient) preparerForOperationListByTags(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/operationsByTags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForOperationListByTagsWithNextLink prepares the OperationListByTags request with the given nextLink token. -func (c ApiOperationsByTagClient) preparerForOperationListByTagsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForOperationListByTags handles the response to the OperationListByTags request. The method always -// closes the http.Response Body. -func (c ApiOperationsByTagClient) responderForOperationListByTags(resp *http.Response) (result OperationListByTagsOperationResponse, err error) { - type page struct { - Values []TagResourceContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result OperationListByTagsOperationResponse, err error) { - req, err := c.preparerForOperationListByTagsWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForOperationListByTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// OperationListByTagsComplete retrieves all of the results into a single object -func (c ApiOperationsByTagClient) OperationListByTagsComplete(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions) (OperationListByTagsCompleteResult, error) { - return c.OperationListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) -} - -// OperationListByTagsCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiOperationsByTagClient) OperationListByTagsCompleteMatchingPredicate(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (resp OperationListByTagsCompleteResult, err error) { - items := make([]TagResourceContract, 0) - - page, err := c.OperationListByTags(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := OperationListByTagsCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/client.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/client.go index 3bfc477ea28..bafff15be00 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperationtag/client.go +++ b/resource-manager/apimanagement/2021-08-01/apioperationtag/client.go @@ -1,18 +1,26 @@ package apioperationtag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiOperationTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiOperationTagClientWithBaseURI(endpoint string) ApiOperationTagClient { - return ApiOperationTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiOperationTagClientWithBaseURI(api sdkEnv.Api) (*ApiOperationTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apioperationtag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiOperationTagClient: %+v", err) } + + return &ApiOperationTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagassigntooperation.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagassigntooperation.go new file mode 100644 index 00000000000..2c431fe03fa --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagassigntooperation.go @@ -0,0 +1,52 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagAssignToOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagAssignToOperation ... +func (c ApiOperationTagClient) TagAssignToOperation(ctx context.Context, id OperationTagId) (result TagAssignToOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagassigntooperation_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagassigntooperation_autorest.go deleted file mode 100644 index 9d8aa0afd9a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagassigntooperation_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apioperationtag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagAssignToOperationOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagAssignToOperation ... -func (c ApiOperationTagClient) TagAssignToOperation(ctx context.Context, id OperationTagId) (result TagAssignToOperationOperationResponse, err error) { - req, err := c.preparerForTagAssignToOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagAssignToOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagAssignToOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagAssignToOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagAssignToOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagAssignToOperation prepares the TagAssignToOperation request. -func (c ApiOperationTagClient) preparerForTagAssignToOperation(ctx context.Context, id OperationTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagAssignToOperation handles the response to the TagAssignToOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationTagClient) responderForTagAssignToOperation(resp *http.Response) (result TagAssignToOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagdetachfromoperation.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagdetachfromoperation.go new file mode 100644 index 00000000000..b49f13cabd9 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagdetachfromoperation.go @@ -0,0 +1,47 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDetachFromOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagDetachFromOperation ... +func (c ApiOperationTagClient) TagDetachFromOperation(ctx context.Context, id OperationTagId) (result TagDetachFromOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagdetachfromoperation_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagdetachfromoperation_autorest.go deleted file mode 100644 index b7845a36364..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_tagdetachfromoperation_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apioperationtag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagDetachFromOperationOperationResponse struct { - HttpResponse *http.Response -} - -// TagDetachFromOperation ... -func (c ApiOperationTagClient) TagDetachFromOperation(ctx context.Context, id OperationTagId) (result TagDetachFromOperationOperationResponse, err error) { - req, err := c.preparerForTagDetachFromOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagDetachFromOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagDetachFromOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagDetachFromOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagDetachFromOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagDetachFromOperation prepares the TagDetachFromOperation request. -func (c ApiOperationTagClient) preparerForTagDetachFromOperation(ctx context.Context, id OperationTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagDetachFromOperation handles the response to the TagDetachFromOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationTagClient) responderForTagDetachFromOperation(resp *http.Response) (result TagDetachFromOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetbyoperation.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetbyoperation.go new file mode 100644 index 00000000000..a56dc05b28f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetbyoperation.go @@ -0,0 +1,51 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagGetByOperation ... +func (c ApiOperationTagClient) TagGetByOperation(ctx context.Context, id OperationTagId) (result TagGetByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetbyoperation_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetbyoperation_autorest.go deleted file mode 100644 index 8e6507984f5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetbyoperation_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apioperationtag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetByOperationOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagGetByOperation ... -func (c ApiOperationTagClient) TagGetByOperation(ctx context.Context, id OperationTagId) (result TagGetByOperationOperationResponse, err error) { - req, err := c.preparerForTagGetByOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetByOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetByOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetByOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetByOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetByOperation prepares the TagGetByOperation request. -func (c ApiOperationTagClient) preparerForTagGetByOperation(ctx context.Context, id OperationTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetByOperation handles the response to the TagGetByOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationTagClient) responderForTagGetByOperation(resp *http.Response) (result TagGetByOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetentitystatebyoperation.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetentitystatebyoperation.go new file mode 100644 index 00000000000..066af82b190 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetentitystatebyoperation.go @@ -0,0 +1,46 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetEntityStateByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagGetEntityStateByOperation ... +func (c ApiOperationTagClient) TagGetEntityStateByOperation(ctx context.Context, id OperationTagId) (result TagGetEntityStateByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetentitystatebyoperation_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetentitystatebyoperation_autorest.go deleted file mode 100644 index beaef9dc15a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taggetentitystatebyoperation_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apioperationtag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetEntityStateByOperationOperationResponse struct { - HttpResponse *http.Response -} - -// TagGetEntityStateByOperation ... -func (c ApiOperationTagClient) TagGetEntityStateByOperation(ctx context.Context, id OperationTagId) (result TagGetEntityStateByOperationOperationResponse, err error) { - req, err := c.preparerForTagGetEntityStateByOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetEntityStateByOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetEntityStateByOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetEntityStateByOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetEntityStateByOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetEntityStateByOperation prepares the TagGetEntityStateByOperation request. -func (c ApiOperationTagClient) preparerForTagGetEntityStateByOperation(ctx context.Context, id OperationTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetEntityStateByOperation handles the response to the TagGetEntityStateByOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationTagClient) responderForTagGetEntityStateByOperation(resp *http.Response) (result TagGetEntityStateByOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taglistbyoperation.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taglistbyoperation.go new file mode 100644 index 00000000000..b857e4ac190 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taglistbyoperation.go @@ -0,0 +1,125 @@ +package apioperationtag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagListByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type TagListByOperationCompleteResult struct { + Items []TagContract +} + +type TagListByOperationOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultTagListByOperationOperationOptions() TagListByOperationOperationOptions { + return TagListByOperationOperationOptions{} +} + +func (o TagListByOperationOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o TagListByOperationOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o TagListByOperationOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// TagListByOperation ... +func (c ApiOperationTagClient) TagListByOperation(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (result TagListByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// TagListByOperationComplete retrieves all the results into a single object +func (c ApiOperationTagClient) TagListByOperationComplete(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (TagListByOperationCompleteResult, error) { + return c.TagListByOperationCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// TagListByOperationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiOperationTagClient) TagListByOperationCompleteMatchingPredicate(ctx context.Context, id OperationId, options TagListByOperationOperationOptions, predicate TagContractOperationPredicate) (result TagListByOperationCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.TagListByOperation(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = TagListByOperationCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taglistbyoperation_autorest.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taglistbyoperation_autorest.go deleted file mode 100644 index 5bc7a969362..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apioperationtag/method_taglistbyoperation_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apioperationtag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagListByOperationOperationResponse struct { - HttpResponse *http.Response - Model *[]TagContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (TagListByOperationOperationResponse, error) -} - -type TagListByOperationCompleteResult struct { - Items []TagContract -} - -func (r TagListByOperationOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r TagListByOperationOperationResponse) LoadMore(ctx context.Context) (resp TagListByOperationOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type TagListByOperationOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultTagListByOperationOperationOptions() TagListByOperationOperationOptions { - return TagListByOperationOperationOptions{} -} - -func (o TagListByOperationOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o TagListByOperationOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// TagListByOperation ... -func (c ApiOperationTagClient) TagListByOperation(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (resp TagListByOperationOperationResponse, err error) { - req, err := c.preparerForTagListByOperation(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForTagListByOperation(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForTagListByOperation prepares the TagListByOperation request. -func (c ApiOperationTagClient) preparerForTagListByOperation(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForTagListByOperationWithNextLink prepares the TagListByOperation request with the given nextLink token. -func (c ApiOperationTagClient) preparerForTagListByOperationWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagListByOperation handles the response to the TagListByOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationTagClient) responderForTagListByOperation(resp *http.Response) (result TagListByOperationOperationResponse, err error) { - type page struct { - Values []TagContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result TagListByOperationOperationResponse, err error) { - req, err := c.preparerForTagListByOperationWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagListByOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// TagListByOperationComplete retrieves all of the results into a single object -func (c ApiOperationTagClient) TagListByOperationComplete(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (TagListByOperationCompleteResult, error) { - return c.TagListByOperationCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) -} - -// TagListByOperationCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiOperationTagClient) TagListByOperationCompleteMatchingPredicate(ctx context.Context, id OperationId, options TagListByOperationOperationOptions, predicate TagContractOperationPredicate) (resp TagListByOperationCompleteResult, err error) { - items := make([]TagContract, 0) - - page, err := c.TagListByOperation(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := TagListByOperationCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/client.go b/resource-manager/apimanagement/2021-08-01/apipolicy/client.go index 849c529fef4..0c9d45a5bac 100644 --- a/resource-manager/apimanagement/2021-08-01/apipolicy/client.go +++ b/resource-manager/apimanagement/2021-08-01/apipolicy/client.go @@ -1,18 +1,26 @@ package apipolicy -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiPolicyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiPolicyClientWithBaseURI(endpoint string) ApiPolicyClient { - return ApiPolicyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiPolicyClientWithBaseURI(api sdkEnv.Api) (*ApiPolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apipolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiPolicyClient: %+v", err) } + + return &ApiPolicyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/constants.go b/resource-manager/apimanagement/2021-08-01/apipolicy/constants.go index 0622a9d8ec5..3a402942dd8 100644 --- a/resource-manager/apimanagement/2021-08-01/apipolicy/constants.go +++ b/resource-manager/apimanagement/2021-08-01/apipolicy/constants.go @@ -1,6 +1,10 @@ package apipolicy -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPolicyContentFormat() []string { } } +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { vals := map[string]PolicyContentFormat{ "rawxml": PolicyContentFormatRawxml, @@ -53,6 +70,19 @@ func PossibleValuesForPolicyExportFormat() []string { } } +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { vals := map[string]PolicyExportFormat{ "rawxml": PolicyExportFormatRawxml, diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apipolicy/method_createorupdate.go new file mode 100644 index 00000000000..34932d9e40b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apipolicy/method_createorupdate.go @@ -0,0 +1,85 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiPolicyClient) CreateOrUpdate(ctx context.Context, id ApiId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apipolicy/method_createorupdate_autorest.go deleted file mode 100644 index 1d3e07d089c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apipolicy/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package apipolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiPolicyClient) CreateOrUpdate(ctx context.Context, id ApiId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiPolicyClient) preparerForCreateOrUpdate(ctx context.Context, id ApiId, input PolicyContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiPolicyClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/method_delete.go b/resource-manager/apimanagement/2021-08-01/apipolicy/method_delete.go new file mode 100644 index 00000000000..10b8c3c63c0 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apipolicy/method_delete.go @@ -0,0 +1,76 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiPolicyClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/apipolicy/method_delete_autorest.go deleted file mode 100644 index 010fbd8de58..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apipolicy/method_delete_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package apipolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiPolicyClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiPolicyClient) preparerForDelete(ctx context.Context, id ApiId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiPolicyClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/method_get.go b/resource-manager/apimanagement/2021-08-01/apipolicy/method_get.go new file mode 100644 index 00000000000..aaa7b1d2c78 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apipolicy/method_get.go @@ -0,0 +1,80 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c ApiPolicyClient) Get(ctx context.Context, id ApiId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apipolicy/method_get_autorest.go deleted file mode 100644 index 4003515afa2..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apipolicy/method_get_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apipolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type GetOperationOptions struct { - Format *PolicyExportFormat -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - return out -} - -// Get ... -func (c ApiPolicyClient) Get(ctx context.Context, id ApiId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiPolicyClient) preparerForGet(ctx context.Context, id ApiId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiPolicyClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/apipolicy/method_getentitytag.go new file mode 100644 index 00000000000..5ab255150b8 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apipolicy/method_getentitytag.go @@ -0,0 +1,47 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiPolicyClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/apipolicy/method_getentitytag_autorest.go deleted file mode 100644 index 522426b034b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apipolicy/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package apipolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiPolicyClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiPolicyClient) preparerForGetEntityTag(ctx context.Context, id ApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiPolicyClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/method_listbyapi.go b/resource-manager/apimanagement/2021-08-01/apipolicy/method_listbyapi.go new file mode 100644 index 00000000000..5afb8149c87 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apipolicy/method_listbyapi.go @@ -0,0 +1,52 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByApi ... +func (c ApiPolicyClient) ListByApi(ctx context.Context, id ApiId) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/method_listbyapi_autorest.go b/resource-manager/apimanagement/2021-08-01/apipolicy/method_listbyapi_autorest.go deleted file mode 100644 index 3c5cfc6d95f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apipolicy/method_listbyapi_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package apipolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByApiOperationResponse struct { - HttpResponse *http.Response - Model *PolicyCollection -} - -// ListByApi ... -func (c ApiPolicyClient) ListByApi(ctx context.Context, id ApiId) (result ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApi(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "ListByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "ListByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "ListByApi", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByApi prepares the ListByApi request. -func (c ApiPolicyClient) preparerForListByApi(ctx context.Context, id ApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByApi handles the response to the ListByApi request. The method always -// closes the http.Response Body. -func (c ApiPolicyClient) responderForListByApi(resp *http.Response) (result ListByApiOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiproduct/client.go b/resource-manager/apimanagement/2021-08-01/apiproduct/client.go index 4c35dacbaa3..d310375dc14 100644 --- a/resource-manager/apimanagement/2021-08-01/apiproduct/client.go +++ b/resource-manager/apimanagement/2021-08-01/apiproduct/client.go @@ -1,18 +1,26 @@ package apiproduct -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiProductClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiProductClientWithBaseURI(endpoint string) ApiProductClient { - return ApiProductClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiProductClientWithBaseURI(api sdkEnv.Api) (*ApiProductClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiproduct", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiProductClient: %+v", err) } + + return &ApiProductClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apiproduct/constants.go b/resource-manager/apimanagement/2021-08-01/apiproduct/constants.go index f0fb051f3c2..12fdc8dd3d6 100644 --- a/resource-manager/apimanagement/2021-08-01/apiproduct/constants.go +++ b/resource-manager/apimanagement/2021-08-01/apiproduct/constants.go @@ -1,6 +1,10 @@ package apiproduct -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, diff --git a/resource-manager/apimanagement/2021-08-01/apiproduct/method_listbyapis.go b/resource-manager/apimanagement/2021-08-01/apiproduct/method_listbyapis.go new file mode 100644 index 00000000000..2acd3899dfb --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiproduct/method_listbyapis.go @@ -0,0 +1,125 @@ +package apiproduct + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApisOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ProductContract +} + +type ListByApisCompleteResult struct { + Items []ProductContract +} + +type ListByApisOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByApisOperationOptions() ListByApisOperationOptions { + return ListByApisOperationOptions{} +} + +func (o ListByApisOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByApisOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByApisOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByApis ... +func (c ApiProductClient) ListByApis(ctx context.Context, id ApiId, options ListByApisOperationOptions) (result ListByApisOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/products", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ProductContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByApisComplete retrieves all the results into a single object +func (c ApiProductClient) ListByApisComplete(ctx context.Context, id ApiId, options ListByApisOperationOptions) (ListByApisCompleteResult, error) { + return c.ListByApisCompleteMatchingPredicate(ctx, id, options, ProductContractOperationPredicate{}) +} + +// ListByApisCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiProductClient) ListByApisCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApisOperationOptions, predicate ProductContractOperationPredicate) (result ListByApisCompleteResult, err error) { + items := make([]ProductContract, 0) + + resp, err := c.ListByApis(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByApisCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiproduct/method_listbyapis_autorest.go b/resource-manager/apimanagement/2021-08-01/apiproduct/method_listbyapis_autorest.go deleted file mode 100644 index 3ef1fe2b276..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiproduct/method_listbyapis_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apiproduct - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByApisOperationResponse struct { - HttpResponse *http.Response - Model *[]ProductContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByApisOperationResponse, error) -} - -type ListByApisCompleteResult struct { - Items []ProductContract -} - -func (r ListByApisOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByApisOperationResponse) LoadMore(ctx context.Context) (resp ListByApisOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByApisOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByApisOperationOptions() ListByApisOperationOptions { - return ListByApisOperationOptions{} -} - -func (o ListByApisOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByApisOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByApis ... -func (c ApiProductClient) ListByApis(ctx context.Context, id ApiId, options ListByApisOperationOptions) (resp ListByApisOperationResponse, err error) { - req, err := c.preparerForListByApis(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByApis(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByApis prepares the ListByApis request. -func (c ApiProductClient) preparerForListByApis(ctx context.Context, id ApiId, options ListByApisOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/products", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByApisWithNextLink prepares the ListByApis request with the given nextLink token. -func (c ApiProductClient) preparerForListByApisWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByApis handles the response to the ListByApis request. The method always -// closes the http.Response Body. -func (c ApiProductClient) responderForListByApis(resp *http.Response) (result ListByApisOperationResponse, err error) { - type page struct { - Values []ProductContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByApisOperationResponse, err error) { - req, err := c.preparerForListByApisWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByApis(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByApisComplete retrieves all of the results into a single object -func (c ApiProductClient) ListByApisComplete(ctx context.Context, id ApiId, options ListByApisOperationOptions) (ListByApisCompleteResult, error) { - return c.ListByApisCompleteMatchingPredicate(ctx, id, options, ProductContractOperationPredicate{}) -} - -// ListByApisCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiProductClient) ListByApisCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApisOperationOptions, predicate ProductContractOperationPredicate) (resp ListByApisCompleteResult, err error) { - items := make([]ProductContract, 0) - - page, err := c.ListByApis(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByApisCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/client.go b/resource-manager/apimanagement/2021-08-01/apirelease/client.go index 7daeaa5351d..0668c7977a7 100644 --- a/resource-manager/apimanagement/2021-08-01/apirelease/client.go +++ b/resource-manager/apimanagement/2021-08-01/apirelease/client.go @@ -1,18 +1,26 @@ package apirelease -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiReleaseClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiReleaseClientWithBaseURI(endpoint string) ApiReleaseClient { - return ApiReleaseClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiReleaseClientWithBaseURI(api sdkEnv.Api) (*ApiReleaseClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apirelease", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiReleaseClient: %+v", err) } + + return &ApiReleaseClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_createorupdate.go new file mode 100644 index 00000000000..406976fb2f8 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apirelease/method_createorupdate.go @@ -0,0 +1,85 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiReleaseContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiReleaseClient) CreateOrUpdate(ctx context.Context, id ReleaseId, input ApiReleaseContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_createorupdate_autorest.go deleted file mode 100644 index a9bb0d861fe..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apirelease/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apirelease - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiReleaseContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiReleaseClient) CreateOrUpdate(ctx context.Context, id ReleaseId, input ApiReleaseContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiReleaseClient) preparerForCreateOrUpdate(ctx context.Context, id ReleaseId, input ApiReleaseContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_delete.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_delete.go new file mode 100644 index 00000000000..cdfaf120b2b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apirelease/method_delete.go @@ -0,0 +1,76 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiReleaseClient) Delete(ctx context.Context, id ReleaseId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_delete_autorest.go deleted file mode 100644 index d5290cd9c81..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apirelease/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apirelease - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiReleaseClient) Delete(ctx context.Context, id ReleaseId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiReleaseClient) preparerForDelete(ctx context.Context, id ReleaseId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_get.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_get.go new file mode 100644 index 00000000000..afe7107ae45 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apirelease/method_get.go @@ -0,0 +1,51 @@ +package apirelease + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiReleaseContract +} + +// Get ... +func (c ApiReleaseClient) Get(ctx context.Context, id ReleaseId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_get_autorest.go deleted file mode 100644 index 6b5b8bbd11a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apirelease/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apirelease - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ApiReleaseContract -} - -// Get ... -func (c ApiReleaseClient) Get(ctx context.Context, id ReleaseId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiReleaseClient) preparerForGet(ctx context.Context, id ReleaseId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_getentitytag.go new file mode 100644 index 00000000000..97a2ff54ef1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apirelease/method_getentitytag.go @@ -0,0 +1,46 @@ +package apirelease + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiReleaseClient) GetEntityTag(ctx context.Context, id ReleaseId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_getentitytag_autorest.go deleted file mode 100644 index 67f795accdb..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apirelease/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apirelease - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiReleaseClient) GetEntityTag(ctx context.Context, id ReleaseId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiReleaseClient) preparerForGetEntityTag(ctx context.Context, id ReleaseId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_listbyservice.go new file mode 100644 index 00000000000..ffb1a5e65b4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apirelease/method_listbyservice.go @@ -0,0 +1,125 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiReleaseContract +} + +type ListByServiceCompleteResult struct { + Items []ApiReleaseContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiReleaseClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/releases", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiReleaseContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiReleaseClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiReleaseContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiReleaseClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate ApiReleaseContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiReleaseContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_listbyservice_autorest.go deleted file mode 100644 index a503853e31a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apirelease/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apirelease - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiReleaseContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ApiReleaseContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiReleaseClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiReleaseClient) preparerForListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/releases", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiReleaseClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ApiReleaseContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiReleaseClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiReleaseContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiReleaseClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate ApiReleaseContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ApiReleaseContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_update.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_update.go new file mode 100644 index 00000000000..23af82628f6 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apirelease/method_update.go @@ -0,0 +1,84 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiReleaseContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiReleaseClient) Update(ctx context.Context, id ReleaseId, input ApiReleaseContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/apirelease/method_update_autorest.go deleted file mode 100644 index b94e10e254e..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apirelease/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apirelease - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiReleaseContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiReleaseClient) Update(ctx context.Context, id ReleaseId, input ApiReleaseContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiReleaseClient) preparerForUpdate(ctx context.Context, id ReleaseId, input ApiReleaseContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apirevision/client.go b/resource-manager/apimanagement/2021-08-01/apirevision/client.go index 4f27298efa9..05dd34cbd51 100644 --- a/resource-manager/apimanagement/2021-08-01/apirevision/client.go +++ b/resource-manager/apimanagement/2021-08-01/apirevision/client.go @@ -1,18 +1,26 @@ package apirevision -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiRevisionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiRevisionClientWithBaseURI(endpoint string) ApiRevisionClient { - return ApiRevisionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiRevisionClientWithBaseURI(api sdkEnv.Api) (*ApiRevisionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apirevision", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiRevisionClient: %+v", err) } + + return &ApiRevisionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apirevision/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/apirevision/method_listbyservice.go new file mode 100644 index 00000000000..ddc821890de --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apirevision/method_listbyservice.go @@ -0,0 +1,125 @@ +package apirevision + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiRevisionContract +} + +type ListByServiceCompleteResult struct { + Items []ApiRevisionContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiRevisionClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/revisions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiRevisionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiRevisionClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiRevisionContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiRevisionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate ApiRevisionContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiRevisionContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apirevision/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/apirevision/method_listbyservice_autorest.go deleted file mode 100644 index 02f5fa345c9..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apirevision/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apirevision - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiRevisionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ApiRevisionContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiRevisionClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiRevisionClient) preparerForListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/revisions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiRevisionClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiRevisionClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ApiRevisionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiRevisionClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiRevisionContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiRevisionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate ApiRevisionContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ApiRevisionContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apisbytag/client.go b/resource-manager/apimanagement/2021-08-01/apisbytag/client.go index 300fac77149..2d2e8ef8c92 100644 --- a/resource-manager/apimanagement/2021-08-01/apisbytag/client.go +++ b/resource-manager/apimanagement/2021-08-01/apisbytag/client.go @@ -1,18 +1,26 @@ package apisbytag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApisByTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApisByTagClientWithBaseURI(endpoint string) ApisByTagClient { - return ApisByTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApisByTagClientWithBaseURI(api sdkEnv.Api) (*ApisByTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apisbytag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApisByTagClient: %+v", err) } + + return &ApisByTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apisbytag/constants.go b/resource-manager/apimanagement/2021-08-01/apisbytag/constants.go index 6f6b4ccc0c1..66e070901d4 100644 --- a/resource-manager/apimanagement/2021-08-01/apisbytag/constants.go +++ b/resource-manager/apimanagement/2021-08-01/apisbytag/constants.go @@ -1,6 +1,10 @@ package apisbytag -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -81,6 +111,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, @@ -113,6 +156,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, diff --git a/resource-manager/apimanagement/2021-08-01/apisbytag/method_apilistbytags.go b/resource-manager/apimanagement/2021-08-01/apisbytag/method_apilistbytags.go new file mode 100644 index 00000000000..80debd8f476 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apisbytag/method_apilistbytags.go @@ -0,0 +1,129 @@ +package apisbytag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiListByTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagResourceContract +} + +type ApiListByTagsCompleteResult struct { + Items []TagResourceContract +} + +type ApiListByTagsOperationOptions struct { + Filter *string + IncludeNotTaggedApis *bool + Skip *int64 + Top *int64 +} + +func DefaultApiListByTagsOperationOptions() ApiListByTagsOperationOptions { + return ApiListByTagsOperationOptions{} +} + +func (o ApiListByTagsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ApiListByTagsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ApiListByTagsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IncludeNotTaggedApis != nil { + out.Append("includeNotTaggedApis", fmt.Sprintf("%v", *o.IncludeNotTaggedApis)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ApiListByTags ... +func (c ApisByTagClient) ApiListByTags(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions) (result ApiListByTagsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apisByTags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagResourceContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ApiListByTagsComplete retrieves all the results into a single object +func (c ApisByTagClient) ApiListByTagsComplete(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions) (ApiListByTagsCompleteResult, error) { + return c.ApiListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) +} + +// ApiListByTagsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApisByTagClient) ApiListByTagsCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (result ApiListByTagsCompleteResult, err error) { + items := make([]TagResourceContract, 0) + + resp, err := c.ApiListByTags(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ApiListByTagsCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apisbytag/method_apilistbytags_autorest.go b/resource-manager/apimanagement/2021-08-01/apisbytag/method_apilistbytags_autorest.go deleted file mode 100644 index 5cb4c9a2e49..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apisbytag/method_apilistbytags_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package apisbytag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ApiListByTagsOperationResponse struct { - HttpResponse *http.Response - Model *[]TagResourceContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ApiListByTagsOperationResponse, error) -} - -type ApiListByTagsCompleteResult struct { - Items []TagResourceContract -} - -func (r ApiListByTagsOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ApiListByTagsOperationResponse) LoadMore(ctx context.Context) (resp ApiListByTagsOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ApiListByTagsOperationOptions struct { - Filter *string - IncludeNotTaggedApis *bool - Skip *int64 - Top *int64 -} - -func DefaultApiListByTagsOperationOptions() ApiListByTagsOperationOptions { - return ApiListByTagsOperationOptions{} -} - -func (o ApiListByTagsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ApiListByTagsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.IncludeNotTaggedApis != nil { - out["includeNotTaggedApis"] = *o.IncludeNotTaggedApis - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ApiListByTags ... -func (c ApisByTagClient) ApiListByTags(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions) (resp ApiListByTagsOperationResponse, err error) { - req, err := c.preparerForApiListByTags(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForApiListByTags(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForApiListByTags prepares the ApiListByTags request. -func (c ApisByTagClient) preparerForApiListByTags(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/apisByTags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForApiListByTagsWithNextLink prepares the ApiListByTags request with the given nextLink token. -func (c ApisByTagClient) preparerForApiListByTagsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForApiListByTags handles the response to the ApiListByTags request. The method always -// closes the http.Response Body. -func (c ApisByTagClient) responderForApiListByTags(resp *http.Response) (result ApiListByTagsOperationResponse, err error) { - type page struct { - Values []TagResourceContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ApiListByTagsOperationResponse, err error) { - req, err := c.preparerForApiListByTagsWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForApiListByTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ApiListByTagsComplete retrieves all of the results into a single object -func (c ApisByTagClient) ApiListByTagsComplete(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions) (ApiListByTagsCompleteResult, error) { - return c.ApiListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) -} - -// ApiListByTagsCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApisByTagClient) ApiListByTagsCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (resp ApiListByTagsCompleteResult, err error) { - items := make([]TagResourceContract, 0) - - page, err := c.ApiListByTags(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ApiListByTagsCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apischema/client.go b/resource-manager/apimanagement/2021-08-01/apischema/client.go index 1b7ddf09061..52fd9830109 100644 --- a/resource-manager/apimanagement/2021-08-01/apischema/client.go +++ b/resource-manager/apimanagement/2021-08-01/apischema/client.go @@ -1,18 +1,26 @@ package apischema -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiSchemaClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiSchemaClientWithBaseURI(endpoint string) ApiSchemaClient { - return ApiSchemaClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiSchemaClientWithBaseURI(api sdkEnv.Api) (*ApiSchemaClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apischema", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiSchemaClient: %+v", err) } + + return &ApiSchemaClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apischema/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apischema/method_createorupdate.go new file mode 100644 index 00000000000..ee50a77ff43 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apischema/method_createorupdate.go @@ -0,0 +1,103 @@ +package apischema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiSchemaClient) CreateOrUpdate(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ApiSchemaClient) CreateOrUpdateThenPoll(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/apischema/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apischema/method_createorupdate_autorest.go deleted file mode 100644 index b66a431a79b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apischema/method_createorupdate_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package apischema - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiSchemaClient) CreateOrUpdate(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ApiSchemaClient) CreateOrUpdateThenPoll(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiSchemaClient) preparerForCreateOrUpdate(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c ApiSchemaClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apischema/method_delete.go b/resource-manager/apimanagement/2021-08-01/apischema/method_delete.go new file mode 100644 index 00000000000..6fab6914573 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apischema/method_delete.go @@ -0,0 +1,79 @@ +package apischema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + Force *bool + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c ApiSchemaClient) Delete(ctx context.Context, id ApiSchemaId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apischema/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/apischema/method_delete_autorest.go deleted file mode 100644 index 861123ba5f1..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apischema/method_delete_autorest.go +++ /dev/null @@ -1,100 +0,0 @@ -package apischema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - Force *bool - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Force != nil { - out["force"] = *o.Force - } - - return out -} - -// Delete ... -func (c ApiSchemaClient) Delete(ctx context.Context, id ApiSchemaId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiSchemaClient) preparerForDelete(ctx context.Context, id ApiSchemaId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiSchemaClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apischema/method_get.go b/resource-manager/apimanagement/2021-08-01/apischema/method_get.go new file mode 100644 index 00000000000..544b5401b16 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apischema/method_get.go @@ -0,0 +1,51 @@ +package apischema + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SchemaContract +} + +// Get ... +func (c ApiSchemaClient) Get(ctx context.Context, id ApiSchemaId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apischema/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apischema/method_get_autorest.go deleted file mode 100644 index a2f6ed627d0..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apischema/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apischema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *SchemaContract -} - -// Get ... -func (c ApiSchemaClient) Get(ctx context.Context, id ApiSchemaId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiSchemaClient) preparerForGet(ctx context.Context, id ApiSchemaId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiSchemaClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apischema/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/apischema/method_getentitytag.go new file mode 100644 index 00000000000..06aa5ede3ba --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apischema/method_getentitytag.go @@ -0,0 +1,46 @@ +package apischema + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiSchemaClient) GetEntityTag(ctx context.Context, id ApiSchemaId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apischema/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/apischema/method_getentitytag_autorest.go deleted file mode 100644 index fc901aa3419..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apischema/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apischema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiSchemaClient) GetEntityTag(ctx context.Context, id ApiSchemaId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiSchemaClient) preparerForGetEntityTag(ctx context.Context, id ApiSchemaId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiSchemaClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apischema/method_listbyapi.go b/resource-manager/apimanagement/2021-08-01/apischema/method_listbyapi.go new file mode 100644 index 00000000000..8486736bbe2 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apischema/method_listbyapi.go @@ -0,0 +1,125 @@ +package apischema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SchemaContract +} + +type ListByApiCompleteResult struct { + Items []SchemaContract +} + +type ListByApiOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByApiOperationOptions() ListByApiOperationOptions { + return ListByApiOperationOptions{} +} + +func (o ListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByApi ... +func (c ApiSchemaClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/schemas", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SchemaContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByApiComplete retrieves all the results into a single object +func (c ApiSchemaClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { + return c.ListByApiCompleteMatchingPredicate(ctx, id, options, SchemaContractOperationPredicate{}) +} + +// ListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiSchemaClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate SchemaContractOperationPredicate) (result ListByApiCompleteResult, err error) { + items := make([]SchemaContract, 0) + + resp, err := c.ListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apischema/method_listbyapi_autorest.go b/resource-manager/apimanagement/2021-08-01/apischema/method_listbyapi_autorest.go deleted file mode 100644 index c29a0ea33a5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apischema/method_listbyapi_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apischema - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByApiOperationResponse struct { - HttpResponse *http.Response - Model *[]SchemaContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByApiOperationResponse, error) -} - -type ListByApiCompleteResult struct { - Items []SchemaContract -} - -func (r ListByApiOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByApiOperationResponse) LoadMore(ctx context.Context) (resp ListByApiOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByApiOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByApiOperationOptions() ListByApiOperationOptions { - return ListByApiOperationOptions{} -} - -func (o ListByApiOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByApiOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByApi ... -func (c ApiSchemaClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (resp ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApi(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByApi(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByApi prepares the ListByApi request. -func (c ApiSchemaClient) preparerForListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/schemas", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByApiWithNextLink prepares the ListByApi request with the given nextLink token. -func (c ApiSchemaClient) preparerForListByApiWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByApi handles the response to the ListByApi request. The method always -// closes the http.Response Body. -func (c ApiSchemaClient) responderForListByApi(resp *http.Response) (result ListByApiOperationResponse, err error) { - type page struct { - Values []SchemaContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApiWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByApiComplete retrieves all of the results into a single object -func (c ApiSchemaClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { - return c.ListByApiCompleteMatchingPredicate(ctx, id, options, SchemaContractOperationPredicate{}) -} - -// ListByApiCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiSchemaClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate SchemaContractOperationPredicate) (resp ListByApiCompleteResult, err error) { - items := make([]SchemaContract, 0) - - page, err := c.ListByApi(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByApiCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apitag/client.go b/resource-manager/apimanagement/2021-08-01/apitag/client.go index 6224a081278..1eeb741c8a0 100644 --- a/resource-manager/apimanagement/2021-08-01/apitag/client.go +++ b/resource-manager/apimanagement/2021-08-01/apitag/client.go @@ -1,18 +1,26 @@ package apitag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiTagClientWithBaseURI(endpoint string) ApiTagClient { - return ApiTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiTagClientWithBaseURI(api sdkEnv.Api) (*ApiTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apitag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiTagClient: %+v", err) } + + return &ApiTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apitag/method_tagassigntoapi.go b/resource-manager/apimanagement/2021-08-01/apitag/method_tagassigntoapi.go new file mode 100644 index 00000000000..96c964a74bd --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apitag/method_tagassigntoapi.go @@ -0,0 +1,52 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagAssignToApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagAssignToApi ... +func (c ApiTagClient) TagAssignToApi(ctx context.Context, id ApiTagId) (result TagAssignToApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apitag/method_tagassigntoapi_autorest.go b/resource-manager/apimanagement/2021-08-01/apitag/method_tagassigntoapi_autorest.go deleted file mode 100644 index e08a016a227..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apitag/method_tagassigntoapi_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apitag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagAssignToApiOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagAssignToApi ... -func (c ApiTagClient) TagAssignToApi(ctx context.Context, id ApiTagId) (result TagAssignToApiOperationResponse, err error) { - req, err := c.preparerForTagAssignToApi(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagAssignToApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagAssignToApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagAssignToApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagAssignToApi", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagAssignToApi prepares the TagAssignToApi request. -func (c ApiTagClient) preparerForTagAssignToApi(ctx context.Context, id ApiTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagAssignToApi handles the response to the TagAssignToApi request. The method always -// closes the http.Response Body. -func (c ApiTagClient) responderForTagAssignToApi(resp *http.Response) (result TagAssignToApiOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apitag/method_tagdetachfromapi.go b/resource-manager/apimanagement/2021-08-01/apitag/method_tagdetachfromapi.go new file mode 100644 index 00000000000..ad546cf7c3c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apitag/method_tagdetachfromapi.go @@ -0,0 +1,47 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDetachFromApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagDetachFromApi ... +func (c ApiTagClient) TagDetachFromApi(ctx context.Context, id ApiTagId) (result TagDetachFromApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apitag/method_tagdetachfromapi_autorest.go b/resource-manager/apimanagement/2021-08-01/apitag/method_tagdetachfromapi_autorest.go deleted file mode 100644 index e7ecb70287d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apitag/method_tagdetachfromapi_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apitag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagDetachFromApiOperationResponse struct { - HttpResponse *http.Response -} - -// TagDetachFromApi ... -func (c ApiTagClient) TagDetachFromApi(ctx context.Context, id ApiTagId) (result TagDetachFromApiOperationResponse, err error) { - req, err := c.preparerForTagDetachFromApi(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagDetachFromApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagDetachFromApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagDetachFromApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagDetachFromApi", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagDetachFromApi prepares the TagDetachFromApi request. -func (c ApiTagClient) preparerForTagDetachFromApi(ctx context.Context, id ApiTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagDetachFromApi handles the response to the TagDetachFromApi request. The method always -// closes the http.Response Body. -func (c ApiTagClient) responderForTagDetachFromApi(resp *http.Response) (result TagDetachFromApiOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apitag/method_taggetbyapi.go b/resource-manager/apimanagement/2021-08-01/apitag/method_taggetbyapi.go new file mode 100644 index 00000000000..97876d1178c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apitag/method_taggetbyapi.go @@ -0,0 +1,51 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagGetByApi ... +func (c ApiTagClient) TagGetByApi(ctx context.Context, id ApiTagId) (result TagGetByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apitag/method_taggetbyapi_autorest.go b/resource-manager/apimanagement/2021-08-01/apitag/method_taggetbyapi_autorest.go deleted file mode 100644 index cdc7b57c932..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apitag/method_taggetbyapi_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apitag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetByApiOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagGetByApi ... -func (c ApiTagClient) TagGetByApi(ctx context.Context, id ApiTagId) (result TagGetByApiOperationResponse, err error) { - req, err := c.preparerForTagGetByApi(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetByApi", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetByApi prepares the TagGetByApi request. -func (c ApiTagClient) preparerForTagGetByApi(ctx context.Context, id ApiTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetByApi handles the response to the TagGetByApi request. The method always -// closes the http.Response Body. -func (c ApiTagClient) responderForTagGetByApi(resp *http.Response) (result TagGetByApiOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apitag/method_taggetentitystatebyapi.go b/resource-manager/apimanagement/2021-08-01/apitag/method_taggetentitystatebyapi.go new file mode 100644 index 00000000000..eb833e96b2a --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apitag/method_taggetentitystatebyapi.go @@ -0,0 +1,46 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetEntityStateByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagGetEntityStateByApi ... +func (c ApiTagClient) TagGetEntityStateByApi(ctx context.Context, id ApiTagId) (result TagGetEntityStateByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apitag/method_taggetentitystatebyapi_autorest.go b/resource-manager/apimanagement/2021-08-01/apitag/method_taggetentitystatebyapi_autorest.go deleted file mode 100644 index f0c60a63c86..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apitag/method_taggetentitystatebyapi_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apitag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetEntityStateByApiOperationResponse struct { - HttpResponse *http.Response -} - -// TagGetEntityStateByApi ... -func (c ApiTagClient) TagGetEntityStateByApi(ctx context.Context, id ApiTagId) (result TagGetEntityStateByApiOperationResponse, err error) { - req, err := c.preparerForTagGetEntityStateByApi(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetEntityStateByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetEntityStateByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetEntityStateByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetEntityStateByApi", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetEntityStateByApi prepares the TagGetEntityStateByApi request. -func (c ApiTagClient) preparerForTagGetEntityStateByApi(ctx context.Context, id ApiTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetEntityStateByApi handles the response to the TagGetEntityStateByApi request. The method always -// closes the http.Response Body. -func (c ApiTagClient) responderForTagGetEntityStateByApi(resp *http.Response) (result TagGetEntityStateByApiOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apitag/method_taglistbyapi.go b/resource-manager/apimanagement/2021-08-01/apitag/method_taglistbyapi.go new file mode 100644 index 00000000000..9ab4d2bb22c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apitag/method_taglistbyapi.go @@ -0,0 +1,125 @@ +package apitag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type TagListByApiCompleteResult struct { + Items []TagContract +} + +type TagListByApiOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultTagListByApiOperationOptions() TagListByApiOperationOptions { + return TagListByApiOperationOptions{} +} + +func (o TagListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o TagListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o TagListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// TagListByApi ... +func (c ApiTagClient) TagListByApi(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (result TagListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// TagListByApiComplete retrieves all the results into a single object +func (c ApiTagClient) TagListByApiComplete(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (TagListByApiCompleteResult, error) { + return c.TagListByApiCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// TagListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiTagClient) TagListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options TagListByApiOperationOptions, predicate TagContractOperationPredicate) (result TagListByApiCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.TagListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = TagListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apitag/method_taglistbyapi_autorest.go b/resource-manager/apimanagement/2021-08-01/apitag/method_taglistbyapi_autorest.go deleted file mode 100644 index 750fb144087..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apitag/method_taglistbyapi_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apitag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagListByApiOperationResponse struct { - HttpResponse *http.Response - Model *[]TagContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (TagListByApiOperationResponse, error) -} - -type TagListByApiCompleteResult struct { - Items []TagContract -} - -func (r TagListByApiOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r TagListByApiOperationResponse) LoadMore(ctx context.Context) (resp TagListByApiOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type TagListByApiOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultTagListByApiOperationOptions() TagListByApiOperationOptions { - return TagListByApiOperationOptions{} -} - -func (o TagListByApiOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o TagListByApiOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// TagListByApi ... -func (c ApiTagClient) TagListByApi(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (resp TagListByApiOperationResponse, err error) { - req, err := c.preparerForTagListByApi(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForTagListByApi(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForTagListByApi prepares the TagListByApi request. -func (c ApiTagClient) preparerForTagListByApi(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForTagListByApiWithNextLink prepares the TagListByApi request with the given nextLink token. -func (c ApiTagClient) preparerForTagListByApiWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagListByApi handles the response to the TagListByApi request. The method always -// closes the http.Response Body. -func (c ApiTagClient) responderForTagListByApi(resp *http.Response) (result TagListByApiOperationResponse, err error) { - type page struct { - Values []TagContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result TagListByApiOperationResponse, err error) { - req, err := c.preparerForTagListByApiWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagListByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// TagListByApiComplete retrieves all of the results into a single object -func (c ApiTagClient) TagListByApiComplete(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (TagListByApiCompleteResult, error) { - return c.TagListByApiCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) -} - -// TagListByApiCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiTagClient) TagListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options TagListByApiOperationOptions, predicate TagContractOperationPredicate) (resp TagListByApiCompleteResult, err error) { - items := make([]TagContract, 0) - - page, err := c.TagListByApi(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := TagListByApiCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/client.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/client.go index e11c12678bb..d56da7fd44f 100644 --- a/resource-manager/apimanagement/2021-08-01/apitagdescription/client.go +++ b/resource-manager/apimanagement/2021-08-01/apitagdescription/client.go @@ -1,18 +1,26 @@ package apitagdescription -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiTagDescriptionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiTagDescriptionClientWithBaseURI(endpoint string) ApiTagDescriptionClient { - return ApiTagDescriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiTagDescriptionClientWithBaseURI(api sdkEnv.Api) (*ApiTagDescriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apitagdescription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiTagDescriptionClient: %+v", err) } + + return &ApiTagDescriptionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_createorupdate.go new file mode 100644 index 00000000000..08f839f5fe5 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_createorupdate.go @@ -0,0 +1,85 @@ +package apitagdescription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagDescriptionContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiTagDescriptionClient) CreateOrUpdate(ctx context.Context, id TagDescriptionId, input TagDescriptionCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_createorupdate_autorest.go deleted file mode 100644 index 876ae7520b3..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apitagdescription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *TagDescriptionContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiTagDescriptionClient) CreateOrUpdate(ctx context.Context, id TagDescriptionId, input TagDescriptionCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiTagDescriptionClient) preparerForCreateOrUpdate(ctx context.Context, id TagDescriptionId, input TagDescriptionCreateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiTagDescriptionClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_delete.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_delete.go new file mode 100644 index 00000000000..bc50e1495af --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_delete.go @@ -0,0 +1,76 @@ +package apitagdescription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiTagDescriptionClient) Delete(ctx context.Context, id TagDescriptionId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_delete_autorest.go deleted file mode 100644 index a383875ca12..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apitagdescription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiTagDescriptionClient) Delete(ctx context.Context, id TagDescriptionId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiTagDescriptionClient) preparerForDelete(ctx context.Context, id TagDescriptionId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiTagDescriptionClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_get.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_get.go new file mode 100644 index 00000000000..b4eb50d639b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_get.go @@ -0,0 +1,51 @@ +package apitagdescription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagDescriptionContract +} + +// Get ... +func (c ApiTagDescriptionClient) Get(ctx context.Context, id TagDescriptionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_get_autorest.go deleted file mode 100644 index 062aee3683f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apitagdescription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *TagDescriptionContract -} - -// Get ... -func (c ApiTagDescriptionClient) Get(ctx context.Context, id TagDescriptionId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiTagDescriptionClient) preparerForGet(ctx context.Context, id TagDescriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiTagDescriptionClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_getentitytag.go new file mode 100644 index 00000000000..1db8e6e13d4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_getentitytag.go @@ -0,0 +1,46 @@ +package apitagdescription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiTagDescriptionClient) GetEntityTag(ctx context.Context, id TagDescriptionId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_getentitytag_autorest.go deleted file mode 100644 index f75e60f2cdd..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apitagdescription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiTagDescriptionClient) GetEntityTag(ctx context.Context, id TagDescriptionId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiTagDescriptionClient) preparerForGetEntityTag(ctx context.Context, id TagDescriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiTagDescriptionClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_listbyservice.go new file mode 100644 index 00000000000..ccc6ebbef03 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_listbyservice.go @@ -0,0 +1,125 @@ +package apitagdescription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagDescriptionContract +} + +type ListByServiceCompleteResult struct { + Items []TagDescriptionContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiTagDescriptionClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tagDescriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagDescriptionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiTagDescriptionClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagDescriptionContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiTagDescriptionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate TagDescriptionContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]TagDescriptionContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/method_listbyservice_autorest.go deleted file mode 100644 index d6970e826db..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apitagdescription/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apitagdescription - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]TagDescriptionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []TagDescriptionContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiTagDescriptionClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiTagDescriptionClient) preparerForListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tagDescriptions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiTagDescriptionClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiTagDescriptionClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []TagDescriptionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiTagDescriptionClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagDescriptionContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiTagDescriptionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate TagDescriptionContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]TagDescriptionContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/client.go b/resource-manager/apimanagement/2021-08-01/apiversionset/client.go index 7fbe4fc8a0f..0fa53af399e 100644 --- a/resource-manager/apimanagement/2021-08-01/apiversionset/client.go +++ b/resource-manager/apimanagement/2021-08-01/apiversionset/client.go @@ -1,18 +1,26 @@ package apiversionset -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiVersionSetClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiVersionSetClientWithBaseURI(endpoint string) ApiVersionSetClient { - return ApiVersionSetClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiVersionSetClientWithBaseURI(api sdkEnv.Api) (*ApiVersionSetClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiversionset", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiVersionSetClient: %+v", err) } + + return &ApiVersionSetClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/constants.go b/resource-manager/apimanagement/2021-08-01/apiversionset/constants.go index c13d5055144..4fb4d169fff 100644 --- a/resource-manager/apimanagement/2021-08-01/apiversionset/constants.go +++ b/resource-manager/apimanagement/2021-08-01/apiversionset/constants.go @@ -1,6 +1,10 @@ package apiversionset -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForVersioningScheme() []string { } } +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVersioningScheme(input string) (*VersioningScheme, error) { vals := map[string]VersioningScheme{ "header": VersioningSchemeHeader, diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/apiversionset/method_createorupdate.go new file mode 100644 index 00000000000..69f9d46f502 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiversionset/method_createorupdate.go @@ -0,0 +1,85 @@ +package apiversionset + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiVersionSetContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiVersionSetClient) CreateOrUpdate(ctx context.Context, id ApiVersionSetId, input ApiVersionSetContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/apiversionset/method_createorupdate_autorest.go deleted file mode 100644 index 5ec307cada5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiversionset/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiversionset - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiVersionSetContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiVersionSetClient) CreateOrUpdate(ctx context.Context, id ApiVersionSetId, input ApiVersionSetContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiVersionSetClient) preparerForCreateOrUpdate(ctx context.Context, id ApiVersionSetId, input ApiVersionSetContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiVersionSetClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/method_get.go b/resource-manager/apimanagement/2021-08-01/apiversionset/method_get.go new file mode 100644 index 00000000000..910c5a90631 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiversionset/method_get.go @@ -0,0 +1,51 @@ +package apiversionset + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiVersionSetContract +} + +// Get ... +func (c ApiVersionSetClient) Get(ctx context.Context, id ApiVersionSetId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/apiversionset/method_get_autorest.go deleted file mode 100644 index 51f2f6edc1b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiversionset/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apiversionset - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ApiVersionSetContract -} - -// Get ... -func (c ApiVersionSetClient) Get(ctx context.Context, id ApiVersionSetId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiVersionSetClient) preparerForGet(ctx context.Context, id ApiVersionSetId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiVersionSetClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/apiversionset/method_getentitytag.go new file mode 100644 index 00000000000..9f95f1e557c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiversionset/method_getentitytag.go @@ -0,0 +1,46 @@ +package apiversionset + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiVersionSetClient) GetEntityTag(ctx context.Context, id ApiVersionSetId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/apiversionset/method_getentitytag_autorest.go deleted file mode 100644 index a0997df5dc8..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiversionset/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apiversionset - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiVersionSetClient) GetEntityTag(ctx context.Context, id ApiVersionSetId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiVersionSetClient) preparerForGetEntityTag(ctx context.Context, id ApiVersionSetId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiVersionSetClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/apiversionset/method_listbyservice.go new file mode 100644 index 00000000000..c850c773f5e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiversionset/method_listbyservice.go @@ -0,0 +1,125 @@ +package apiversionset + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiVersionSetContract +} + +type ListByServiceCompleteResult struct { + Items []ApiVersionSetContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiVersionSetClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apiVersionSets", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiVersionSetContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiVersionSetClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiVersionSetContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiVersionSetClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ApiVersionSetContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiVersionSetContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/apiversionset/method_listbyservice_autorest.go deleted file mode 100644 index a724e716e3a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiversionset/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apiversionset - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiVersionSetContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ApiVersionSetContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiVersionSetClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiVersionSetClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/apiVersionSets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiVersionSetClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiVersionSetClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ApiVersionSetContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiVersionSetClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiVersionSetContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiVersionSetClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ApiVersionSetContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ApiVersionSetContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/method_update.go b/resource-manager/apimanagement/2021-08-01/apiversionset/method_update.go new file mode 100644 index 00000000000..a894808f20a --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiversionset/method_update.go @@ -0,0 +1,84 @@ +package apiversionset + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiVersionSetContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiVersionSetClient) Update(ctx context.Context, id ApiVersionSetId, input ApiVersionSetUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/apiversionset/method_update_autorest.go deleted file mode 100644 index c839759e328..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiversionset/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiversionset - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiVersionSetContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiVersionSetClient) Update(ctx context.Context, id ApiVersionSetId, input ApiVersionSetUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiVersionSetClient) preparerForUpdate(ctx context.Context, id ApiVersionSetId, input ApiVersionSetUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiVersionSetClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionsets/client.go b/resource-manager/apimanagement/2021-08-01/apiversionsets/client.go index d927796792e..c12c1f59a72 100644 --- a/resource-manager/apimanagement/2021-08-01/apiversionsets/client.go +++ b/resource-manager/apimanagement/2021-08-01/apiversionsets/client.go @@ -1,18 +1,26 @@ package apiversionsets -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiVersionSetsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiVersionSetsClientWithBaseURI(endpoint string) ApiVersionSetsClient { - return ApiVersionSetsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiVersionSetsClientWithBaseURI(api sdkEnv.Api) (*ApiVersionSetsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiversionsets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiVersionSetsClient: %+v", err) } + + return &ApiVersionSetsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/apiversionsets/method_apiversionsetdelete.go b/resource-manager/apimanagement/2021-08-01/apiversionsets/method_apiversionsetdelete.go new file mode 100644 index 00000000000..f50800347d8 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/apiversionsets/method_apiversionsetdelete.go @@ -0,0 +1,76 @@ +package apiversionsets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type ApiVersionSetDeleteOperationOptions struct { + IfMatch *string +} + +func DefaultApiVersionSetDeleteOperationOptions() ApiVersionSetDeleteOperationOptions { + return ApiVersionSetDeleteOperationOptions{} +} + +func (o ApiVersionSetDeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o ApiVersionSetDeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ApiVersionSetDeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// ApiVersionSetDelete ... +func (c ApiVersionSetsClient) ApiVersionSetDelete(ctx context.Context, id ApiVersionSetId, options ApiVersionSetDeleteOperationOptions) (result ApiVersionSetDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/apiversionsets/method_apiversionsetdelete_autorest.go b/resource-manager/apimanagement/2021-08-01/apiversionsets/method_apiversionsetdelete_autorest.go deleted file mode 100644 index 72a19648666..00000000000 --- a/resource-manager/apimanagement/2021-08-01/apiversionsets/method_apiversionsetdelete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apiversionsets - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ApiVersionSetDeleteOperationResponse struct { - HttpResponse *http.Response -} - -type ApiVersionSetDeleteOperationOptions struct { - IfMatch *string -} - -func DefaultApiVersionSetDeleteOperationOptions() ApiVersionSetDeleteOperationOptions { - return ApiVersionSetDeleteOperationOptions{} -} - -func (o ApiVersionSetDeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o ApiVersionSetDeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// ApiVersionSetDelete ... -func (c ApiVersionSetsClient) ApiVersionSetDelete(ctx context.Context, id ApiVersionSetId, options ApiVersionSetDeleteOperationOptions) (result ApiVersionSetDeleteOperationResponse, err error) { - req, err := c.preparerForApiVersionSetDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionsets.ApiVersionSetsClient", "ApiVersionSetDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionsets.ApiVersionSetsClient", "ApiVersionSetDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForApiVersionSetDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionsets.ApiVersionSetsClient", "ApiVersionSetDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForApiVersionSetDelete prepares the ApiVersionSetDelete request. -func (c ApiVersionSetsClient) preparerForApiVersionSetDelete(ctx context.Context, id ApiVersionSetId, options ApiVersionSetDeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForApiVersionSetDelete handles the response to the ApiVersionSetDelete request. The method always -// closes the http.Response Body. -func (c ApiVersionSetsClient) responderForApiVersionSetDelete(resp *http.Response) (result ApiVersionSetDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/client.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/client.go index a0b4979583f..7ce712f4744 100644 --- a/resource-manager/apimanagement/2021-08-01/authorizationserver/client.go +++ b/resource-manager/apimanagement/2021-08-01/authorizationserver/client.go @@ -1,18 +1,26 @@ package authorizationserver -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type AuthorizationServerClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAuthorizationServerClientWithBaseURI(endpoint string) AuthorizationServerClient { - return AuthorizationServerClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAuthorizationServerClientWithBaseURI(api sdkEnv.Api) (*AuthorizationServerClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "authorizationserver", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AuthorizationServerClient: %+v", err) } + + return &AuthorizationServerClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/constants.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/constants.go index e04f6ee15bd..135527703de 100644 --- a/resource-manager/apimanagement/2021-08-01/authorizationserver/constants.go +++ b/resource-manager/apimanagement/2021-08-01/authorizationserver/constants.go @@ -1,6 +1,10 @@ package authorizationserver -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -31,6 +35,19 @@ func PossibleValuesForAuthorizationMethod() []string { } } +func (s *AuthorizationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAuthorizationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAuthorizationMethod(input string) (*AuthorizationMethod, error) { vals := map[string]AuthorizationMethod{ "delete": AuthorizationMethodDELETE, @@ -65,6 +82,19 @@ func PossibleValuesForBearerTokenSendingMethod() []string { } } +func (s *BearerTokenSendingMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethod(input string) (*BearerTokenSendingMethod, error) { vals := map[string]BearerTokenSendingMethod{ "authorizationheader": BearerTokenSendingMethodAuthorizationHeader, @@ -93,6 +123,19 @@ func PossibleValuesForClientAuthenticationMethod() []string { } } +func (s *ClientAuthenticationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClientAuthenticationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseClientAuthenticationMethod(input string) (*ClientAuthenticationMethod, error) { vals := map[string]ClientAuthenticationMethod{ "basic": ClientAuthenticationMethodBasic, @@ -125,6 +168,19 @@ func PossibleValuesForGrantType() []string { } } +func (s *GrantType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGrantType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGrantType(input string) (*GrantType, error) { vals := map[string]GrantType{ "authorizationcode": GrantTypeAuthorizationCode, diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_createorupdate.go new file mode 100644 index 00000000000..9c56c38cce1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_createorupdate.go @@ -0,0 +1,85 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c AuthorizationServerClient) CreateOrUpdate(ctx context.Context, id AuthorizationServerId, input AuthorizationServerContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_createorupdate_autorest.go deleted file mode 100644 index 60a97c7646d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package authorizationserver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationServerContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c AuthorizationServerClient) CreateOrUpdate(ctx context.Context, id AuthorizationServerId, input AuthorizationServerContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c AuthorizationServerClient) preparerForCreateOrUpdate(ctx context.Context, id AuthorizationServerId, input AuthorizationServerContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_delete.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_delete.go new file mode 100644 index 00000000000..ad1674315f1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_delete.go @@ -0,0 +1,76 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c AuthorizationServerClient) Delete(ctx context.Context, id AuthorizationServerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_delete_autorest.go deleted file mode 100644 index d7cc9dff660..00000000000 --- a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package authorizationserver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c AuthorizationServerClient) Delete(ctx context.Context, id AuthorizationServerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c AuthorizationServerClient) preparerForDelete(ctx context.Context, id AuthorizationServerId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_get.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_get.go new file mode 100644 index 00000000000..35bc15341b9 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_get.go @@ -0,0 +1,51 @@ +package authorizationserver + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerContract +} + +// Get ... +func (c AuthorizationServerClient) Get(ctx context.Context, id AuthorizationServerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_get_autorest.go deleted file mode 100644 index 4f6ec3d9ba4..00000000000 --- a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package authorizationserver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationServerContract -} - -// Get ... -func (c AuthorizationServerClient) Get(ctx context.Context, id AuthorizationServerId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AuthorizationServerClient) preparerForGet(ctx context.Context, id AuthorizationServerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_getentitytag.go new file mode 100644 index 00000000000..4eb7f0abe34 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_getentitytag.go @@ -0,0 +1,46 @@ +package authorizationserver + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c AuthorizationServerClient) GetEntityTag(ctx context.Context, id AuthorizationServerId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_getentitytag_autorest.go deleted file mode 100644 index 6ca77e2c3d7..00000000000 --- a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package authorizationserver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c AuthorizationServerClient) GetEntityTag(ctx context.Context, id AuthorizationServerId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c AuthorizationServerClient) preparerForGetEntityTag(ctx context.Context, id AuthorizationServerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listbyservice.go new file mode 100644 index 00000000000..17a21580a93 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listbyservice.go @@ -0,0 +1,125 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AuthorizationServerContract +} + +type ListByServiceCompleteResult struct { + Items []AuthorizationServerContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c AuthorizationServerClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/authorizationServers", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AuthorizationServerContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c AuthorizationServerClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AuthorizationServerContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AuthorizationServerClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AuthorizationServerContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]AuthorizationServerContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listbyservice_autorest.go deleted file mode 100644 index 7d3c48d2ad9..00000000000 --- a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package authorizationserver - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]AuthorizationServerContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []AuthorizationServerContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c AuthorizationServerClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c AuthorizationServerClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/authorizationServers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c AuthorizationServerClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []AuthorizationServerContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c AuthorizationServerClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AuthorizationServerContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AuthorizationServerClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AuthorizationServerContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]AuthorizationServerContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listsecrets.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listsecrets.go new file mode 100644 index 00000000000..e65f9582795 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listsecrets.go @@ -0,0 +1,52 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerSecretsContract +} + +// ListSecrets ... +func (c AuthorizationServerClient) ListSecrets(ctx context.Context, id AuthorizationServerId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listsecrets_autorest.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listsecrets_autorest.go deleted file mode 100644 index 246b21f3eb2..00000000000 --- a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package authorizationserver - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationServerSecretsContract -} - -// ListSecrets ... -func (c AuthorizationServerClient) ListSecrets(ctx context.Context, id AuthorizationServerId) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c AuthorizationServerClient) preparerForListSecrets(ctx context.Context, id AuthorizationServerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_update.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_update.go new file mode 100644 index 00000000000..d92ea160b6f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_update.go @@ -0,0 +1,84 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c AuthorizationServerClient) Update(ctx context.Context, id AuthorizationServerId, input AuthorizationServerUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/method_update_autorest.go deleted file mode 100644 index 7bb82b54e5f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/authorizationserver/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package authorizationserver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationServerContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c AuthorizationServerClient) Update(ctx context.Context, id AuthorizationServerId, input AuthorizationServerUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c AuthorizationServerClient) preparerForUpdate(ctx context.Context, id AuthorizationServerId, input AuthorizationServerUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/backend/client.go b/resource-manager/apimanagement/2021-08-01/backend/client.go index 6bfb57d9510..28f6670b70d 100644 --- a/resource-manager/apimanagement/2021-08-01/backend/client.go +++ b/resource-manager/apimanagement/2021-08-01/backend/client.go @@ -1,18 +1,26 @@ package backend -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type BackendClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewBackendClientWithBaseURI(endpoint string) BackendClient { - return BackendClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewBackendClientWithBaseURI(api sdkEnv.Api) (*BackendClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "backend", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating BackendClient: %+v", err) } + + return &BackendClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/backend/constants.go b/resource-manager/apimanagement/2021-08-01/backend/constants.go index ea964ece6fb..fe71e64cb91 100644 --- a/resource-manager/apimanagement/2021-08-01/backend/constants.go +++ b/resource-manager/apimanagement/2021-08-01/backend/constants.go @@ -1,6 +1,10 @@ package backend -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForBackendProtocol() []string { } } +func (s *BackendProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBackendProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBackendProtocol(input string) (*BackendProtocol, error) { vals := map[string]BackendProtocol{ "http": BackendProtocolHTTP, diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/backend/method_createorupdate.go new file mode 100644 index 00000000000..c999d10c186 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/backend/method_createorupdate.go @@ -0,0 +1,85 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackendContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c BackendClient) CreateOrUpdate(ctx context.Context, id BackendId, input BackendContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/backend/method_createorupdate_autorest.go deleted file mode 100644 index 75dec17d56d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/backend/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package backend - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *BackendContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c BackendClient) CreateOrUpdate(ctx context.Context, id BackendId, input BackendContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c BackendClient) preparerForCreateOrUpdate(ctx context.Context, id BackendId, input BackendContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_delete.go b/resource-manager/apimanagement/2021-08-01/backend/method_delete.go new file mode 100644 index 00000000000..a8e6a5ab37b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/backend/method_delete.go @@ -0,0 +1,76 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c BackendClient) Delete(ctx context.Context, id BackendId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/backend/method_delete_autorest.go deleted file mode 100644 index c1c6dc95ec7..00000000000 --- a/resource-manager/apimanagement/2021-08-01/backend/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package backend - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c BackendClient) Delete(ctx context.Context, id BackendId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c BackendClient) preparerForDelete(ctx context.Context, id BackendId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_get.go b/resource-manager/apimanagement/2021-08-01/backend/method_get.go new file mode 100644 index 00000000000..2af01eaec6f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/backend/method_get.go @@ -0,0 +1,51 @@ +package backend + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackendContract +} + +// Get ... +func (c BackendClient) Get(ctx context.Context, id BackendId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/backend/method_get_autorest.go deleted file mode 100644 index ad57ec2ac1f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/backend/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package backend - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *BackendContract -} - -// Get ... -func (c BackendClient) Get(ctx context.Context, id BackendId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c BackendClient) preparerForGet(ctx context.Context, id BackendId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/backend/method_getentitytag.go new file mode 100644 index 00000000000..6bff18fa57d --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/backend/method_getentitytag.go @@ -0,0 +1,46 @@ +package backend + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c BackendClient) GetEntityTag(ctx context.Context, id BackendId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/backend/method_getentitytag_autorest.go deleted file mode 100644 index 9d500b6b320..00000000000 --- a/resource-manager/apimanagement/2021-08-01/backend/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package backend - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c BackendClient) GetEntityTag(ctx context.Context, id BackendId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c BackendClient) preparerForGetEntityTag(ctx context.Context, id BackendId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/backend/method_listbyservice.go new file mode 100644 index 00000000000..1c0cb8aab20 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/backend/method_listbyservice.go @@ -0,0 +1,125 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]BackendContract +} + +type ListByServiceCompleteResult struct { + Items []BackendContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c BackendClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/backends", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]BackendContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c BackendClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, BackendContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c BackendClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate BackendContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]BackendContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/backend/method_listbyservice_autorest.go deleted file mode 100644 index d2c7a50b168..00000000000 --- a/resource-manager/apimanagement/2021-08-01/backend/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package backend - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]BackendContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []BackendContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c BackendClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c BackendClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/backends", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c BackendClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []BackendContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c BackendClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, BackendContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c BackendClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate BackendContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]BackendContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_update.go b/resource-manager/apimanagement/2021-08-01/backend/method_update.go new file mode 100644 index 00000000000..16ad3a5f0f9 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/backend/method_update.go @@ -0,0 +1,84 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackendContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c BackendClient) Update(ctx context.Context, id BackendId, input BackendUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/backend/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/backend/method_update_autorest.go deleted file mode 100644 index 072e94d0e27..00000000000 --- a/resource-manager/apimanagement/2021-08-01/backend/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package backend - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *BackendContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c BackendClient) Update(ctx context.Context, id BackendId, input BackendUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c BackendClient) preparerForUpdate(ctx context.Context, id BackendId, input BackendUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/backendreconnect/client.go b/resource-manager/apimanagement/2021-08-01/backendreconnect/client.go index f4fd38d283c..b7bfc874b41 100644 --- a/resource-manager/apimanagement/2021-08-01/backendreconnect/client.go +++ b/resource-manager/apimanagement/2021-08-01/backendreconnect/client.go @@ -1,18 +1,26 @@ package backendreconnect -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type BackendReconnectClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewBackendReconnectClientWithBaseURI(endpoint string) BackendReconnectClient { - return BackendReconnectClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewBackendReconnectClientWithBaseURI(api sdkEnv.Api) (*BackendReconnectClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "backendreconnect", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating BackendReconnectClient: %+v", err) } + + return &BackendReconnectClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/backendreconnect/method_backendreconnect.go b/resource-manager/apimanagement/2021-08-01/backendreconnect/method_backendreconnect.go new file mode 100644 index 00000000000..d75c5992fac --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/backendreconnect/method_backendreconnect.go @@ -0,0 +1,51 @@ +package backendreconnect + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendReconnectOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// BackendReconnect ... +func (c BackendReconnectClient) BackendReconnect(ctx context.Context, id BackendId, input BackendReconnectContract) (result BackendReconnectOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reconnect", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/backendreconnect/method_backendreconnect_autorest.go b/resource-manager/apimanagement/2021-08-01/backendreconnect/method_backendreconnect_autorest.go deleted file mode 100644 index ae533c15f31..00000000000 --- a/resource-manager/apimanagement/2021-08-01/backendreconnect/method_backendreconnect_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package backendreconnect - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BackendReconnectOperationResponse struct { - HttpResponse *http.Response -} - -// BackendReconnect ... -func (c BackendReconnectClient) BackendReconnect(ctx context.Context, id BackendId, input BackendReconnectContract) (result BackendReconnectOperationResponse, err error) { - req, err := c.preparerForBackendReconnect(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "backendreconnect.BackendReconnectClient", "BackendReconnect", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backendreconnect.BackendReconnectClient", "BackendReconnect", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForBackendReconnect(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backendreconnect.BackendReconnectClient", "BackendReconnect", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForBackendReconnect prepares the BackendReconnect request. -func (c BackendReconnectClient) preparerForBackendReconnect(ctx context.Context, id BackendId, input BackendReconnectContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/reconnect", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForBackendReconnect handles the response to the BackendReconnect request. The method always -// closes the http.Response Body. -func (c BackendReconnectClient) responderForBackendReconnect(resp *http.Response) (result BackendReconnectOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusAccepted), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/cache/client.go b/resource-manager/apimanagement/2021-08-01/cache/client.go index 1d9fa5007ce..204643d622f 100644 --- a/resource-manager/apimanagement/2021-08-01/cache/client.go +++ b/resource-manager/apimanagement/2021-08-01/cache/client.go @@ -1,18 +1,26 @@ package cache -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type CacheClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewCacheClientWithBaseURI(endpoint string) CacheClient { - return CacheClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewCacheClientWithBaseURI(api sdkEnv.Api) (*CacheClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "cache", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CacheClient: %+v", err) } + + return &CacheClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/cache/method_createorupdate.go new file mode 100644 index 00000000000..ae370ba6bb9 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/cache/method_createorupdate.go @@ -0,0 +1,85 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CacheContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c CacheClient) CreateOrUpdate(ctx context.Context, id CacheId, input CacheContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/cache/method_createorupdate_autorest.go deleted file mode 100644 index 157b734abcf..00000000000 --- a/resource-manager/apimanagement/2021-08-01/cache/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package cache - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *CacheContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c CacheClient) CreateOrUpdate(ctx context.Context, id CacheId, input CacheContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c CacheClient) preparerForCreateOrUpdate(ctx context.Context, id CacheId, input CacheContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_delete.go b/resource-manager/apimanagement/2021-08-01/cache/method_delete.go new file mode 100644 index 00000000000..4409902bb76 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/cache/method_delete.go @@ -0,0 +1,76 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c CacheClient) Delete(ctx context.Context, id CacheId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/cache/method_delete_autorest.go deleted file mode 100644 index d31981601b3..00000000000 --- a/resource-manager/apimanagement/2021-08-01/cache/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package cache - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c CacheClient) Delete(ctx context.Context, id CacheId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c CacheClient) preparerForDelete(ctx context.Context, id CacheId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_get.go b/resource-manager/apimanagement/2021-08-01/cache/method_get.go new file mode 100644 index 00000000000..8108214f781 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/cache/method_get.go @@ -0,0 +1,51 @@ +package cache + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CacheContract +} + +// Get ... +func (c CacheClient) Get(ctx context.Context, id CacheId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/cache/method_get_autorest.go deleted file mode 100644 index 3e001237bb8..00000000000 --- a/resource-manager/apimanagement/2021-08-01/cache/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package cache - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *CacheContract -} - -// Get ... -func (c CacheClient) Get(ctx context.Context, id CacheId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c CacheClient) preparerForGet(ctx context.Context, id CacheId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/cache/method_getentitytag.go new file mode 100644 index 00000000000..a221bde18d1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/cache/method_getentitytag.go @@ -0,0 +1,46 @@ +package cache + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c CacheClient) GetEntityTag(ctx context.Context, id CacheId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/cache/method_getentitytag_autorest.go deleted file mode 100644 index 5ac7d004001..00000000000 --- a/resource-manager/apimanagement/2021-08-01/cache/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package cache - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c CacheClient) GetEntityTag(ctx context.Context, id CacheId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c CacheClient) preparerForGetEntityTag(ctx context.Context, id CacheId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/cache/method_listbyservice.go new file mode 100644 index 00000000000..748d4374751 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/cache/method_listbyservice.go @@ -0,0 +1,121 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CacheContract +} + +type ListByServiceCompleteResult struct { + Items []CacheContract +} + +type ListByServiceOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c CacheClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/caches", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CacheContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c CacheClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, CacheContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CacheClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate CacheContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]CacheContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/cache/method_listbyservice_autorest.go deleted file mode 100644 index 0bf37f6599c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/cache/method_listbyservice_autorest.go +++ /dev/null @@ -1,220 +0,0 @@ -package cache - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]CacheContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []CacheContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c CacheClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c CacheClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/caches", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c CacheClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []CacheContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c CacheClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, CacheContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c CacheClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate CacheContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]CacheContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_update.go b/resource-manager/apimanagement/2021-08-01/cache/method_update.go new file mode 100644 index 00000000000..3aca9c35b36 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/cache/method_update.go @@ -0,0 +1,84 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CacheContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c CacheClient) Update(ctx context.Context, id CacheId, input CacheUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/cache/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/cache/method_update_autorest.go deleted file mode 100644 index 77f9a54c40b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/cache/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package cache - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *CacheContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c CacheClient) Update(ctx context.Context, id CacheId, input CacheUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c CacheClient) preparerForUpdate(ctx context.Context, id CacheId, input CacheUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/client.go b/resource-manager/apimanagement/2021-08-01/certificate/client.go index f304bfc665d..9caad657c9b 100644 --- a/resource-manager/apimanagement/2021-08-01/certificate/client.go +++ b/resource-manager/apimanagement/2021-08-01/certificate/client.go @@ -1,18 +1,26 @@ package certificate -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type CertificateClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewCertificateClientWithBaseURI(endpoint string) CertificateClient { - return CertificateClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewCertificateClientWithBaseURI(api sdkEnv.Api) (*CertificateClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "certificate", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CertificateClient: %+v", err) } + + return &CertificateClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/certificate/method_createorupdate.go new file mode 100644 index 00000000000..93fbccd7109 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/certificate/method_createorupdate.go @@ -0,0 +1,85 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CertificateContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c CertificateClient) CreateOrUpdate(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/certificate/method_createorupdate_autorest.go deleted file mode 100644 index 3f9fa70c148..00000000000 --- a/resource-manager/apimanagement/2021-08-01/certificate/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package certificate - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *CertificateContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c CertificateClient) CreateOrUpdate(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c CertificateClient) preparerForCreateOrUpdate(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_delete.go b/resource-manager/apimanagement/2021-08-01/certificate/method_delete.go new file mode 100644 index 00000000000..18be0e732de --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/certificate/method_delete.go @@ -0,0 +1,76 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c CertificateClient) Delete(ctx context.Context, id CertificateId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/certificate/method_delete_autorest.go deleted file mode 100644 index c5682ce3425..00000000000 --- a/resource-manager/apimanagement/2021-08-01/certificate/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package certificate - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c CertificateClient) Delete(ctx context.Context, id CertificateId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c CertificateClient) preparerForDelete(ctx context.Context, id CertificateId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_get.go b/resource-manager/apimanagement/2021-08-01/certificate/method_get.go new file mode 100644 index 00000000000..27e5fbafdfa --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/certificate/method_get.go @@ -0,0 +1,51 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CertificateContract +} + +// Get ... +func (c CertificateClient) Get(ctx context.Context, id CertificateId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/certificate/method_get_autorest.go deleted file mode 100644 index 9e737922fb6..00000000000 --- a/resource-manager/apimanagement/2021-08-01/certificate/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package certificate - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *CertificateContract -} - -// Get ... -func (c CertificateClient) Get(ctx context.Context, id CertificateId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c CertificateClient) preparerForGet(ctx context.Context, id CertificateId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/certificate/method_getentitytag.go new file mode 100644 index 00000000000..bcbd65b8f9b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/certificate/method_getentitytag.go @@ -0,0 +1,46 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c CertificateClient) GetEntityTag(ctx context.Context, id CertificateId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/certificate/method_getentitytag_autorest.go deleted file mode 100644 index 767706d23d9..00000000000 --- a/resource-manager/apimanagement/2021-08-01/certificate/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package certificate - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c CertificateClient) GetEntityTag(ctx context.Context, id CertificateId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c CertificateClient) preparerForGetEntityTag(ctx context.Context, id CertificateId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/certificate/method_listbyservice.go new file mode 100644 index 00000000000..cf5649185fc --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/certificate/method_listbyservice.go @@ -0,0 +1,129 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CertificateContract +} + +type ListByServiceCompleteResult struct { + Items []CertificateContract +} + +type ListByServiceOperationOptions struct { + Filter *string + IsKeyVaultRefreshFailed *bool + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IsKeyVaultRefreshFailed != nil { + out.Append("isKeyVaultRefreshFailed", fmt.Sprintf("%v", *o.IsKeyVaultRefreshFailed)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c CertificateClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/certificates", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CertificateContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c CertificateClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, CertificateContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CertificateClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate CertificateContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]CertificateContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/certificate/method_listbyservice_autorest.go deleted file mode 100644 index b7ec6fe5728..00000000000 --- a/resource-manager/apimanagement/2021-08-01/certificate/method_listbyservice_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package certificate - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]CertificateContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []CertificateContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - IsKeyVaultRefreshFailed *bool - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.IsKeyVaultRefreshFailed != nil { - out["isKeyVaultRefreshFailed"] = *o.IsKeyVaultRefreshFailed - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c CertificateClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c CertificateClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/certificates", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c CertificateClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []CertificateContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c CertificateClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, CertificateContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c CertificateClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate CertificateContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]CertificateContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_refreshsecret.go b/resource-manager/apimanagement/2021-08-01/certificate/method_refreshsecret.go new file mode 100644 index 00000000000..8c7aaf79162 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/certificate/method_refreshsecret.go @@ -0,0 +1,52 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RefreshSecretOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CertificateContract +} + +// RefreshSecret ... +func (c CertificateClient) RefreshSecret(ctx context.Context, id CertificateId) (result RefreshSecretOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/refreshSecret", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/certificate/method_refreshsecret_autorest.go b/resource-manager/apimanagement/2021-08-01/certificate/method_refreshsecret_autorest.go deleted file mode 100644 index 8202c39a9c5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/certificate/method_refreshsecret_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package certificate - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RefreshSecretOperationResponse struct { - HttpResponse *http.Response - Model *CertificateContract -} - -// RefreshSecret ... -func (c CertificateClient) RefreshSecret(ctx context.Context, id CertificateId) (result RefreshSecretOperationResponse, err error) { - req, err := c.preparerForRefreshSecret(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "RefreshSecret", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "RefreshSecret", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRefreshSecret(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "RefreshSecret", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRefreshSecret prepares the RefreshSecret request. -func (c CertificateClient) preparerForRefreshSecret(ctx context.Context, id CertificateId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/refreshSecret", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRefreshSecret handles the response to the RefreshSecret request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForRefreshSecret(resp *http.Response) (result RefreshSecretOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/client.go b/resource-manager/apimanagement/2021-08-01/client.go index 3128d58bf28..49fe67ed2a5 100644 --- a/resource-manager/apimanagement/2021-08-01/client.go +++ b/resource-manager/apimanagement/2021-08-01/client.go @@ -4,7 +4,8 @@ package v2021_08_01 // Licensed under the MIT License. See NOTICE.txt in the project root for license information. import ( - "github.com/Azure/go-autorest/autorest" + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/api" "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apidiagnostic" "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/apiissue" @@ -93,6 +94,8 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/users" "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/usersubscription" "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/usertoken" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -186,360 +189,623 @@ type Client struct { Users *users.UsersClient } -func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + apiClient, err := api.NewApiClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Api client: %+v", err) + } + configureFunc(apiClient.Client) - apiClient := api.NewApiClientWithBaseURI(endpoint) - configureAuthFunc(&apiClient.Client) + apiDiagnosticClient, err := apidiagnostic.NewApiDiagnosticClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiDiagnostic client: %+v", err) + } + configureFunc(apiDiagnosticClient.Client) - apiDiagnosticClient := apidiagnostic.NewApiDiagnosticClientWithBaseURI(endpoint) - configureAuthFunc(&apiDiagnosticClient.Client) + apiIssueAttachmentClient, err := apiissueattachment.NewApiIssueAttachmentClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiIssueAttachment client: %+v", err) + } + configureFunc(apiIssueAttachmentClient.Client) - apiIssueAttachmentClient := apiissueattachment.NewApiIssueAttachmentClientWithBaseURI(endpoint) - configureAuthFunc(&apiIssueAttachmentClient.Client) + apiIssueClient, err := apiissue.NewApiIssueClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiIssue client: %+v", err) + } + configureFunc(apiIssueClient.Client) - apiIssueClient := apiissue.NewApiIssueClientWithBaseURI(endpoint) - configureAuthFunc(&apiIssueClient.Client) + apiIssueCommentClient, err := apiissuecomment.NewApiIssueCommentClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiIssueComment client: %+v", err) + } + configureFunc(apiIssueCommentClient.Client) - apiIssueCommentClient := apiissuecomment.NewApiIssueCommentClientWithBaseURI(endpoint) - configureAuthFunc(&apiIssueCommentClient.Client) + apiManagementServiceClient, err := apimanagementservice.NewApiManagementServiceClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiManagementService client: %+v", err) + } + configureFunc(apiManagementServiceClient.Client) - apiManagementServiceClient := apimanagementservice.NewApiManagementServiceClientWithBaseURI(endpoint) - configureAuthFunc(&apiManagementServiceClient.Client) + apiManagementServiceSkusClient, err := apimanagementserviceskus.NewApiManagementServiceSkusClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiManagementServiceSkus client: %+v", err) + } + configureFunc(apiManagementServiceSkusClient.Client) + + apiOperationClient, err := apioperation.NewApiOperationClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiOperation client: %+v", err) + } + configureFunc(apiOperationClient.Client) - apiManagementServiceSkusClient := apimanagementserviceskus.NewApiManagementServiceSkusClientWithBaseURI(endpoint) - configureAuthFunc(&apiManagementServiceSkusClient.Client) + apiOperationPolicyClient, err := apioperationpolicy.NewApiOperationPolicyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiOperationPolicy client: %+v", err) + } + configureFunc(apiOperationPolicyClient.Client) + + apiOperationTagClient, err := apioperationtag.NewApiOperationTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiOperationTag client: %+v", err) + } + configureFunc(apiOperationTagClient.Client) - apiOperationClient := apioperation.NewApiOperationClientWithBaseURI(endpoint) - configureAuthFunc(&apiOperationClient.Client) + apiOperationsByTagClient, err := apioperationsbytag.NewApiOperationsByTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiOperationsByTag client: %+v", err) + } + configureFunc(apiOperationsByTagClient.Client) - apiOperationPolicyClient := apioperationpolicy.NewApiOperationPolicyClientWithBaseURI(endpoint) - configureAuthFunc(&apiOperationPolicyClient.Client) + apiPolicyClient, err := apipolicy.NewApiPolicyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiPolicy client: %+v", err) + } + configureFunc(apiPolicyClient.Client) - apiOperationTagClient := apioperationtag.NewApiOperationTagClientWithBaseURI(endpoint) - configureAuthFunc(&apiOperationTagClient.Client) + apiProductClient, err := apiproduct.NewApiProductClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiProduct client: %+v", err) + } + configureFunc(apiProductClient.Client) - apiOperationsByTagClient := apioperationsbytag.NewApiOperationsByTagClientWithBaseURI(endpoint) - configureAuthFunc(&apiOperationsByTagClient.Client) + apiReleaseClient, err := apirelease.NewApiReleaseClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiRelease client: %+v", err) + } + configureFunc(apiReleaseClient.Client) - apiPolicyClient := apipolicy.NewApiPolicyClientWithBaseURI(endpoint) - configureAuthFunc(&apiPolicyClient.Client) + apiRevisionClient, err := apirevision.NewApiRevisionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiRevision client: %+v", err) + } + configureFunc(apiRevisionClient.Client) - apiProductClient := apiproduct.NewApiProductClientWithBaseURI(endpoint) - configureAuthFunc(&apiProductClient.Client) + apiSchemaClient, err := apischema.NewApiSchemaClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiSchema client: %+v", err) + } + configureFunc(apiSchemaClient.Client) - apiReleaseClient := apirelease.NewApiReleaseClientWithBaseURI(endpoint) - configureAuthFunc(&apiReleaseClient.Client) + apiTagClient, err := apitag.NewApiTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiTag client: %+v", err) + } + configureFunc(apiTagClient.Client) - apiRevisionClient := apirevision.NewApiRevisionClientWithBaseURI(endpoint) - configureAuthFunc(&apiRevisionClient.Client) + apiTagDescriptionClient, err := apitagdescription.NewApiTagDescriptionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiTagDescription client: %+v", err) + } + configureFunc(apiTagDescriptionClient.Client) - apiSchemaClient := apischema.NewApiSchemaClientWithBaseURI(endpoint) - configureAuthFunc(&apiSchemaClient.Client) + apiVersionSetClient, err := apiversionset.NewApiVersionSetClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiVersionSet client: %+v", err) + } + configureFunc(apiVersionSetClient.Client) - apiTagClient := apitag.NewApiTagClientWithBaseURI(endpoint) - configureAuthFunc(&apiTagClient.Client) + apiVersionSetsClient, err := apiversionsets.NewApiVersionSetsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiVersionSets client: %+v", err) + } + configureFunc(apiVersionSetsClient.Client) - apiTagDescriptionClient := apitagdescription.NewApiTagDescriptionClientWithBaseURI(endpoint) - configureAuthFunc(&apiTagDescriptionClient.Client) + apisByTagClient, err := apisbytag.NewApisByTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApisByTag client: %+v", err) + } + configureFunc(apisByTagClient.Client) - apiVersionSetClient := apiversionset.NewApiVersionSetClientWithBaseURI(endpoint) - configureAuthFunc(&apiVersionSetClient.Client) + authorizationServerClient, err := authorizationserver.NewAuthorizationServerClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building AuthorizationServer client: %+v", err) + } + configureFunc(authorizationServerClient.Client) - apiVersionSetsClient := apiversionsets.NewApiVersionSetsClientWithBaseURI(endpoint) - configureAuthFunc(&apiVersionSetsClient.Client) + backendClient, err := backend.NewBackendClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Backend client: %+v", err) + } + configureFunc(backendClient.Client) - apisByTagClient := apisbytag.NewApisByTagClientWithBaseURI(endpoint) - configureAuthFunc(&apisByTagClient.Client) + backendReconnectClient, err := backendreconnect.NewBackendReconnectClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building BackendReconnect client: %+v", err) + } + configureFunc(backendReconnectClient.Client) + + cacheClient, err := cache.NewCacheClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Cache client: %+v", err) + } + configureFunc(cacheClient.Client) + + certificateClient, err := certificate.NewCertificateClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Certificate client: %+v", err) + } + configureFunc(certificateClient.Client) + + contentTypeClient, err := contenttype.NewContentTypeClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ContentType client: %+v", err) + } + configureFunc(contentTypeClient.Client) + + contentTypeContentItemClient, err := contenttypecontentitem.NewContentTypeContentItemClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ContentTypeContentItem client: %+v", err) + } + configureFunc(contentTypeContentItemClient.Client) + + delegationSettingsClient, err := delegationsettings.NewDelegationSettingsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building DelegationSettings client: %+v", err) + } + configureFunc(delegationSettingsClient.Client) + + deletedServiceClient, err := deletedservice.NewDeletedServiceClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building DeletedService client: %+v", err) + } + configureFunc(deletedServiceClient.Client) + + diagnosticClient, err := diagnostic.NewDiagnosticClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Diagnostic client: %+v", err) + } + configureFunc(diagnosticClient.Client) + + emailTemplateClient, err := emailtemplate.NewEmailTemplateClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building EmailTemplate client: %+v", err) + } + configureFunc(emailTemplateClient.Client) + + emailTemplatesClient, err := emailtemplates.NewEmailTemplatesClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building EmailTemplates client: %+v", err) + } + configureFunc(emailTemplatesClient.Client) + + gatewayApiClient, err := gatewayapi.NewGatewayApiClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayApi client: %+v", err) + } + configureFunc(gatewayApiClient.Client) + + gatewayCertificateAuthorityClient, err := gatewaycertificateauthority.NewGatewayCertificateAuthorityClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayCertificateAuthority client: %+v", err) + } + configureFunc(gatewayCertificateAuthorityClient.Client) + + gatewayClient, err := gateway.NewGatewayClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Gateway client: %+v", err) + } + configureFunc(gatewayClient.Client) - authorizationServerClient := authorizationserver.NewAuthorizationServerClientWithBaseURI(endpoint) - configureAuthFunc(&authorizationServerClient.Client) + gatewayGenerateTokenClient, err := gatewaygeneratetoken.NewGatewayGenerateTokenClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayGenerateToken client: %+v", err) + } + configureFunc(gatewayGenerateTokenClient.Client) - backendClient := backend.NewBackendClientWithBaseURI(endpoint) - configureAuthFunc(&backendClient.Client) + gatewayHostnameConfigurationClient, err := gatewayhostnameconfiguration.NewGatewayHostnameConfigurationClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayHostnameConfiguration client: %+v", err) + } + configureFunc(gatewayHostnameConfigurationClient.Client) - backendReconnectClient := backendreconnect.NewBackendReconnectClientWithBaseURI(endpoint) - configureAuthFunc(&backendReconnectClient.Client) + gatewayListKeysClient, err := gatewaylistkeys.NewGatewayListKeysClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayListKeys client: %+v", err) + } + configureFunc(gatewayListKeysClient.Client) - cacheClient := cache.NewCacheClientWithBaseURI(endpoint) - configureAuthFunc(&cacheClient.Client) + gatewayRegenerateKeyClient, err := gatewayregeneratekey.NewGatewayRegenerateKeyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayRegenerateKey client: %+v", err) + } + configureFunc(gatewayRegenerateKeyClient.Client) - certificateClient := certificate.NewCertificateClientWithBaseURI(endpoint) - configureAuthFunc(&certificateClient.Client) + groupClient, err := group.NewGroupClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Group client: %+v", err) + } + configureFunc(groupClient.Client) - contentTypeClient := contenttype.NewContentTypeClientWithBaseURI(endpoint) - configureAuthFunc(&contentTypeClient.Client) + groupUserClient, err := groupuser.NewGroupUserClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GroupUser client: %+v", err) + } + configureFunc(groupUserClient.Client) - contentTypeContentItemClient := contenttypecontentitem.NewContentTypeContentItemClientWithBaseURI(endpoint) - configureAuthFunc(&contentTypeContentItemClient.Client) + identityProviderClient, err := identityprovider.NewIdentityProviderClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building IdentityProvider client: %+v", err) + } + configureFunc(identityProviderClient.Client) - delegationSettingsClient := delegationsettings.NewDelegationSettingsClientWithBaseURI(endpoint) - configureAuthFunc(&delegationSettingsClient.Client) + issueClient, err := issue.NewIssueClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Issue client: %+v", err) + } + configureFunc(issueClient.Client) - deletedServiceClient := deletedservice.NewDeletedServiceClientWithBaseURI(endpoint) - configureAuthFunc(&deletedServiceClient.Client) + loggerClient, err := logger.NewLoggerClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Logger client: %+v", err) + } + configureFunc(loggerClient.Client) - diagnosticClient := diagnostic.NewDiagnosticClientWithBaseURI(endpoint) - configureAuthFunc(&diagnosticClient.Client) + namedValueClient, err := namedvalue.NewNamedValueClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building NamedValue client: %+v", err) + } + configureFunc(namedValueClient.Client) - emailTemplateClient := emailtemplate.NewEmailTemplateClientWithBaseURI(endpoint) - configureAuthFunc(&emailTemplateClient.Client) + networkStatusClient, err := networkstatus.NewNetworkStatusClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building NetworkStatus client: %+v", err) + } + configureFunc(networkStatusClient.Client) - emailTemplatesClient := emailtemplates.NewEmailTemplatesClientWithBaseURI(endpoint) - configureAuthFunc(&emailTemplatesClient.Client) + notificationClient, err := notification.NewNotificationClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Notification client: %+v", err) + } + configureFunc(notificationClient.Client) - gatewayApiClient := gatewayapi.NewGatewayApiClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayApiClient.Client) + notificationRecipientEmailClient, err := notificationrecipientemail.NewNotificationRecipientEmailClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building NotificationRecipientEmail client: %+v", err) + } + configureFunc(notificationRecipientEmailClient.Client) - gatewayCertificateAuthorityClient := gatewaycertificateauthority.NewGatewayCertificateAuthorityClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayCertificateAuthorityClient.Client) + notificationRecipientUserClient, err := notificationrecipientuser.NewNotificationRecipientUserClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building NotificationRecipientUser client: %+v", err) + } + configureFunc(notificationRecipientUserClient.Client) - gatewayClient := gateway.NewGatewayClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayClient.Client) + openidConnectProviderClient, err := openidconnectprovider.NewOpenidConnectProviderClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building OpenidConnectProvider client: %+v", err) + } + configureFunc(openidConnectProviderClient.Client) - gatewayGenerateTokenClient := gatewaygeneratetoken.NewGatewayGenerateTokenClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayGenerateTokenClient.Client) + outboundNetworkDependenciesEndpointsClient, err := outboundnetworkdependenciesendpoints.NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building OutboundNetworkDependenciesEndpoints client: %+v", err) + } + configureFunc(outboundNetworkDependenciesEndpointsClient.Client) - gatewayHostnameConfigurationClient := gatewayhostnameconfiguration.NewGatewayHostnameConfigurationClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayHostnameConfigurationClient.Client) + performConnectivityCheckClient, err := performconnectivitycheck.NewPerformConnectivityCheckClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PerformConnectivityCheck client: %+v", err) + } + configureFunc(performConnectivityCheckClient.Client) - gatewayListKeysClient := gatewaylistkeys.NewGatewayListKeysClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayListKeysClient.Client) + policyClient, err := policy.NewPolicyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Policy client: %+v", err) + } + configureFunc(policyClient.Client) - gatewayRegenerateKeyClient := gatewayregeneratekey.NewGatewayRegenerateKeyClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayRegenerateKeyClient.Client) + policyDescriptionClient, err := policydescription.NewPolicyDescriptionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PolicyDescription client: %+v", err) + } + configureFunc(policyDescriptionClient.Client) - groupClient := group.NewGroupClientWithBaseURI(endpoint) - configureAuthFunc(&groupClient.Client) + portalRevisionClient, err := portalrevision.NewPortalRevisionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PortalRevision client: %+v", err) + } + configureFunc(portalRevisionClient.Client) - groupUserClient := groupuser.NewGroupUserClientWithBaseURI(endpoint) - configureAuthFunc(&groupUserClient.Client) + portalSettingsClient, err := portalsettings.NewPortalSettingsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PortalSettings client: %+v", err) + } + configureFunc(portalSettingsClient.Client) - identityProviderClient := identityprovider.NewIdentityProviderClientWithBaseURI(endpoint) - configureAuthFunc(&identityProviderClient.Client) + privateEndpointConnectionsClient, err := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PrivateEndpointConnections client: %+v", err) + } + configureFunc(privateEndpointConnectionsClient.Client) - issueClient := issue.NewIssueClientWithBaseURI(endpoint) - configureAuthFunc(&issueClient.Client) + productApiClient, err := productapi.NewProductApiClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductApi client: %+v", err) + } + configureFunc(productApiClient.Client) - loggerClient := logger.NewLoggerClientWithBaseURI(endpoint) - configureAuthFunc(&loggerClient.Client) + productClient, err := product.NewProductClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Product client: %+v", err) + } + configureFunc(productClient.Client) - namedValueClient := namedvalue.NewNamedValueClientWithBaseURI(endpoint) - configureAuthFunc(&namedValueClient.Client) + productGroupClient, err := productgroup.NewProductGroupClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductGroup client: %+v", err) + } + configureFunc(productGroupClient.Client) - networkStatusClient := networkstatus.NewNetworkStatusClientWithBaseURI(endpoint) - configureAuthFunc(&networkStatusClient.Client) + productPolicyClient, err := productpolicy.NewProductPolicyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductPolicy client: %+v", err) + } + configureFunc(productPolicyClient.Client) - notificationClient := notification.NewNotificationClientWithBaseURI(endpoint) - configureAuthFunc(¬ificationClient.Client) + productSubscriptionClient, err := productsubscription.NewProductSubscriptionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductSubscription client: %+v", err) + } + configureFunc(productSubscriptionClient.Client) - notificationRecipientEmailClient := notificationrecipientemail.NewNotificationRecipientEmailClientWithBaseURI(endpoint) - configureAuthFunc(¬ificationRecipientEmailClient.Client) + productTagClient, err := producttag.NewProductTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductTag client: %+v", err) + } + configureFunc(productTagClient.Client) - notificationRecipientUserClient := notificationrecipientuser.NewNotificationRecipientUserClientWithBaseURI(endpoint) - configureAuthFunc(¬ificationRecipientUserClient.Client) + productsByTagClient, err := productsbytag.NewProductsByTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductsByTag client: %+v", err) + } + configureFunc(productsByTagClient.Client) - openidConnectProviderClient := openidconnectprovider.NewOpenidConnectProviderClientWithBaseURI(endpoint) - configureAuthFunc(&openidConnectProviderClient.Client) + quotaByCounterKeysClient, err := quotabycounterkeys.NewQuotaByCounterKeysClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building QuotaByCounterKeys client: %+v", err) + } + configureFunc(quotaByCounterKeysClient.Client) - outboundNetworkDependenciesEndpointsClient := outboundnetworkdependenciesendpoints.NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(endpoint) - configureAuthFunc(&outboundNetworkDependenciesEndpointsClient.Client) + quotaByPeriodKeysClient, err := quotabyperiodkeys.NewQuotaByPeriodKeysClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building QuotaByPeriodKeys client: %+v", err) + } + configureFunc(quotaByPeriodKeysClient.Client) - performConnectivityCheckClient := performconnectivitycheck.NewPerformConnectivityCheckClientWithBaseURI(endpoint) - configureAuthFunc(&performConnectivityCheckClient.Client) + regionClient, err := region.NewRegionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Region client: %+v", err) + } + configureFunc(regionClient.Client) - policyClient := policy.NewPolicyClientWithBaseURI(endpoint) - configureAuthFunc(&policyClient.Client) + reportsClient, err := reports.NewReportsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Reports client: %+v", err) + } + configureFunc(reportsClient.Client) - policyDescriptionClient := policydescription.NewPolicyDescriptionClientWithBaseURI(endpoint) - configureAuthFunc(&policyDescriptionClient.Client) + schemaClient, err := schema.NewSchemaClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Schema client: %+v", err) + } + configureFunc(schemaClient.Client) - portalRevisionClient := portalrevision.NewPortalRevisionClientWithBaseURI(endpoint) - configureAuthFunc(&portalRevisionClient.Client) + signInSettingsClient, err := signinsettings.NewSignInSettingsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building SignInSettings client: %+v", err) + } + configureFunc(signInSettingsClient.Client) - portalSettingsClient := portalsettings.NewPortalSettingsClientWithBaseURI(endpoint) - configureAuthFunc(&portalSettingsClient.Client) + signUpSettingsClient, err := signupsettings.NewSignUpSettingsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building SignUpSettings client: %+v", err) + } + configureFunc(signUpSettingsClient.Client) - privateEndpointConnectionsClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(endpoint) - configureAuthFunc(&privateEndpointConnectionsClient.Client) + skusClient, err := skus.NewSkusClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Skus client: %+v", err) + } + configureFunc(skusClient.Client) - productApiClient := productapi.NewProductApiClientWithBaseURI(endpoint) - configureAuthFunc(&productApiClient.Client) + subscriptionClient, err := subscription.NewSubscriptionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Subscription client: %+v", err) + } + configureFunc(subscriptionClient.Client) - productClient := product.NewProductClientWithBaseURI(endpoint) - configureAuthFunc(&productClient.Client) + tagClient, err := tag.NewTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Tag client: %+v", err) + } + configureFunc(tagClient.Client) - productGroupClient := productgroup.NewProductGroupClientWithBaseURI(endpoint) - configureAuthFunc(&productGroupClient.Client) + tagResourceClient, err := tagresource.NewTagResourceClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TagResource client: %+v", err) + } + configureFunc(tagResourceClient.Client) - productPolicyClient := productpolicy.NewProductPolicyClientWithBaseURI(endpoint) - configureAuthFunc(&productPolicyClient.Client) + tenantAccessClient, err := tenantaccess.NewTenantAccessClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TenantAccess client: %+v", err) + } + configureFunc(tenantAccessClient.Client) - productSubscriptionClient := productsubscription.NewProductSubscriptionClientWithBaseURI(endpoint) - configureAuthFunc(&productSubscriptionClient.Client) + tenantAccessGitClient, err := tenantaccessgit.NewTenantAccessGitClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TenantAccessGit client: %+v", err) + } + configureFunc(tenantAccessGitClient.Client) - productTagClient := producttag.NewProductTagClientWithBaseURI(endpoint) - configureAuthFunc(&productTagClient.Client) + tenantConfigurationClient, err := tenantconfiguration.NewTenantConfigurationClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TenantConfiguration client: %+v", err) + } + configureFunc(tenantConfigurationClient.Client) - productsByTagClient := productsbytag.NewProductsByTagClientWithBaseURI(endpoint) - configureAuthFunc(&productsByTagClient.Client) + tenantConfigurationSyncStateClient, err := tenantconfigurationsyncstate.NewTenantConfigurationSyncStateClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TenantConfigurationSyncState client: %+v", err) + } + configureFunc(tenantConfigurationSyncStateClient.Client) - quotaByCounterKeysClient := quotabycounterkeys.NewQuotaByCounterKeysClientWithBaseURI(endpoint) - configureAuthFunc("aByCounterKeysClient.Client) + tenantSettingsClient, err := tenantsettings.NewTenantSettingsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TenantSettings client: %+v", err) + } + configureFunc(tenantSettingsClient.Client) - quotaByPeriodKeysClient := quotabyperiodkeys.NewQuotaByPeriodKeysClientWithBaseURI(endpoint) - configureAuthFunc("aByPeriodKeysClient.Client) + userClient, err := user.NewUserClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building User client: %+v", err) + } + configureFunc(userClient.Client) - regionClient := region.NewRegionClientWithBaseURI(endpoint) - configureAuthFunc(®ionClient.Client) + userConfirmationPasswordSendClient, err := userconfirmationpasswordsend.NewUserConfirmationPasswordSendClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building UserConfirmationPasswordSend client: %+v", err) + } + configureFunc(userConfirmationPasswordSendClient.Client) - reportsClient := reports.NewReportsClientWithBaseURI(endpoint) - configureAuthFunc(&reportsClient.Client) + userGroupClient, err := usergroup.NewUserGroupClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building UserGroup client: %+v", err) + } + configureFunc(userGroupClient.Client) - schemaClient := schema.NewSchemaClientWithBaseURI(endpoint) - configureAuthFunc(&schemaClient.Client) + userIdentityClient, err := useridentity.NewUserIdentityClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building UserIdentity client: %+v", err) + } + configureFunc(userIdentityClient.Client) - signInSettingsClient := signinsettings.NewSignInSettingsClientWithBaseURI(endpoint) - configureAuthFunc(&signInSettingsClient.Client) + userSubscriptionClient, err := usersubscription.NewUserSubscriptionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building UserSubscription client: %+v", err) + } + configureFunc(userSubscriptionClient.Client) - signUpSettingsClient := signupsettings.NewSignUpSettingsClientWithBaseURI(endpoint) - configureAuthFunc(&signUpSettingsClient.Client) + userTokenClient, err := usertoken.NewUserTokenClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building UserToken client: %+v", err) + } + configureFunc(userTokenClient.Client) - skusClient := skus.NewSkusClientWithBaseURI(endpoint) - configureAuthFunc(&skusClient.Client) - - subscriptionClient := subscription.NewSubscriptionClientWithBaseURI(endpoint) - configureAuthFunc(&subscriptionClient.Client) - - tagClient := tag.NewTagClientWithBaseURI(endpoint) - configureAuthFunc(&tagClient.Client) - - tagResourceClient := tagresource.NewTagResourceClientWithBaseURI(endpoint) - configureAuthFunc(&tagResourceClient.Client) - - tenantAccessClient := tenantaccess.NewTenantAccessClientWithBaseURI(endpoint) - configureAuthFunc(&tenantAccessClient.Client) - - tenantAccessGitClient := tenantaccessgit.NewTenantAccessGitClientWithBaseURI(endpoint) - configureAuthFunc(&tenantAccessGitClient.Client) - - tenantConfigurationClient := tenantconfiguration.NewTenantConfigurationClientWithBaseURI(endpoint) - configureAuthFunc(&tenantConfigurationClient.Client) - - tenantConfigurationSyncStateClient := tenantconfigurationsyncstate.NewTenantConfigurationSyncStateClientWithBaseURI(endpoint) - configureAuthFunc(&tenantConfigurationSyncStateClient.Client) - - tenantSettingsClient := tenantsettings.NewTenantSettingsClientWithBaseURI(endpoint) - configureAuthFunc(&tenantSettingsClient.Client) - - userClient := user.NewUserClientWithBaseURI(endpoint) - configureAuthFunc(&userClient.Client) - - userConfirmationPasswordSendClient := userconfirmationpasswordsend.NewUserConfirmationPasswordSendClientWithBaseURI(endpoint) - configureAuthFunc(&userConfirmationPasswordSendClient.Client) - - userGroupClient := usergroup.NewUserGroupClientWithBaseURI(endpoint) - configureAuthFunc(&userGroupClient.Client) - - userIdentityClient := useridentity.NewUserIdentityClientWithBaseURI(endpoint) - configureAuthFunc(&userIdentityClient.Client) - - userSubscriptionClient := usersubscription.NewUserSubscriptionClientWithBaseURI(endpoint) - configureAuthFunc(&userSubscriptionClient.Client) - - userTokenClient := usertoken.NewUserTokenClientWithBaseURI(endpoint) - configureAuthFunc(&userTokenClient.Client) - - usersClient := users.NewUsersClientWithBaseURI(endpoint) - configureAuthFunc(&usersClient.Client) - - return Client{ - Api: &apiClient, - ApiDiagnostic: &apiDiagnosticClient, - ApiIssue: &apiIssueClient, - ApiIssueAttachment: &apiIssueAttachmentClient, - ApiIssueComment: &apiIssueCommentClient, - ApiManagementService: &apiManagementServiceClient, - ApiManagementServiceSkus: &apiManagementServiceSkusClient, - ApiOperation: &apiOperationClient, - ApiOperationPolicy: &apiOperationPolicyClient, - ApiOperationTag: &apiOperationTagClient, - ApiOperationsByTag: &apiOperationsByTagClient, - ApiPolicy: &apiPolicyClient, - ApiProduct: &apiProductClient, - ApiRelease: &apiReleaseClient, - ApiRevision: &apiRevisionClient, - ApiSchema: &apiSchemaClient, - ApiTag: &apiTagClient, - ApiTagDescription: &apiTagDescriptionClient, - ApiVersionSet: &apiVersionSetClient, - ApiVersionSets: &apiVersionSetsClient, - ApisByTag: &apisByTagClient, - AuthorizationServer: &authorizationServerClient, - Backend: &backendClient, - BackendReconnect: &backendReconnectClient, - Cache: &cacheClient, - Certificate: &certificateClient, - ContentType: &contentTypeClient, - ContentTypeContentItem: &contentTypeContentItemClient, - DelegationSettings: &delegationSettingsClient, - DeletedService: &deletedServiceClient, - Diagnostic: &diagnosticClient, - EmailTemplate: &emailTemplateClient, - EmailTemplates: &emailTemplatesClient, - Gateway: &gatewayClient, - GatewayApi: &gatewayApiClient, - GatewayCertificateAuthority: &gatewayCertificateAuthorityClient, - GatewayGenerateToken: &gatewayGenerateTokenClient, - GatewayHostnameConfiguration: &gatewayHostnameConfigurationClient, - GatewayListKeys: &gatewayListKeysClient, - GatewayRegenerateKey: &gatewayRegenerateKeyClient, - Group: &groupClient, - GroupUser: &groupUserClient, - IdentityProvider: &identityProviderClient, - Issue: &issueClient, - Logger: &loggerClient, - NamedValue: &namedValueClient, - NetworkStatus: &networkStatusClient, - Notification: ¬ificationClient, - NotificationRecipientEmail: ¬ificationRecipientEmailClient, - NotificationRecipientUser: ¬ificationRecipientUserClient, - OpenidConnectProvider: &openidConnectProviderClient, - OutboundNetworkDependenciesEndpoints: &outboundNetworkDependenciesEndpointsClient, - PerformConnectivityCheck: &performConnectivityCheckClient, - Policy: &policyClient, - PolicyDescription: &policyDescriptionClient, - PortalRevision: &portalRevisionClient, - PortalSettings: &portalSettingsClient, - PrivateEndpointConnections: &privateEndpointConnectionsClient, - Product: &productClient, - ProductApi: &productApiClient, - ProductGroup: &productGroupClient, - ProductPolicy: &productPolicyClient, - ProductSubscription: &productSubscriptionClient, - ProductTag: &productTagClient, - ProductsByTag: &productsByTagClient, - QuotaByCounterKeys: "aByCounterKeysClient, - QuotaByPeriodKeys: "aByPeriodKeysClient, - Region: ®ionClient, - Reports: &reportsClient, - Schema: &schemaClient, - SignInSettings: &signInSettingsClient, - SignUpSettings: &signUpSettingsClient, - Skus: &skusClient, - Subscription: &subscriptionClient, - Tag: &tagClient, - TagResource: &tagResourceClient, - TenantAccess: &tenantAccessClient, - TenantAccessGit: &tenantAccessGitClient, - TenantConfiguration: &tenantConfigurationClient, - TenantConfigurationSyncState: &tenantConfigurationSyncStateClient, - TenantSettings: &tenantSettingsClient, - User: &userClient, - UserConfirmationPasswordSend: &userConfirmationPasswordSendClient, - UserGroup: &userGroupClient, - UserIdentity: &userIdentityClient, - UserSubscription: &userSubscriptionClient, - UserToken: &userTokenClient, - Users: &usersClient, + usersClient, err := users.NewUsersClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Users client: %+v", err) } + configureFunc(usersClient.Client) + + return &Client{ + Api: apiClient, + ApiDiagnostic: apiDiagnosticClient, + ApiIssue: apiIssueClient, + ApiIssueAttachment: apiIssueAttachmentClient, + ApiIssueComment: apiIssueCommentClient, + ApiManagementService: apiManagementServiceClient, + ApiManagementServiceSkus: apiManagementServiceSkusClient, + ApiOperation: apiOperationClient, + ApiOperationPolicy: apiOperationPolicyClient, + ApiOperationTag: apiOperationTagClient, + ApiOperationsByTag: apiOperationsByTagClient, + ApiPolicy: apiPolicyClient, + ApiProduct: apiProductClient, + ApiRelease: apiReleaseClient, + ApiRevision: apiRevisionClient, + ApiSchema: apiSchemaClient, + ApiTag: apiTagClient, + ApiTagDescription: apiTagDescriptionClient, + ApiVersionSet: apiVersionSetClient, + ApiVersionSets: apiVersionSetsClient, + ApisByTag: apisByTagClient, + AuthorizationServer: authorizationServerClient, + Backend: backendClient, + BackendReconnect: backendReconnectClient, + Cache: cacheClient, + Certificate: certificateClient, + ContentType: contentTypeClient, + ContentTypeContentItem: contentTypeContentItemClient, + DelegationSettings: delegationSettingsClient, + DeletedService: deletedServiceClient, + Diagnostic: diagnosticClient, + EmailTemplate: emailTemplateClient, + EmailTemplates: emailTemplatesClient, + Gateway: gatewayClient, + GatewayApi: gatewayApiClient, + GatewayCertificateAuthority: gatewayCertificateAuthorityClient, + GatewayGenerateToken: gatewayGenerateTokenClient, + GatewayHostnameConfiguration: gatewayHostnameConfigurationClient, + GatewayListKeys: gatewayListKeysClient, + GatewayRegenerateKey: gatewayRegenerateKeyClient, + Group: groupClient, + GroupUser: groupUserClient, + IdentityProvider: identityProviderClient, + Issue: issueClient, + Logger: loggerClient, + NamedValue: namedValueClient, + NetworkStatus: networkStatusClient, + Notification: notificationClient, + NotificationRecipientEmail: notificationRecipientEmailClient, + NotificationRecipientUser: notificationRecipientUserClient, + OpenidConnectProvider: openidConnectProviderClient, + OutboundNetworkDependenciesEndpoints: outboundNetworkDependenciesEndpointsClient, + PerformConnectivityCheck: performConnectivityCheckClient, + Policy: policyClient, + PolicyDescription: policyDescriptionClient, + PortalRevision: portalRevisionClient, + PortalSettings: portalSettingsClient, + PrivateEndpointConnections: privateEndpointConnectionsClient, + Product: productClient, + ProductApi: productApiClient, + ProductGroup: productGroupClient, + ProductPolicy: productPolicyClient, + ProductSubscription: productSubscriptionClient, + ProductTag: productTagClient, + ProductsByTag: productsByTagClient, + QuotaByCounterKeys: quotaByCounterKeysClient, + QuotaByPeriodKeys: quotaByPeriodKeysClient, + Region: regionClient, + Reports: reportsClient, + Schema: schemaClient, + SignInSettings: signInSettingsClient, + SignUpSettings: signUpSettingsClient, + Skus: skusClient, + Subscription: subscriptionClient, + Tag: tagClient, + TagResource: tagResourceClient, + TenantAccess: tenantAccessClient, + TenantAccessGit: tenantAccessGitClient, + TenantConfiguration: tenantConfigurationClient, + TenantConfigurationSyncState: tenantConfigurationSyncStateClient, + TenantSettings: tenantSettingsClient, + User: userClient, + UserConfirmationPasswordSend: userConfirmationPasswordSendClient, + UserGroup: userGroupClient, + UserIdentity: userIdentityClient, + UserSubscription: userSubscriptionClient, + UserToken: userTokenClient, + Users: usersClient, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/contenttype/client.go b/resource-manager/apimanagement/2021-08-01/contenttype/client.go index ad798035bab..d2af44c08b3 100644 --- a/resource-manager/apimanagement/2021-08-01/contenttype/client.go +++ b/resource-manager/apimanagement/2021-08-01/contenttype/client.go @@ -1,18 +1,26 @@ package contenttype -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ContentTypeClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewContentTypeClientWithBaseURI(endpoint string) ContentTypeClient { - return ContentTypeClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewContentTypeClientWithBaseURI(api sdkEnv.Api) (*ContentTypeClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "contenttype", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ContentTypeClient: %+v", err) } + + return &ContentTypeClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/contenttype/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/contenttype/method_createorupdate.go new file mode 100644 index 00000000000..777eb60bb34 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/contenttype/method_createorupdate.go @@ -0,0 +1,85 @@ +package contenttype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContentTypeContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ContentTypeClient) CreateOrUpdate(ctx context.Context, id ContentTypeId, input ContentTypeContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/contenttype/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/contenttype/method_createorupdate_autorest.go deleted file mode 100644 index 7e7af790b98..00000000000 --- a/resource-manager/apimanagement/2021-08-01/contenttype/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package contenttype - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ContentTypeContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ContentTypeClient) CreateOrUpdate(ctx context.Context, id ContentTypeId, input ContentTypeContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ContentTypeClient) preparerForCreateOrUpdate(ctx context.Context, id ContentTypeId, input ContentTypeContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ContentTypeClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/contenttype/method_delete.go b/resource-manager/apimanagement/2021-08-01/contenttype/method_delete.go new file mode 100644 index 00000000000..5a87b291973 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/contenttype/method_delete.go @@ -0,0 +1,76 @@ +package contenttype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ContentTypeClient) Delete(ctx context.Context, id ContentTypeId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/contenttype/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/contenttype/method_delete_autorest.go deleted file mode 100644 index c67c198a0f2..00000000000 --- a/resource-manager/apimanagement/2021-08-01/contenttype/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package contenttype - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ContentTypeClient) Delete(ctx context.Context, id ContentTypeId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ContentTypeClient) preparerForDelete(ctx context.Context, id ContentTypeId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ContentTypeClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/contenttype/method_get.go b/resource-manager/apimanagement/2021-08-01/contenttype/method_get.go new file mode 100644 index 00000000000..45f141d65b2 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/contenttype/method_get.go @@ -0,0 +1,51 @@ +package contenttype + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContentTypeContract +} + +// Get ... +func (c ContentTypeClient) Get(ctx context.Context, id ContentTypeId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/contenttype/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/contenttype/method_get_autorest.go deleted file mode 100644 index ffff3ebdfb5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/contenttype/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package contenttype - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ContentTypeContract -} - -// Get ... -func (c ContentTypeClient) Get(ctx context.Context, id ContentTypeId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ContentTypeClient) preparerForGet(ctx context.Context, id ContentTypeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ContentTypeClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/contenttype/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/contenttype/method_listbyservice.go new file mode 100644 index 00000000000..3a6d95c44ce --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/contenttype/method_listbyservice.go @@ -0,0 +1,89 @@ +package contenttype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ContentTypeContract +} + +type ListByServiceCompleteResult struct { + Items []ContentTypeContract +} + +// ListByService ... +func (c ContentTypeClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/contentTypes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ContentTypeContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ContentTypeClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, ContentTypeContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContentTypeClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate ContentTypeContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ContentTypeContract, 0) + + resp, err := c.ListByService(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/contenttype/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/contenttype/method_listbyservice_autorest.go deleted file mode 100644 index 80dfbe9830a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/contenttype/method_listbyservice_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package contenttype - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ContentTypeContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ContentTypeContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByService ... -func (c ContentTypeClient) ListByService(ctx context.Context, id ServiceId) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ContentTypeClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/contentTypes", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ContentTypeClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ContentTypeClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ContentTypeContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ContentTypeClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, ContentTypeContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ContentTypeClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate ContentTypeContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ContentTypeContract, 0) - - page, err := c.ListByService(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/client.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/client.go index 89ca6821ddb..0ae62f20886 100644 --- a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/client.go +++ b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/client.go @@ -1,18 +1,26 @@ package contenttypecontentitem -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ContentTypeContentItemClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewContentTypeContentItemClientWithBaseURI(endpoint string) ContentTypeContentItemClient { - return ContentTypeContentItemClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewContentTypeContentItemClientWithBaseURI(api sdkEnv.Api) (*ContentTypeContentItemClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "contenttypecontentitem", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ContentTypeContentItemClient: %+v", err) } + + return &ContentTypeContentItemClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemcreateorupdate.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemcreateorupdate.go new file mode 100644 index 00000000000..f64c33e51f2 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemcreateorupdate.go @@ -0,0 +1,85 @@ +package contenttypecontentitem + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentItemCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContentItemContract +} + +type ContentItemCreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultContentItemCreateOrUpdateOperationOptions() ContentItemCreateOrUpdateOperationOptions { + return ContentItemCreateOrUpdateOperationOptions{} +} + +func (o ContentItemCreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o ContentItemCreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ContentItemCreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// ContentItemCreateOrUpdate ... +func (c ContentTypeContentItemClient) ContentItemCreateOrUpdate(ctx context.Context, id ContentItemId, input ContentItemContract, options ContentItemCreateOrUpdateOperationOptions) (result ContentItemCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemcreateorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemcreateorupdate_autorest.go deleted file mode 100644 index 74712be0162..00000000000 --- a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemcreateorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package contenttypecontentitem - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentItemCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ContentItemContract -} - -type ContentItemCreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultContentItemCreateOrUpdateOperationOptions() ContentItemCreateOrUpdateOperationOptions { - return ContentItemCreateOrUpdateOperationOptions{} -} - -func (o ContentItemCreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o ContentItemCreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// ContentItemCreateOrUpdate ... -func (c ContentTypeContentItemClient) ContentItemCreateOrUpdate(ctx context.Context, id ContentItemId, input ContentItemContract, options ContentItemCreateOrUpdateOperationOptions) (result ContentItemCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForContentItemCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentItemCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentItemCreateOrUpdate prepares the ContentItemCreateOrUpdate request. -func (c ContentTypeContentItemClient) preparerForContentItemCreateOrUpdate(ctx context.Context, id ContentItemId, input ContentItemContract, options ContentItemCreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentItemCreateOrUpdate handles the response to the ContentItemCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ContentTypeContentItemClient) responderForContentItemCreateOrUpdate(resp *http.Response) (result ContentItemCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemdelete.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemdelete.go new file mode 100644 index 00000000000..5b8b348a02c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemdelete.go @@ -0,0 +1,76 @@ +package contenttypecontentitem + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentItemDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type ContentItemDeleteOperationOptions struct { + IfMatch *string +} + +func DefaultContentItemDeleteOperationOptions() ContentItemDeleteOperationOptions { + return ContentItemDeleteOperationOptions{} +} + +func (o ContentItemDeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o ContentItemDeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ContentItemDeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// ContentItemDelete ... +func (c ContentTypeContentItemClient) ContentItemDelete(ctx context.Context, id ContentItemId, options ContentItemDeleteOperationOptions) (result ContentItemDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemdelete_autorest.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemdelete_autorest.go deleted file mode 100644 index 701903e5664..00000000000 --- a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemdelete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package contenttypecontentitem - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentItemDeleteOperationResponse struct { - HttpResponse *http.Response -} - -type ContentItemDeleteOperationOptions struct { - IfMatch *string -} - -func DefaultContentItemDeleteOperationOptions() ContentItemDeleteOperationOptions { - return ContentItemDeleteOperationOptions{} -} - -func (o ContentItemDeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o ContentItemDeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// ContentItemDelete ... -func (c ContentTypeContentItemClient) ContentItemDelete(ctx context.Context, id ContentItemId, options ContentItemDeleteOperationOptions) (result ContentItemDeleteOperationResponse, err error) { - req, err := c.preparerForContentItemDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentItemDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentItemDelete prepares the ContentItemDelete request. -func (c ContentTypeContentItemClient) preparerForContentItemDelete(ctx context.Context, id ContentItemId, options ContentItemDeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentItemDelete handles the response to the ContentItemDelete request. The method always -// closes the http.Response Body. -func (c ContentTypeContentItemClient) responderForContentItemDelete(resp *http.Response) (result ContentItemDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemget.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemget.go new file mode 100644 index 00000000000..8ea76ef555d --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemget.go @@ -0,0 +1,51 @@ +package contenttypecontentitem + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentItemGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContentItemContract +} + +// ContentItemGet ... +func (c ContentTypeContentItemClient) ContentItemGet(ctx context.Context, id ContentItemId) (result ContentItemGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemget_autorest.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemget_autorest.go deleted file mode 100644 index efbe49d07d9..00000000000 --- a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package contenttypecontentitem - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentItemGetOperationResponse struct { - HttpResponse *http.Response - Model *ContentItemContract -} - -// ContentItemGet ... -func (c ContentTypeContentItemClient) ContentItemGet(ctx context.Context, id ContentItemId) (result ContentItemGetOperationResponse, err error) { - req, err := c.preparerForContentItemGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentItemGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentItemGet prepares the ContentItemGet request. -func (c ContentTypeContentItemClient) preparerForContentItemGet(ctx context.Context, id ContentItemId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentItemGet handles the response to the ContentItemGet request. The method always -// closes the http.Response Body. -func (c ContentTypeContentItemClient) responderForContentItemGet(resp *http.Response) (result ContentItemGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemgetentitytag.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemgetentitytag.go new file mode 100644 index 00000000000..072a373e255 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemgetentitytag.go @@ -0,0 +1,46 @@ +package contenttypecontentitem + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentItemGetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// ContentItemGetEntityTag ... +func (c ContentTypeContentItemClient) ContentItemGetEntityTag(ctx context.Context, id ContentItemId) (result ContentItemGetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemgetentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemgetentitytag_autorest.go deleted file mode 100644 index b6ba07420c2..00000000000 --- a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemgetentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package contenttypecontentitem - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentItemGetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// ContentItemGetEntityTag ... -func (c ContentTypeContentItemClient) ContentItemGetEntityTag(ctx context.Context, id ContentItemId) (result ContentItemGetEntityTagOperationResponse, err error) { - req, err := c.preparerForContentItemGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentItemGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentItemGetEntityTag prepares the ContentItemGetEntityTag request. -func (c ContentTypeContentItemClient) preparerForContentItemGetEntityTag(ctx context.Context, id ContentItemId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentItemGetEntityTag handles the response to the ContentItemGetEntityTag request. The method always -// closes the http.Response Body. -func (c ContentTypeContentItemClient) responderForContentItemGetEntityTag(resp *http.Response) (result ContentItemGetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemlistbyservice.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemlistbyservice.go new file mode 100644 index 00000000000..8e83525cd40 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemlistbyservice.go @@ -0,0 +1,89 @@ +package contenttypecontentitem + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentItemListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ContentItemContract +} + +type ContentItemListByServiceCompleteResult struct { + Items []ContentItemContract +} + +// ContentItemListByService ... +func (c ContentTypeContentItemClient) ContentItemListByService(ctx context.Context, id ContentTypeId) (result ContentItemListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/contentItems", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ContentItemContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ContentItemListByServiceComplete retrieves all the results into a single object +func (c ContentTypeContentItemClient) ContentItemListByServiceComplete(ctx context.Context, id ContentTypeId) (ContentItemListByServiceCompleteResult, error) { + return c.ContentItemListByServiceCompleteMatchingPredicate(ctx, id, ContentItemContractOperationPredicate{}) +} + +// ContentItemListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContentTypeContentItemClient) ContentItemListByServiceCompleteMatchingPredicate(ctx context.Context, id ContentTypeId, predicate ContentItemContractOperationPredicate) (result ContentItemListByServiceCompleteResult, err error) { + items := make([]ContentItemContract, 0) + + resp, err := c.ContentItemListByService(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ContentItemListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemlistbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemlistbyservice_autorest.go deleted file mode 100644 index 4a4be76da22..00000000000 --- a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/method_contentitemlistbyservice_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package contenttypecontentitem - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentItemListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ContentItemContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ContentItemListByServiceOperationResponse, error) -} - -type ContentItemListByServiceCompleteResult struct { - Items []ContentItemContract -} - -func (r ContentItemListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ContentItemListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ContentItemListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ContentItemListByService ... -func (c ContentTypeContentItemClient) ContentItemListByService(ctx context.Context, id ContentTypeId) (resp ContentItemListByServiceOperationResponse, err error) { - req, err := c.preparerForContentItemListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForContentItemListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForContentItemListByService prepares the ContentItemListByService request. -func (c ContentTypeContentItemClient) preparerForContentItemListByService(ctx context.Context, id ContentTypeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/contentItems", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForContentItemListByServiceWithNextLink prepares the ContentItemListByService request with the given nextLink token. -func (c ContentTypeContentItemClient) preparerForContentItemListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentItemListByService handles the response to the ContentItemListByService request. The method always -// closes the http.Response Body. -func (c ContentTypeContentItemClient) responderForContentItemListByService(resp *http.Response) (result ContentItemListByServiceOperationResponse, err error) { - type page struct { - Values []ContentItemContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ContentItemListByServiceOperationResponse, err error) { - req, err := c.preparerForContentItemListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentItemListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ContentItemListByServiceComplete retrieves all of the results into a single object -func (c ContentTypeContentItemClient) ContentItemListByServiceComplete(ctx context.Context, id ContentTypeId) (ContentItemListByServiceCompleteResult, error) { - return c.ContentItemListByServiceCompleteMatchingPredicate(ctx, id, ContentItemContractOperationPredicate{}) -} - -// ContentItemListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ContentTypeContentItemClient) ContentItemListByServiceCompleteMatchingPredicate(ctx context.Context, id ContentTypeId, predicate ContentItemContractOperationPredicate) (resp ContentItemListByServiceCompleteResult, err error) { - items := make([]ContentItemContract, 0) - - page, err := c.ContentItemListByService(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ContentItemListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/client.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/client.go index 72c97b7519c..8047bd74fb4 100644 --- a/resource-manager/apimanagement/2021-08-01/delegationsettings/client.go +++ b/resource-manager/apimanagement/2021-08-01/delegationsettings/client.go @@ -1,18 +1,26 @@ package delegationsettings -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type DelegationSettingsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewDelegationSettingsClientWithBaseURI(endpoint string) DelegationSettingsClient { - return DelegationSettingsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewDelegationSettingsClientWithBaseURI(api sdkEnv.Api) (*DelegationSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "delegationsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DelegationSettingsClient: %+v", err) } + + return &DelegationSettingsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_createorupdate.go new file mode 100644 index 00000000000..798382faf25 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_createorupdate.go @@ -0,0 +1,84 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalDelegationSettings +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c DelegationSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalDelegationSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_createorupdate_autorest.go deleted file mode 100644 index 51373a1a8ce..00000000000 --- a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package delegationsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PortalDelegationSettings -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c DelegationSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalDelegationSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c DelegationSettingsClient) preparerForCreateOrUpdate(ctx context.Context, id ServiceId, input PortalDelegationSettings, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/delegation", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c DelegationSettingsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_get.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_get.go new file mode 100644 index 00000000000..7e0f9378ef1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_get.go @@ -0,0 +1,52 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalDelegationSettings +} + +// Get ... +func (c DelegationSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_get_autorest.go deleted file mode 100644 index e2553b0753d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package delegationsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PortalDelegationSettings -} - -// Get ... -func (c DelegationSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c DelegationSettingsClient) preparerForGet(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/delegation", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c DelegationSettingsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_getentitytag.go new file mode 100644 index 00000000000..6d1fc5745c7 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_getentitytag.go @@ -0,0 +1,47 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c DelegationSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_getentitytag_autorest.go deleted file mode 100644 index 7a92ab1b000..00000000000 --- a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package delegationsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c DelegationSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c DelegationSettingsClient) preparerForGetEntityTag(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/delegation", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c DelegationSettingsClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_listsecrets.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_listsecrets.go new file mode 100644 index 00000000000..baf7a240e3b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_listsecrets.go @@ -0,0 +1,52 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSettingValidationKeyContract +} + +// ListSecrets ... +func (c DelegationSettingsClient) ListSecrets(ctx context.Context, id ServiceId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/portalsettings/delegation/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_listsecrets_autorest.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_listsecrets_autorest.go deleted file mode 100644 index 279c998cc3b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package delegationsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *PortalSettingValidationKeyContract -} - -// ListSecrets ... -func (c DelegationSettingsClient) ListSecrets(ctx context.Context, id ServiceId) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c DelegationSettingsClient) preparerForListSecrets(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/delegation/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c DelegationSettingsClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_update.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_update.go new file mode 100644 index 00000000000..924b296b5fa --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_update.go @@ -0,0 +1,79 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c DelegationSettingsClient) Update(ctx context.Context, id ServiceId, input PortalDelegationSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/method_update_autorest.go deleted file mode 100644 index c768645478b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/delegationsettings/method_update_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package delegationsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c DelegationSettingsClient) Update(ctx context.Context, id ServiceId, input PortalDelegationSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c DelegationSettingsClient) preparerForUpdate(ctx context.Context, id ServiceId, input PortalDelegationSettings, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/delegation", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c DelegationSettingsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/deletedservice/client.go b/resource-manager/apimanagement/2021-08-01/deletedservice/client.go index 481a31f9a8a..4db226a6f87 100644 --- a/resource-manager/apimanagement/2021-08-01/deletedservice/client.go +++ b/resource-manager/apimanagement/2021-08-01/deletedservice/client.go @@ -1,18 +1,26 @@ package deletedservice -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type DeletedServiceClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewDeletedServiceClientWithBaseURI(endpoint string) DeletedServiceClient { - return DeletedServiceClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewDeletedServiceClientWithBaseURI(api sdkEnv.Api) (*DeletedServiceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "deletedservice", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DeletedServiceClient: %+v", err) } + + return &DeletedServiceClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/deletedservice/method_getbyname.go b/resource-manager/apimanagement/2021-08-01/deletedservice/method_getbyname.go new file mode 100644 index 00000000000..f6404fd9b48 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/deletedservice/method_getbyname.go @@ -0,0 +1,51 @@ +package deletedservice + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetByNameOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DeletedServiceContract +} + +// GetByName ... +func (c DeletedServiceClient) GetByName(ctx context.Context, id DeletedServiceId) (result GetByNameOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/deletedservice/method_getbyname_autorest.go b/resource-manager/apimanagement/2021-08-01/deletedservice/method_getbyname_autorest.go deleted file mode 100644 index f80305a22eb..00000000000 --- a/resource-manager/apimanagement/2021-08-01/deletedservice/method_getbyname_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package deletedservice - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetByNameOperationResponse struct { - HttpResponse *http.Response - Model *DeletedServiceContract -} - -// GetByName ... -func (c DeletedServiceClient) GetByName(ctx context.Context, id DeletedServiceId) (result GetByNameOperationResponse, err error) { - req, err := c.preparerForGetByName(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "GetByName", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "GetByName", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetByName(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "GetByName", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetByName prepares the GetByName request. -func (c DeletedServiceClient) preparerForGetByName(ctx context.Context, id DeletedServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetByName handles the response to the GetByName request. The method always -// closes the http.Response Body. -func (c DeletedServiceClient) responderForGetByName(resp *http.Response) (result GetByNameOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/deletedservice/method_listbysubscription.go b/resource-manager/apimanagement/2021-08-01/deletedservice/method_listbysubscription.go new file mode 100644 index 00000000000..f6077a9e1f1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/deletedservice/method_listbysubscription.go @@ -0,0 +1,90 @@ +package deletedservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DeletedServiceContract +} + +type ListBySubscriptionCompleteResult struct { + Items []DeletedServiceContract +} + +// ListBySubscription ... +func (c DeletedServiceClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/deletedServices", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DeletedServiceContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c DeletedServiceClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DeletedServiceContractOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DeletedServiceClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DeletedServiceContractOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]DeletedServiceContract, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/deletedservice/method_listbysubscription_autorest.go b/resource-manager/apimanagement/2021-08-01/deletedservice/method_listbysubscription_autorest.go deleted file mode 100644 index 34e994381a2..00000000000 --- a/resource-manager/apimanagement/2021-08-01/deletedservice/method_listbysubscription_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package deletedservice - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *[]DeletedServiceContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []DeletedServiceContract -} - -func (r ListBySubscriptionOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListBySubscription ... -func (c DeletedServiceClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c DeletedServiceClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/deletedServices", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c DeletedServiceClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c DeletedServiceClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { - type page struct { - Values []DeletedServiceContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c DeletedServiceClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DeletedServiceContractOperationPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DeletedServiceClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DeletedServiceContractOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]DeletedServiceContract, 0) - - page, err := c.ListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/deletedservice/method_purge.go b/resource-manager/apimanagement/2021-08-01/deletedservice/method_purge.go new file mode 100644 index 00000000000..0e5dcf28a3d --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/deletedservice/method_purge.go @@ -0,0 +1,71 @@ +package deletedservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PurgeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Purge ... +func (c DeletedServiceClient) Purge(ctx context.Context, id DeletedServiceId) (result PurgeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PurgeThenPoll performs Purge then polls until it's completed +func (c DeletedServiceClient) PurgeThenPoll(ctx context.Context, id DeletedServiceId) error { + result, err := c.Purge(ctx, id) + if err != nil { + return fmt.Errorf("performing Purge: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Purge: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/deletedservice/method_purge_autorest.go b/resource-manager/apimanagement/2021-08-01/deletedservice/method_purge_autorest.go deleted file mode 100644 index 3494c6cdd2e..00000000000 --- a/resource-manager/apimanagement/2021-08-01/deletedservice/method_purge_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package deletedservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PurgeOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Purge ... -func (c DeletedServiceClient) Purge(ctx context.Context, id DeletedServiceId) (result PurgeOperationResponse, err error) { - req, err := c.preparerForPurge(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "Purge", nil, "Failure preparing request") - return - } - - result, err = c.senderForPurge(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "Purge", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// PurgeThenPoll performs Purge then polls until it's completed -func (c DeletedServiceClient) PurgeThenPoll(ctx context.Context, id DeletedServiceId) error { - result, err := c.Purge(ctx, id) - if err != nil { - return fmt.Errorf("performing Purge: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Purge: %+v", err) - } - - return nil -} - -// preparerForPurge prepares the Purge request. -func (c DeletedServiceClient) preparerForPurge(ctx context.Context, id DeletedServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForPurge sends the Purge request. The method will close the -// http.Response Body if it receives an error. -func (c DeletedServiceClient) senderForPurge(ctx context.Context, req *http.Request) (future PurgeOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/client.go b/resource-manager/apimanagement/2021-08-01/diagnostic/client.go index 724671ed06e..a24dae1dfb0 100644 --- a/resource-manager/apimanagement/2021-08-01/diagnostic/client.go +++ b/resource-manager/apimanagement/2021-08-01/diagnostic/client.go @@ -1,18 +1,26 @@ package diagnostic -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type DiagnosticClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewDiagnosticClientWithBaseURI(endpoint string) DiagnosticClient { - return DiagnosticClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewDiagnosticClientWithBaseURI(api sdkEnv.Api) (*DiagnosticClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "diagnostic", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DiagnosticClient: %+v", err) } + + return &DiagnosticClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/constants.go b/resource-manager/apimanagement/2021-08-01/diagnostic/constants.go index b75c24b4d61..cde4ab74afa 100644 --- a/resource-manager/apimanagement/2021-08-01/diagnostic/constants.go +++ b/resource-manager/apimanagement/2021-08-01/diagnostic/constants.go @@ -1,6 +1,10 @@ package diagnostic -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -17,6 +21,19 @@ func PossibleValuesForAlwaysLog() []string { } } +func (s *AlwaysLog) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAlwaysLog(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAlwaysLog(input string) (*AlwaysLog, error) { vals := map[string]AlwaysLog{ "allerrors": AlwaysLogAllErrors, @@ -44,6 +61,19 @@ func PossibleValuesForDataMaskingMode() []string { } } +func (s *DataMaskingMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDataMaskingMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDataMaskingMode(input string) (*DataMaskingMode, error) { vals := map[string]DataMaskingMode{ "hide": DataMaskingModeHide, @@ -74,6 +104,19 @@ func PossibleValuesForHTTPCorrelationProtocol() []string { } } +func (s *HTTPCorrelationProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHTTPCorrelationProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseHTTPCorrelationProtocol(input string) (*HTTPCorrelationProtocol, error) { vals := map[string]HTTPCorrelationProtocol{ "legacy": HTTPCorrelationProtocolLegacy, @@ -103,6 +146,19 @@ func PossibleValuesForOperationNameFormat() []string { } } +func (s *OperationNameFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperationNameFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOperationNameFormat(input string) (*OperationNameFormat, error) { vals := map[string]OperationNameFormat{ "name": OperationNameFormatName, @@ -129,6 +185,19 @@ func PossibleValuesForSamplingType() []string { } } +func (s *SamplingType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSamplingType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSamplingType(input string) (*SamplingType, error) { vals := map[string]SamplingType{ "fixed": SamplingTypeFixed, @@ -158,6 +227,19 @@ func PossibleValuesForVerbosity() []string { } } +func (s *Verbosity) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVerbosity(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVerbosity(input string) (*Verbosity, error) { vals := map[string]Verbosity{ "error": VerbosityError, diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_createorupdate.go new file mode 100644 index 00000000000..7b559f7022a --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/diagnostic/method_createorupdate.go @@ -0,0 +1,85 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c DiagnosticClient) CreateOrUpdate(ctx context.Context, id DiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_createorupdate_autorest.go deleted file mode 100644 index b4c6a433f43..00000000000 --- a/resource-manager/apimanagement/2021-08-01/diagnostic/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package diagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c DiagnosticClient) CreateOrUpdate(ctx context.Context, id DiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c DiagnosticClient) preparerForCreateOrUpdate(ctx context.Context, id DiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_delete.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_delete.go new file mode 100644 index 00000000000..3cd08df2cd9 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/diagnostic/method_delete.go @@ -0,0 +1,76 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c DiagnosticClient) Delete(ctx context.Context, id DiagnosticId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_delete_autorest.go deleted file mode 100644 index e91965ee97f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/diagnostic/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package diagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c DiagnosticClient) Delete(ctx context.Context, id DiagnosticId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c DiagnosticClient) preparerForDelete(ctx context.Context, id DiagnosticId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_get.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_get.go new file mode 100644 index 00000000000..efc4cc74089 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/diagnostic/method_get.go @@ -0,0 +1,51 @@ +package diagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +// Get ... +func (c DiagnosticClient) Get(ctx context.Context, id DiagnosticId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_get_autorest.go deleted file mode 100644 index c5725fba3fd..00000000000 --- a/resource-manager/apimanagement/2021-08-01/diagnostic/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package diagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -// Get ... -func (c DiagnosticClient) Get(ctx context.Context, id DiagnosticId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c DiagnosticClient) preparerForGet(ctx context.Context, id DiagnosticId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_getentitytag.go new file mode 100644 index 00000000000..8be53cb6cbf --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/diagnostic/method_getentitytag.go @@ -0,0 +1,46 @@ +package diagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c DiagnosticClient) GetEntityTag(ctx context.Context, id DiagnosticId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_getentitytag_autorest.go deleted file mode 100644 index f06e74665d8..00000000000 --- a/resource-manager/apimanagement/2021-08-01/diagnostic/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package diagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c DiagnosticClient) GetEntityTag(ctx context.Context, id DiagnosticId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c DiagnosticClient) preparerForGetEntityTag(ctx context.Context, id DiagnosticId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_listbyservice.go new file mode 100644 index 00000000000..591d81877f4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/diagnostic/method_listbyservice.go @@ -0,0 +1,125 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DiagnosticContract +} + +type ListByServiceCompleteResult struct { + Items []DiagnosticContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c DiagnosticClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/diagnostics", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DiagnosticContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c DiagnosticClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DiagnosticContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DiagnosticClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate DiagnosticContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]DiagnosticContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_listbyservice_autorest.go deleted file mode 100644 index f02ef63c2c4..00000000000 --- a/resource-manager/apimanagement/2021-08-01/diagnostic/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package diagnostic - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]DiagnosticContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []DiagnosticContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c DiagnosticClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c DiagnosticClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/diagnostics", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c DiagnosticClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []DiagnosticContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c DiagnosticClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DiagnosticContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DiagnosticClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate DiagnosticContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]DiagnosticContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_update.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_update.go new file mode 100644 index 00000000000..cc36660c9e8 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/diagnostic/method_update.go @@ -0,0 +1,84 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c DiagnosticClient) Update(ctx context.Context, id DiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/diagnostic/method_update_autorest.go deleted file mode 100644 index f0c0c3763a8..00000000000 --- a/resource-manager/apimanagement/2021-08-01/diagnostic/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package diagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c DiagnosticClient) Update(ctx context.Context, id DiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c DiagnosticClient) preparerForUpdate(ctx context.Context, id DiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplate/client.go b/resource-manager/apimanagement/2021-08-01/emailtemplate/client.go index fcf62feaf0d..b615036a9e1 100644 --- a/resource-manager/apimanagement/2021-08-01/emailtemplate/client.go +++ b/resource-manager/apimanagement/2021-08-01/emailtemplate/client.go @@ -1,18 +1,26 @@ package emailtemplate -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type EmailTemplateClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewEmailTemplateClientWithBaseURI(endpoint string) EmailTemplateClient { - return EmailTemplateClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewEmailTemplateClientWithBaseURI(api sdkEnv.Api) (*EmailTemplateClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "emailtemplate", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating EmailTemplateClient: %+v", err) } + + return &EmailTemplateClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplate/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/emailtemplate/method_listbyservice.go new file mode 100644 index 00000000000..ece5fedb586 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/emailtemplate/method_listbyservice.go @@ -0,0 +1,125 @@ +package emailtemplate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]EmailTemplateContract +} + +type ListByServiceCompleteResult struct { + Items []EmailTemplateContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c EmailTemplateClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/templates", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]EmailTemplateContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c EmailTemplateClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, EmailTemplateContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c EmailTemplateClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate EmailTemplateContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]EmailTemplateContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplate/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/emailtemplate/method_listbyservice_autorest.go deleted file mode 100644 index 69b66381ca2..00000000000 --- a/resource-manager/apimanagement/2021-08-01/emailtemplate/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package emailtemplate - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]EmailTemplateContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []EmailTemplateContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c EmailTemplateClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c EmailTemplateClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/templates", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c EmailTemplateClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c EmailTemplateClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []EmailTemplateContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c EmailTemplateClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, EmailTemplateContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c EmailTemplateClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate EmailTemplateContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]EmailTemplateContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/client.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/client.go index 9794f3dc9e2..78c7f6573ce 100644 --- a/resource-manager/apimanagement/2021-08-01/emailtemplates/client.go +++ b/resource-manager/apimanagement/2021-08-01/emailtemplates/client.go @@ -1,18 +1,26 @@ package emailtemplates -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type EmailTemplatesClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewEmailTemplatesClientWithBaseURI(endpoint string) EmailTemplatesClient { - return EmailTemplatesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewEmailTemplatesClientWithBaseURI(api sdkEnv.Api) (*EmailTemplatesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "emailtemplates", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating EmailTemplatesClient: %+v", err) } + + return &EmailTemplatesClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/constants.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/constants.go index 178c1c73651..19dadfefea4 100644 --- a/resource-manager/apimanagement/2021-08-01/emailtemplates/constants.go +++ b/resource-manager/apimanagement/2021-08-01/emailtemplates/constants.go @@ -1,6 +1,10 @@ package emailtemplates -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -43,6 +47,19 @@ func PossibleValuesForTemplateName() []string { } } +func (s *TemplateName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTemplateName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseTemplateName(input string) (*TemplateName, error) { vals := map[string]TemplateName{ "accountcloseddeveloper": TemplateNameAccountClosedDeveloper, diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatecreateorupdate.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatecreateorupdate.go new file mode 100644 index 00000000000..80154b944bc --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatecreateorupdate.go @@ -0,0 +1,85 @@ +package emailtemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EmailTemplateContract +} + +type EmailTemplateCreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultEmailTemplateCreateOrUpdateOperationOptions() EmailTemplateCreateOrUpdateOperationOptions { + return EmailTemplateCreateOrUpdateOperationOptions{} +} + +func (o EmailTemplateCreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o EmailTemplateCreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o EmailTemplateCreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// EmailTemplateCreateOrUpdate ... +func (c EmailTemplatesClient) EmailTemplateCreateOrUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateCreateOrUpdateOperationOptions) (result EmailTemplateCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatecreateorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatecreateorupdate_autorest.go deleted file mode 100644 index 3a2c54ff109..00000000000 --- a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatecreateorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package emailtemplates - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EmailTemplateCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *EmailTemplateContract -} - -type EmailTemplateCreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultEmailTemplateCreateOrUpdateOperationOptions() EmailTemplateCreateOrUpdateOperationOptions { - return EmailTemplateCreateOrUpdateOperationOptions{} -} - -func (o EmailTemplateCreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o EmailTemplateCreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// EmailTemplateCreateOrUpdate ... -func (c EmailTemplatesClient) EmailTemplateCreateOrUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateCreateOrUpdateOperationOptions) (result EmailTemplateCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForEmailTemplateCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEmailTemplateCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEmailTemplateCreateOrUpdate prepares the EmailTemplateCreateOrUpdate request. -func (c EmailTemplatesClient) preparerForEmailTemplateCreateOrUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateCreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEmailTemplateCreateOrUpdate handles the response to the EmailTemplateCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c EmailTemplatesClient) responderForEmailTemplateCreateOrUpdate(resp *http.Response) (result EmailTemplateCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatedelete.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatedelete.go new file mode 100644 index 00000000000..0edd892ed23 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatedelete.go @@ -0,0 +1,76 @@ +package emailtemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type EmailTemplateDeleteOperationOptions struct { + IfMatch *string +} + +func DefaultEmailTemplateDeleteOperationOptions() EmailTemplateDeleteOperationOptions { + return EmailTemplateDeleteOperationOptions{} +} + +func (o EmailTemplateDeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o EmailTemplateDeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o EmailTemplateDeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// EmailTemplateDelete ... +func (c EmailTemplatesClient) EmailTemplateDelete(ctx context.Context, id TemplateId, options EmailTemplateDeleteOperationOptions) (result EmailTemplateDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatedelete_autorest.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatedelete_autorest.go deleted file mode 100644 index ec2f991850a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplatedelete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package emailtemplates - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EmailTemplateDeleteOperationResponse struct { - HttpResponse *http.Response -} - -type EmailTemplateDeleteOperationOptions struct { - IfMatch *string -} - -func DefaultEmailTemplateDeleteOperationOptions() EmailTemplateDeleteOperationOptions { - return EmailTemplateDeleteOperationOptions{} -} - -func (o EmailTemplateDeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o EmailTemplateDeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// EmailTemplateDelete ... -func (c EmailTemplatesClient) EmailTemplateDelete(ctx context.Context, id TemplateId, options EmailTemplateDeleteOperationOptions) (result EmailTemplateDeleteOperationResponse, err error) { - req, err := c.preparerForEmailTemplateDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEmailTemplateDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEmailTemplateDelete prepares the EmailTemplateDelete request. -func (c EmailTemplatesClient) preparerForEmailTemplateDelete(ctx context.Context, id TemplateId, options EmailTemplateDeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEmailTemplateDelete handles the response to the EmailTemplateDelete request. The method always -// closes the http.Response Body. -func (c EmailTemplatesClient) responderForEmailTemplateDelete(resp *http.Response) (result EmailTemplateDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateget.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateget.go new file mode 100644 index 00000000000..91bd3f56c3a --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateget.go @@ -0,0 +1,51 @@ +package emailtemplates + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EmailTemplateContract +} + +// EmailTemplateGet ... +func (c EmailTemplatesClient) EmailTemplateGet(ctx context.Context, id TemplateId) (result EmailTemplateGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateget_autorest.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateget_autorest.go deleted file mode 100644 index 42f4ac52fc2..00000000000 --- a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package emailtemplates - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EmailTemplateGetOperationResponse struct { - HttpResponse *http.Response - Model *EmailTemplateContract -} - -// EmailTemplateGet ... -func (c EmailTemplatesClient) EmailTemplateGet(ctx context.Context, id TemplateId) (result EmailTemplateGetOperationResponse, err error) { - req, err := c.preparerForEmailTemplateGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEmailTemplateGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEmailTemplateGet prepares the EmailTemplateGet request. -func (c EmailTemplatesClient) preparerForEmailTemplateGet(ctx context.Context, id TemplateId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEmailTemplateGet handles the response to the EmailTemplateGet request. The method always -// closes the http.Response Body. -func (c EmailTemplatesClient) responderForEmailTemplateGet(resp *http.Response) (result EmailTemplateGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplategetentitytag.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplategetentitytag.go new file mode 100644 index 00000000000..fd7e5616549 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplategetentitytag.go @@ -0,0 +1,46 @@ +package emailtemplates + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateGetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// EmailTemplateGetEntityTag ... +func (c EmailTemplatesClient) EmailTemplateGetEntityTag(ctx context.Context, id TemplateId) (result EmailTemplateGetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplategetentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplategetentitytag_autorest.go deleted file mode 100644 index 81853d22c98..00000000000 --- a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplategetentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package emailtemplates - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EmailTemplateGetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// EmailTemplateGetEntityTag ... -func (c EmailTemplatesClient) EmailTemplateGetEntityTag(ctx context.Context, id TemplateId) (result EmailTemplateGetEntityTagOperationResponse, err error) { - req, err := c.preparerForEmailTemplateGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEmailTemplateGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEmailTemplateGetEntityTag prepares the EmailTemplateGetEntityTag request. -func (c EmailTemplatesClient) preparerForEmailTemplateGetEntityTag(ctx context.Context, id TemplateId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEmailTemplateGetEntityTag handles the response to the EmailTemplateGetEntityTag request. The method always -// closes the http.Response Body. -func (c EmailTemplatesClient) responderForEmailTemplateGetEntityTag(resp *http.Response) (result EmailTemplateGetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateupdate.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateupdate.go new file mode 100644 index 00000000000..5e5c6f703f2 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateupdate.go @@ -0,0 +1,84 @@ +package emailtemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EmailTemplateContract +} + +type EmailTemplateUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultEmailTemplateUpdateOperationOptions() EmailTemplateUpdateOperationOptions { + return EmailTemplateUpdateOperationOptions{} +} + +func (o EmailTemplateUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o EmailTemplateUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o EmailTemplateUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// EmailTemplateUpdate ... +func (c EmailTemplatesClient) EmailTemplateUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateUpdateOperationOptions) (result EmailTemplateUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateupdate_autorest.go deleted file mode 100644 index c53ed3c1cf7..00000000000 --- a/resource-manager/apimanagement/2021-08-01/emailtemplates/method_emailtemplateupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package emailtemplates - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EmailTemplateUpdateOperationResponse struct { - HttpResponse *http.Response - Model *EmailTemplateContract -} - -type EmailTemplateUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultEmailTemplateUpdateOperationOptions() EmailTemplateUpdateOperationOptions { - return EmailTemplateUpdateOperationOptions{} -} - -func (o EmailTemplateUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o EmailTemplateUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// EmailTemplateUpdate ... -func (c EmailTemplatesClient) EmailTemplateUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateUpdateOperationOptions) (result EmailTemplateUpdateOperationResponse, err error) { - req, err := c.preparerForEmailTemplateUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEmailTemplateUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEmailTemplateUpdate prepares the EmailTemplateUpdate request. -func (c EmailTemplatesClient) preparerForEmailTemplateUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEmailTemplateUpdate handles the response to the EmailTemplateUpdate request. The method always -// closes the http.Response Body. -func (c EmailTemplatesClient) responderForEmailTemplateUpdate(resp *http.Response) (result EmailTemplateUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/client.go b/resource-manager/apimanagement/2021-08-01/gateway/client.go index a88c9cdaf70..52986157195 100644 --- a/resource-manager/apimanagement/2021-08-01/gateway/client.go +++ b/resource-manager/apimanagement/2021-08-01/gateway/client.go @@ -1,18 +1,26 @@ package gateway -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayClientWithBaseURI(endpoint string) GatewayClient { - return GatewayClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayClientWithBaseURI(api sdkEnv.Api) (*GatewayClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gateway", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayClient: %+v", err) } + + return &GatewayClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/gateway/method_createorupdate.go new file mode 100644 index 00000000000..b166d062bf3 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gateway/method_createorupdate.go @@ -0,0 +1,85 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GatewayClient) CreateOrUpdate(ctx context.Context, id GatewayId, input GatewayContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/gateway/method_createorupdate_autorest.go deleted file mode 100644 index 6dd5cff75d6..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gateway/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package gateway - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *GatewayContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c GatewayClient) CreateOrUpdate(ctx context.Context, id GatewayId, input GatewayContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GatewayClient) preparerForCreateOrUpdate(ctx context.Context, id GatewayId, input GatewayContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_delete.go b/resource-manager/apimanagement/2021-08-01/gateway/method_delete.go new file mode 100644 index 00000000000..34c8698ad34 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gateway/method_delete.go @@ -0,0 +1,76 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GatewayClient) Delete(ctx context.Context, id GatewayId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/gateway/method_delete_autorest.go deleted file mode 100644 index 1f3f99da15b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gateway/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package gateway - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c GatewayClient) Delete(ctx context.Context, id GatewayId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GatewayClient) preparerForDelete(ctx context.Context, id GatewayId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_get.go b/resource-manager/apimanagement/2021-08-01/gateway/method_get.go new file mode 100644 index 00000000000..73393157e02 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gateway/method_get.go @@ -0,0 +1,51 @@ +package gateway + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayContract +} + +// Get ... +func (c GatewayClient) Get(ctx context.Context, id GatewayId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/gateway/method_get_autorest.go deleted file mode 100644 index 516262b26c0..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gateway/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package gateway - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *GatewayContract -} - -// Get ... -func (c GatewayClient) Get(ctx context.Context, id GatewayId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c GatewayClient) preparerForGet(ctx context.Context, id GatewayId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/gateway/method_getentitytag.go new file mode 100644 index 00000000000..34c8cd8439b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gateway/method_getentitytag.go @@ -0,0 +1,46 @@ +package gateway + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayClient) GetEntityTag(ctx context.Context, id GatewayId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/gateway/method_getentitytag_autorest.go deleted file mode 100644 index 023b4dd2c1b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gateway/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package gateway - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GatewayClient) GetEntityTag(ctx context.Context, id GatewayId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GatewayClient) preparerForGetEntityTag(ctx context.Context, id GatewayId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/gateway/method_listbyservice.go new file mode 100644 index 00000000000..2e1953f23da --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gateway/method_listbyservice.go @@ -0,0 +1,125 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayContract +} + +type ListByServiceCompleteResult struct { + Items []GatewayContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/gateways", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GatewayContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate GatewayContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GatewayContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/gateway/method_listbyservice_autorest.go deleted file mode 100644 index 6bef69b64f7..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gateway/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package gateway - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]GatewayContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []GatewayContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c GatewayClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c GatewayClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/gateways", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c GatewayClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []GatewayContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c GatewayClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GatewayClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate GatewayContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]GatewayContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_update.go b/resource-manager/apimanagement/2021-08-01/gateway/method_update.go new file mode 100644 index 00000000000..fcf2126f5bd --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gateway/method_update.go @@ -0,0 +1,84 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c GatewayClient) Update(ctx context.Context, id GatewayId, input GatewayContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gateway/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/gateway/method_update_autorest.go deleted file mode 100644 index f307a2b614f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gateway/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package gateway - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *GatewayContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c GatewayClient) Update(ctx context.Context, id GatewayId, input GatewayContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c GatewayClient) preparerForUpdate(ctx context.Context, id GatewayId, input GatewayContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/client.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/client.go index 46a46094cd5..b0d3e6d9914 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewayapi/client.go +++ b/resource-manager/apimanagement/2021-08-01/gatewayapi/client.go @@ -1,18 +1,26 @@ package gatewayapi -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayApiClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayApiClientWithBaseURI(endpoint string) GatewayApiClient { - return GatewayApiClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayApiClientWithBaseURI(api sdkEnv.Api) (*GatewayApiClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewayapi", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayApiClient: %+v", err) } + + return &GatewayApiClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/constants.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/constants.go index 0be8c860d66..0da8f569039 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewayapi/constants.go +++ b/resource-manager/apimanagement/2021-08-01/gatewayapi/constants.go @@ -1,6 +1,10 @@ package gatewayapi -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -85,6 +115,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, @@ -113,6 +156,19 @@ func PossibleValuesForProvisioningState() []string { } } +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ "created": ProvisioningStateCreated, @@ -142,6 +198,19 @@ func PossibleValuesForVersioningScheme() []string { } } +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVersioningScheme(input string) (*VersioningScheme, error) { vals := map[string]VersioningScheme{ "header": VersioningSchemeHeader, diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_createorupdate.go new file mode 100644 index 00000000000..8fd635de876 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_createorupdate.go @@ -0,0 +1,56 @@ +package gatewayapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +// CreateOrUpdate ... +func (c GatewayApiClient) CreateOrUpdate(ctx context.Context, id GatewayApiId, input AssociationContract) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_createorupdate_autorest.go deleted file mode 100644 index e8e7ed2c7aa..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package gatewayapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiContract -} - -// CreateOrUpdate ... -func (c GatewayApiClient) CreateOrUpdate(ctx context.Context, id GatewayApiId, input AssociationContract) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GatewayApiClient) preparerForCreateOrUpdate(ctx context.Context, id GatewayApiId, input AssociationContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GatewayApiClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_delete.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_delete.go new file mode 100644 index 00000000000..293176f784a --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_delete.go @@ -0,0 +1,47 @@ +package gatewayapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c GatewayApiClient) Delete(ctx context.Context, id GatewayApiId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_delete_autorest.go deleted file mode 100644 index 5da91051687..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package gatewayapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c GatewayApiClient) Delete(ctx context.Context, id GatewayApiId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GatewayApiClient) preparerForDelete(ctx context.Context, id GatewayApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GatewayApiClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_getentitytag.go new file mode 100644 index 00000000000..e14c0b61f72 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_getentitytag.go @@ -0,0 +1,46 @@ +package gatewayapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayApiClient) GetEntityTag(ctx context.Context, id GatewayApiId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_getentitytag_autorest.go deleted file mode 100644 index 9d658fd84a6..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package gatewayapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GatewayApiClient) GetEntityTag(ctx context.Context, id GatewayApiId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GatewayApiClient) preparerForGetEntityTag(ctx context.Context, id GatewayApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GatewayApiClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_listbyservice.go new file mode 100644 index 00000000000..478f87c8195 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_listbyservice.go @@ -0,0 +1,125 @@ +package gatewayapi + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiContract +} + +type ListByServiceCompleteResult struct { + Items []ApiContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayApiClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apis", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayApiClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayApiClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate ApiContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/method_listbyservice_autorest.go deleted file mode 100644 index d219bb643d7..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewayapi/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package gatewayapi - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ApiContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c GatewayApiClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c GatewayApiClient) preparerForListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/apis", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c GatewayApiClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c GatewayApiClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ApiContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c GatewayApiClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GatewayApiClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate ApiContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ApiContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/client.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/client.go index 05f22b3b215..889bdd77712 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/client.go +++ b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/client.go @@ -1,18 +1,26 @@ package gatewaycertificateauthority -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayCertificateAuthorityClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayCertificateAuthorityClientWithBaseURI(endpoint string) GatewayCertificateAuthorityClient { - return GatewayCertificateAuthorityClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayCertificateAuthorityClientWithBaseURI(api sdkEnv.Api) (*GatewayCertificateAuthorityClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewaycertificateauthority", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayCertificateAuthorityClient: %+v", err) } + + return &GatewayCertificateAuthorityClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_createorupdate.go new file mode 100644 index 00000000000..a982aaf94c4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_createorupdate.go @@ -0,0 +1,85 @@ +package gatewaycertificateauthority + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayCertificateAuthorityContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GatewayCertificateAuthorityClient) CreateOrUpdate(ctx context.Context, id CertificateAuthorityId, input GatewayCertificateAuthorityContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_createorupdate_autorest.go deleted file mode 100644 index 4e7230468d3..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package gatewaycertificateauthority - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *GatewayCertificateAuthorityContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c GatewayCertificateAuthorityClient) CreateOrUpdate(ctx context.Context, id CertificateAuthorityId, input GatewayCertificateAuthorityContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GatewayCertificateAuthorityClient) preparerForCreateOrUpdate(ctx context.Context, id CertificateAuthorityId, input GatewayCertificateAuthorityContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GatewayCertificateAuthorityClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_delete.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_delete.go new file mode 100644 index 00000000000..ee1deb63010 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_delete.go @@ -0,0 +1,76 @@ +package gatewaycertificateauthority + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GatewayCertificateAuthorityClient) Delete(ctx context.Context, id CertificateAuthorityId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_delete_autorest.go deleted file mode 100644 index 0f9df6ed8a0..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package gatewaycertificateauthority - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c GatewayCertificateAuthorityClient) Delete(ctx context.Context, id CertificateAuthorityId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GatewayCertificateAuthorityClient) preparerForDelete(ctx context.Context, id CertificateAuthorityId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GatewayCertificateAuthorityClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_get.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_get.go new file mode 100644 index 00000000000..12ff864df7c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_get.go @@ -0,0 +1,51 @@ +package gatewaycertificateauthority + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayCertificateAuthorityContract +} + +// Get ... +func (c GatewayCertificateAuthorityClient) Get(ctx context.Context, id CertificateAuthorityId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_get_autorest.go deleted file mode 100644 index c858b3b46b5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package gatewaycertificateauthority - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *GatewayCertificateAuthorityContract -} - -// Get ... -func (c GatewayCertificateAuthorityClient) Get(ctx context.Context, id CertificateAuthorityId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c GatewayCertificateAuthorityClient) preparerForGet(ctx context.Context, id CertificateAuthorityId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c GatewayCertificateAuthorityClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_getentitytag.go new file mode 100644 index 00000000000..cc382dbb6d8 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_getentitytag.go @@ -0,0 +1,46 @@ +package gatewaycertificateauthority + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayCertificateAuthorityClient) GetEntityTag(ctx context.Context, id CertificateAuthorityId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_getentitytag_autorest.go deleted file mode 100644 index 642eee2277d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package gatewaycertificateauthority - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GatewayCertificateAuthorityClient) GetEntityTag(ctx context.Context, id CertificateAuthorityId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GatewayCertificateAuthorityClient) preparerForGetEntityTag(ctx context.Context, id CertificateAuthorityId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GatewayCertificateAuthorityClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_listbyservice.go new file mode 100644 index 00000000000..3b24a4a53a6 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_listbyservice.go @@ -0,0 +1,125 @@ +package gatewaycertificateauthority + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayCertificateAuthorityContract +} + +type ListByServiceCompleteResult struct { + Items []GatewayCertificateAuthorityContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayCertificateAuthorityClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/certificateAuthorities", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GatewayCertificateAuthorityContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayCertificateAuthorityClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayCertificateAuthorityContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayCertificateAuthorityClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate GatewayCertificateAuthorityContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GatewayCertificateAuthorityContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_listbyservice_autorest.go deleted file mode 100644 index e629cd90912..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package gatewaycertificateauthority - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]GatewayCertificateAuthorityContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []GatewayCertificateAuthorityContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c GatewayCertificateAuthorityClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c GatewayCertificateAuthorityClient) preparerForListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/certificateAuthorities", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c GatewayCertificateAuthorityClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c GatewayCertificateAuthorityClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []GatewayCertificateAuthorityContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c GatewayCertificateAuthorityClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayCertificateAuthorityContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GatewayCertificateAuthorityClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate GatewayCertificateAuthorityContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]GatewayCertificateAuthorityContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/client.go b/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/client.go index 5eef6f835aa..85d00532dc6 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/client.go +++ b/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/client.go @@ -1,18 +1,26 @@ package gatewaygeneratetoken -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayGenerateTokenClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayGenerateTokenClientWithBaseURI(endpoint string) GatewayGenerateTokenClient { - return GatewayGenerateTokenClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayGenerateTokenClientWithBaseURI(api sdkEnv.Api) (*GatewayGenerateTokenClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewaygeneratetoken", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayGenerateTokenClient: %+v", err) } + + return &GatewayGenerateTokenClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/constants.go b/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/constants.go index 2b5b29d0556..23e4c225a32 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/constants.go +++ b/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/constants.go @@ -1,6 +1,10 @@ package gatewaygeneratetoken -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForKeyType() []string { } } +func (s *KeyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKeyType(input string) (*KeyType, error) { vals := map[string]KeyType{ "primary": KeyTypePrimary, diff --git a/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken.go b/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken.go new file mode 100644 index 00000000000..3c75500bfd1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken.go @@ -0,0 +1,56 @@ +package gatewaygeneratetoken + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayGenerateTokenOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayTokenContract +} + +// GatewayGenerateToken ... +func (c GatewayGenerateTokenClient) GatewayGenerateToken(ctx context.Context, id GatewayId, input GatewayTokenRequestContract) (result GatewayGenerateTokenOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateToken", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken_autorest.go deleted file mode 100644 index cec0cc96400..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package gatewaygeneratetoken - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GatewayGenerateTokenOperationResponse struct { - HttpResponse *http.Response - Model *GatewayTokenContract -} - -// GatewayGenerateToken ... -func (c GatewayGenerateTokenClient) GatewayGenerateToken(ctx context.Context, id GatewayId, input GatewayTokenRequestContract) (result GatewayGenerateTokenOperationResponse, err error) { - req, err := c.preparerForGatewayGenerateToken(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaygeneratetoken.GatewayGenerateTokenClient", "GatewayGenerateToken", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaygeneratetoken.GatewayGenerateTokenClient", "GatewayGenerateToken", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGatewayGenerateToken(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaygeneratetoken.GatewayGenerateTokenClient", "GatewayGenerateToken", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGatewayGenerateToken prepares the GatewayGenerateToken request. -func (c GatewayGenerateTokenClient) preparerForGatewayGenerateToken(ctx context.Context, id GatewayId, input GatewayTokenRequestContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/generateToken", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGatewayGenerateToken handles the response to the GatewayGenerateToken request. The method always -// closes the http.Response Body. -func (c GatewayGenerateTokenClient) responderForGatewayGenerateToken(resp *http.Response) (result GatewayGenerateTokenOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/client.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/client.go index d6e83f1d02e..44a535d1be6 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/client.go +++ b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/client.go @@ -1,18 +1,26 @@ package gatewayhostnameconfiguration -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayHostnameConfigurationClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayHostnameConfigurationClientWithBaseURI(endpoint string) GatewayHostnameConfigurationClient { - return GatewayHostnameConfigurationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayHostnameConfigurationClientWithBaseURI(api sdkEnv.Api) (*GatewayHostnameConfigurationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewayhostnameconfiguration", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayHostnameConfigurationClient: %+v", err) } + + return &GatewayHostnameConfigurationClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_createorupdate.go new file mode 100644 index 00000000000..1a362be1c96 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_createorupdate.go @@ -0,0 +1,85 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayHostnameConfigurationContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GatewayHostnameConfigurationClient) CreateOrUpdate(ctx context.Context, id HostnameConfigurationId, input GatewayHostnameConfigurationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_createorupdate_autorest.go deleted file mode 100644 index 1636e17ebb1..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package gatewayhostnameconfiguration - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *GatewayHostnameConfigurationContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c GatewayHostnameConfigurationClient) CreateOrUpdate(ctx context.Context, id HostnameConfigurationId, input GatewayHostnameConfigurationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GatewayHostnameConfigurationClient) preparerForCreateOrUpdate(ctx context.Context, id HostnameConfigurationId, input GatewayHostnameConfigurationContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GatewayHostnameConfigurationClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_delete.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_delete.go new file mode 100644 index 00000000000..d36e0d55e20 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_delete.go @@ -0,0 +1,76 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GatewayHostnameConfigurationClient) Delete(ctx context.Context, id HostnameConfigurationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_delete_autorest.go deleted file mode 100644 index 64f4fa809d7..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package gatewayhostnameconfiguration - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c GatewayHostnameConfigurationClient) Delete(ctx context.Context, id HostnameConfigurationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GatewayHostnameConfigurationClient) preparerForDelete(ctx context.Context, id HostnameConfigurationId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GatewayHostnameConfigurationClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_get.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_get.go new file mode 100644 index 00000000000..f1f5ec6b270 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_get.go @@ -0,0 +1,51 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayHostnameConfigurationContract +} + +// Get ... +func (c GatewayHostnameConfigurationClient) Get(ctx context.Context, id HostnameConfigurationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_get_autorest.go deleted file mode 100644 index be5cbec23ca..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package gatewayhostnameconfiguration - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *GatewayHostnameConfigurationContract -} - -// Get ... -func (c GatewayHostnameConfigurationClient) Get(ctx context.Context, id HostnameConfigurationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c GatewayHostnameConfigurationClient) preparerForGet(ctx context.Context, id HostnameConfigurationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c GatewayHostnameConfigurationClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_getentitytag.go new file mode 100644 index 00000000000..76b08b4e076 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_getentitytag.go @@ -0,0 +1,46 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayHostnameConfigurationClient) GetEntityTag(ctx context.Context, id HostnameConfigurationId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_getentitytag_autorest.go deleted file mode 100644 index 424ecbb64c0..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package gatewayhostnameconfiguration - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GatewayHostnameConfigurationClient) GetEntityTag(ctx context.Context, id HostnameConfigurationId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GatewayHostnameConfigurationClient) preparerForGetEntityTag(ctx context.Context, id HostnameConfigurationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GatewayHostnameConfigurationClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_listbyservice.go new file mode 100644 index 00000000000..6842b2c14d3 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_listbyservice.go @@ -0,0 +1,125 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayHostnameConfigurationContract +} + +type ListByServiceCompleteResult struct { + Items []GatewayHostnameConfigurationContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayHostnameConfigurationClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/hostnameConfigurations", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GatewayHostnameConfigurationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayHostnameConfigurationClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayHostnameConfigurationContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayHostnameConfigurationClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate GatewayHostnameConfigurationContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GatewayHostnameConfigurationContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_listbyservice_autorest.go deleted file mode 100644 index ce7ed9c80f0..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package gatewayhostnameconfiguration - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]GatewayHostnameConfigurationContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []GatewayHostnameConfigurationContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c GatewayHostnameConfigurationClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c GatewayHostnameConfigurationClient) preparerForListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/hostnameConfigurations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c GatewayHostnameConfigurationClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c GatewayHostnameConfigurationClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []GatewayHostnameConfigurationContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c GatewayHostnameConfigurationClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayHostnameConfigurationContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GatewayHostnameConfigurationClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate GatewayHostnameConfigurationContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]GatewayHostnameConfigurationContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/client.go b/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/client.go index 01978a51eaa..3da598944dd 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/client.go +++ b/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/client.go @@ -1,18 +1,26 @@ package gatewaylistkeys -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayListKeysClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayListKeysClientWithBaseURI(endpoint string) GatewayListKeysClient { - return GatewayListKeysClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayListKeysClientWithBaseURI(api sdkEnv.Api) (*GatewayListKeysClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewaylistkeys", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayListKeysClient: %+v", err) } + + return &GatewayListKeysClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/method_gatewaylistkeys.go b/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/method_gatewaylistkeys.go new file mode 100644 index 00000000000..8fc1104a3b3 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/method_gatewaylistkeys.go @@ -0,0 +1,52 @@ +package gatewaylistkeys + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayListKeysOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayKeysContract +} + +// GatewayListKeys ... +func (c GatewayListKeysClient) GatewayListKeys(ctx context.Context, id GatewayId) (result GatewayListKeysOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listKeys", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/method_gatewaylistkeys_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/method_gatewaylistkeys_autorest.go deleted file mode 100644 index 3ad468fa9f9..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/method_gatewaylistkeys_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package gatewaylistkeys - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GatewayListKeysOperationResponse struct { - HttpResponse *http.Response - Model *GatewayKeysContract -} - -// GatewayListKeys ... -func (c GatewayListKeysClient) GatewayListKeys(ctx context.Context, id GatewayId) (result GatewayListKeysOperationResponse, err error) { - req, err := c.preparerForGatewayListKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaylistkeys.GatewayListKeysClient", "GatewayListKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaylistkeys.GatewayListKeysClient", "GatewayListKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGatewayListKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaylistkeys.GatewayListKeysClient", "GatewayListKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGatewayListKeys prepares the GatewayListKeys request. -func (c GatewayListKeysClient) preparerForGatewayListKeys(ctx context.Context, id GatewayId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGatewayListKeys handles the response to the GatewayListKeys request. The method always -// closes the http.Response Body. -func (c GatewayListKeysClient) responderForGatewayListKeys(resp *http.Response) (result GatewayListKeysOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/client.go b/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/client.go index 68eee704676..b937a665eb7 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/client.go +++ b/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/client.go @@ -1,18 +1,26 @@ package gatewayregeneratekey -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayRegenerateKeyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayRegenerateKeyClientWithBaseURI(endpoint string) GatewayRegenerateKeyClient { - return GatewayRegenerateKeyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayRegenerateKeyClientWithBaseURI(api sdkEnv.Api) (*GatewayRegenerateKeyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewayregeneratekey", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayRegenerateKeyClient: %+v", err) } + + return &GatewayRegenerateKeyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/constants.go b/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/constants.go index e69fb786bb4..f8762636760 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/constants.go +++ b/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/constants.go @@ -1,6 +1,10 @@ package gatewayregeneratekey -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForKeyType() []string { } } +func (s *KeyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKeyType(input string) (*KeyType, error) { vals := map[string]KeyType{ "primary": KeyTypePrimary, diff --git a/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/method_gatewayregeneratekey.go b/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/method_gatewayregeneratekey.go new file mode 100644 index 00000000000..8783e036af9 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/method_gatewayregeneratekey.go @@ -0,0 +1,51 @@ +package gatewayregeneratekey + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayRegenerateKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GatewayRegenerateKey ... +func (c GatewayRegenerateKeyClient) GatewayRegenerateKey(ctx context.Context, id GatewayId, input GatewayKeyRegenerationRequestContract) (result GatewayRegenerateKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/method_gatewayregeneratekey_autorest.go b/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/method_gatewayregeneratekey_autorest.go deleted file mode 100644 index 944a561ab8b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/method_gatewayregeneratekey_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package gatewayregeneratekey - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GatewayRegenerateKeyOperationResponse struct { - HttpResponse *http.Response -} - -// GatewayRegenerateKey ... -func (c GatewayRegenerateKeyClient) GatewayRegenerateKey(ctx context.Context, id GatewayId, input GatewayKeyRegenerationRequestContract) (result GatewayRegenerateKeyOperationResponse, err error) { - req, err := c.preparerForGatewayRegenerateKey(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayregeneratekey.GatewayRegenerateKeyClient", "GatewayRegenerateKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayregeneratekey.GatewayRegenerateKeyClient", "GatewayRegenerateKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGatewayRegenerateKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayregeneratekey.GatewayRegenerateKeyClient", "GatewayRegenerateKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGatewayRegenerateKey prepares the GatewayRegenerateKey request. -func (c GatewayRegenerateKeyClient) preparerForGatewayRegenerateKey(ctx context.Context, id GatewayId, input GatewayKeyRegenerationRequestContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGatewayRegenerateKey handles the response to the GatewayRegenerateKey request. The method always -// closes the http.Response Body. -func (c GatewayRegenerateKeyClient) responderForGatewayRegenerateKey(resp *http.Response) (result GatewayRegenerateKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/group/client.go b/resource-manager/apimanagement/2021-08-01/group/client.go index 78b8515c749..ceb8d93829f 100644 --- a/resource-manager/apimanagement/2021-08-01/group/client.go +++ b/resource-manager/apimanagement/2021-08-01/group/client.go @@ -1,18 +1,26 @@ package group -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GroupClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGroupClientWithBaseURI(endpoint string) GroupClient { - return GroupClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGroupClientWithBaseURI(api sdkEnv.Api) (*GroupClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "group", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GroupClient: %+v", err) } + + return &GroupClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/group/constants.go b/resource-manager/apimanagement/2021-08-01/group/constants.go index a4fc43f47e7..1cda5dadcaf 100644 --- a/resource-manager/apimanagement/2021-08-01/group/constants.go +++ b/resource-manager/apimanagement/2021-08-01/group/constants.go @@ -1,6 +1,10 @@ package group -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForGroupType() []string { } } +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGroupType(input string) (*GroupType, error) { vals := map[string]GroupType{ "custom": GroupTypeCustom, diff --git a/resource-manager/apimanagement/2021-08-01/group/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/group/method_createorupdate.go new file mode 100644 index 00000000000..c7c3873d667 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/group/method_createorupdate.go @@ -0,0 +1,85 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GroupClient) CreateOrUpdate(ctx context.Context, id GroupId, input GroupCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/group/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/group/method_createorupdate_autorest.go deleted file mode 100644 index 17bbc0cae9b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/group/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package group - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *GroupContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c GroupClient) CreateOrUpdate(ctx context.Context, id GroupId, input GroupCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GroupClient) preparerForCreateOrUpdate(ctx context.Context, id GroupId, input GroupCreateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/group/method_delete.go b/resource-manager/apimanagement/2021-08-01/group/method_delete.go new file mode 100644 index 00000000000..8bd332e45a2 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/group/method_delete.go @@ -0,0 +1,76 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GroupClient) Delete(ctx context.Context, id GroupId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/group/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/group/method_delete_autorest.go deleted file mode 100644 index 9abfbd05611..00000000000 --- a/resource-manager/apimanagement/2021-08-01/group/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package group - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c GroupClient) Delete(ctx context.Context, id GroupId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GroupClient) preparerForDelete(ctx context.Context, id GroupId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/group/method_get.go b/resource-manager/apimanagement/2021-08-01/group/method_get.go new file mode 100644 index 00000000000..4dbbc0759e2 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/group/method_get.go @@ -0,0 +1,51 @@ +package group + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +// Get ... +func (c GroupClient) Get(ctx context.Context, id GroupId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/group/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/group/method_get_autorest.go deleted file mode 100644 index bb3e3b2d619..00000000000 --- a/resource-manager/apimanagement/2021-08-01/group/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package group - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *GroupContract -} - -// Get ... -func (c GroupClient) Get(ctx context.Context, id GroupId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c GroupClient) preparerForGet(ctx context.Context, id GroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/group/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/group/method_getentitytag.go new file mode 100644 index 00000000000..e6ee5a9ba2d --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/group/method_getentitytag.go @@ -0,0 +1,46 @@ +package group + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GroupClient) GetEntityTag(ctx context.Context, id GroupId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/group/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/group/method_getentitytag_autorest.go deleted file mode 100644 index 3dca8de39a0..00000000000 --- a/resource-manager/apimanagement/2021-08-01/group/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package group - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GroupClient) GetEntityTag(ctx context.Context, id GroupId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GroupClient) preparerForGetEntityTag(ctx context.Context, id GroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/group/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/group/method_listbyservice.go new file mode 100644 index 00000000000..080778877db --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/group/method_listbyservice.go @@ -0,0 +1,125 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GroupContract +} + +type ListByServiceCompleteResult struct { + Items []GroupContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GroupClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/groups", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GroupContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GroupClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GroupClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate GroupContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GroupContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/group/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/group/method_listbyservice_autorest.go deleted file mode 100644 index f2981bb97a5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/group/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package group - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]GroupContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []GroupContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c GroupClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c GroupClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/groups", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c GroupClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []GroupContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c GroupClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GroupClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate GroupContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]GroupContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/group/method_update.go b/resource-manager/apimanagement/2021-08-01/group/method_update.go new file mode 100644 index 00000000000..8ef4191a0f2 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/group/method_update.go @@ -0,0 +1,84 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c GroupClient) Update(ctx context.Context, id GroupId, input GroupUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/group/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/group/method_update_autorest.go deleted file mode 100644 index 09760546a0e..00000000000 --- a/resource-manager/apimanagement/2021-08-01/group/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package group - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *GroupContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c GroupClient) Update(ctx context.Context, id GroupId, input GroupUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c GroupClient) preparerForUpdate(ctx context.Context, id GroupId, input GroupUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/client.go b/resource-manager/apimanagement/2021-08-01/groupuser/client.go index ab4bea57574..d1e443455e9 100644 --- a/resource-manager/apimanagement/2021-08-01/groupuser/client.go +++ b/resource-manager/apimanagement/2021-08-01/groupuser/client.go @@ -1,18 +1,26 @@ package groupuser -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GroupUserClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGroupUserClientWithBaseURI(endpoint string) GroupUserClient { - return GroupUserClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGroupUserClientWithBaseURI(api sdkEnv.Api) (*GroupUserClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "groupuser", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GroupUserClient: %+v", err) } + + return &GroupUserClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/constants.go b/resource-manager/apimanagement/2021-08-01/groupuser/constants.go index 4023a21458d..520579fefd7 100644 --- a/resource-manager/apimanagement/2021-08-01/groupuser/constants.go +++ b/resource-manager/apimanagement/2021-08-01/groupuser/constants.go @@ -1,6 +1,10 @@ package groupuser -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForGroupType() []string { } } +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGroupType(input string) (*GroupType, error) { vals := map[string]GroupType{ "custom": GroupTypeCustom, @@ -54,6 +71,19 @@ func PossibleValuesForUserState() []string { } } +func (s *UserState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUserState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUserState(input string) (*UserState, error) { vals := map[string]UserState{ "active": UserStateActive, diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/method_checkentityexists.go b/resource-manager/apimanagement/2021-08-01/groupuser/method_checkentityexists.go new file mode 100644 index 00000000000..ecf5ac1f37b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/groupuser/method_checkentityexists.go @@ -0,0 +1,46 @@ +package groupuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c GroupUserClient) CheckEntityExists(ctx context.Context, id GroupUserId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/method_checkentityexists_autorest.go b/resource-manager/apimanagement/2021-08-01/groupuser/method_checkentityexists_autorest.go deleted file mode 100644 index 6c318ef5a01..00000000000 --- a/resource-manager/apimanagement/2021-08-01/groupuser/method_checkentityexists_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package groupuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckEntityExistsOperationResponse struct { - HttpResponse *http.Response -} - -// CheckEntityExists ... -func (c GroupUserClient) CheckEntityExists(ctx context.Context, id GroupUserId) (result CheckEntityExistsOperationResponse, err error) { - req, err := c.preparerForCheckEntityExists(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "CheckEntityExists", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckEntityExists(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "CheckEntityExists", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckEntityExists prepares the CheckEntityExists request. -func (c GroupUserClient) preparerForCheckEntityExists(ctx context.Context, id GroupUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckEntityExists handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (c GroupUserClient) responderForCheckEntityExists(resp *http.Response) (result CheckEntityExistsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/method_create.go b/resource-manager/apimanagement/2021-08-01/groupuser/method_create.go new file mode 100644 index 00000000000..b13b301f403 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/groupuser/method_create.go @@ -0,0 +1,52 @@ +package groupuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +// Create ... +func (c GroupUserClient) Create(ctx context.Context, id GroupUserId) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/method_create_autorest.go b/resource-manager/apimanagement/2021-08-01/groupuser/method_create_autorest.go deleted file mode 100644 index bc34063331f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/groupuser/method_create_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package groupuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOperationResponse struct { - HttpResponse *http.Response - Model *UserContract -} - -// Create ... -func (c GroupUserClient) Create(ctx context.Context, id GroupUserId) (result CreateOperationResponse, err error) { - req, err := c.preparerForCreate(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Create", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Create", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreate prepares the Create request. -func (c GroupUserClient) preparerForCreate(ctx context.Context, id GroupUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreate handles the response to the Create request. The method always -// closes the http.Response Body. -func (c GroupUserClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/method_delete.go b/resource-manager/apimanagement/2021-08-01/groupuser/method_delete.go new file mode 100644 index 00000000000..e8513f36120 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/groupuser/method_delete.go @@ -0,0 +1,47 @@ +package groupuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c GroupUserClient) Delete(ctx context.Context, id GroupUserId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/groupuser/method_delete_autorest.go deleted file mode 100644 index 26cb84da7d4..00000000000 --- a/resource-manager/apimanagement/2021-08-01/groupuser/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package groupuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c GroupUserClient) Delete(ctx context.Context, id GroupUserId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GroupUserClient) preparerForDelete(ctx context.Context, id GroupUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GroupUserClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/method_list.go b/resource-manager/apimanagement/2021-08-01/groupuser/method_list.go new file mode 100644 index 00000000000..0f87bb365b1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/groupuser/method_list.go @@ -0,0 +1,125 @@ +package groupuser + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]UserContract +} + +type ListCompleteResult struct { + Items []UserContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c GroupUserClient) List(ctx context.Context, id GroupId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/users", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]UserContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c GroupUserClient) ListComplete(ctx context.Context, id GroupId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, UserContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GroupUserClient) ListCompleteMatchingPredicate(ctx context.Context, id GroupId, options ListOperationOptions, predicate UserContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]UserContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/method_list_autorest.go b/resource-manager/apimanagement/2021-08-01/groupuser/method_list_autorest.go deleted file mode 100644 index 92652a7a09f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/groupuser/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package groupuser - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]UserContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []UserContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c GroupUserClient) List(ctx context.Context, id GroupId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c GroupUserClient) preparerForList(ctx context.Context, id GroupId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/users", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c GroupUserClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c GroupUserClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []UserContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c GroupUserClient) ListComplete(ctx context.Context, id GroupId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, UserContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GroupUserClient) ListCompleteMatchingPredicate(ctx context.Context, id GroupId, options ListOperationOptions, predicate UserContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]UserContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/client.go b/resource-manager/apimanagement/2021-08-01/identityprovider/client.go index 72328783c91..92ebed9126e 100644 --- a/resource-manager/apimanagement/2021-08-01/identityprovider/client.go +++ b/resource-manager/apimanagement/2021-08-01/identityprovider/client.go @@ -1,18 +1,26 @@ package identityprovider -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type IdentityProviderClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewIdentityProviderClientWithBaseURI(endpoint string) IdentityProviderClient { - return IdentityProviderClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewIdentityProviderClientWithBaseURI(api sdkEnv.Api) (*IdentityProviderClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "identityprovider", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating IdentityProviderClient: %+v", err) } + + return &IdentityProviderClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/constants.go b/resource-manager/apimanagement/2021-08-01/identityprovider/constants.go index dbcc693e57a..d96fcd03253 100644 --- a/resource-manager/apimanagement/2021-08-01/identityprovider/constants.go +++ b/resource-manager/apimanagement/2021-08-01/identityprovider/constants.go @@ -1,6 +1,10 @@ package identityprovider -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -27,6 +31,19 @@ func PossibleValuesForIdentityProviderType() []string { } } +func (s *IdentityProviderType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIdentityProviderType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIdentityProviderType(input string) (*IdentityProviderType, error) { vals := map[string]IdentityProviderType{ "aad": IdentityProviderTypeAad, diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_createorupdate.go new file mode 100644 index 00000000000..7e7257ff801 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/identityprovider/method_createorupdate.go @@ -0,0 +1,85 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IdentityProviderContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c IdentityProviderClient) CreateOrUpdate(ctx context.Context, id IdentityProviderId, input IdentityProviderCreateContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_createorupdate_autorest.go deleted file mode 100644 index 01365a7baa9..00000000000 --- a/resource-manager/apimanagement/2021-08-01/identityprovider/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package identityprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *IdentityProviderContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c IdentityProviderClient) CreateOrUpdate(ctx context.Context, id IdentityProviderId, input IdentityProviderCreateContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c IdentityProviderClient) preparerForCreateOrUpdate(ctx context.Context, id IdentityProviderId, input IdentityProviderCreateContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_delete.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_delete.go new file mode 100644 index 00000000000..ff4f9cee7c4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/identityprovider/method_delete.go @@ -0,0 +1,76 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c IdentityProviderClient) Delete(ctx context.Context, id IdentityProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_delete_autorest.go deleted file mode 100644 index d65e64e44b4..00000000000 --- a/resource-manager/apimanagement/2021-08-01/identityprovider/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package identityprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c IdentityProviderClient) Delete(ctx context.Context, id IdentityProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c IdentityProviderClient) preparerForDelete(ctx context.Context, id IdentityProviderId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_get.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_get.go new file mode 100644 index 00000000000..3ea0d912b93 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/identityprovider/method_get.go @@ -0,0 +1,51 @@ +package identityprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IdentityProviderContract +} + +// Get ... +func (c IdentityProviderClient) Get(ctx context.Context, id IdentityProviderId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_get_autorest.go deleted file mode 100644 index 05ae191473a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/identityprovider/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package identityprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *IdentityProviderContract -} - -// Get ... -func (c IdentityProviderClient) Get(ctx context.Context, id IdentityProviderId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c IdentityProviderClient) preparerForGet(ctx context.Context, id IdentityProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_getentitytag.go new file mode 100644 index 00000000000..626d199ac1f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/identityprovider/method_getentitytag.go @@ -0,0 +1,46 @@ +package identityprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c IdentityProviderClient) GetEntityTag(ctx context.Context, id IdentityProviderId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_getentitytag_autorest.go deleted file mode 100644 index 1df4d8b8805..00000000000 --- a/resource-manager/apimanagement/2021-08-01/identityprovider/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package identityprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c IdentityProviderClient) GetEntityTag(ctx context.Context, id IdentityProviderId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c IdentityProviderClient) preparerForGetEntityTag(ctx context.Context, id IdentityProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_listbyservice.go new file mode 100644 index 00000000000..881b7200016 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/identityprovider/method_listbyservice.go @@ -0,0 +1,89 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]IdentityProviderContract +} + +type ListByServiceCompleteResult struct { + Items []IdentityProviderContract +} + +// ListByService ... +func (c IdentityProviderClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/identityProviders", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]IdentityProviderContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c IdentityProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, IdentityProviderContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c IdentityProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate IdentityProviderContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]IdentityProviderContract, 0) + + resp, err := c.ListByService(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_listbyservice_autorest.go deleted file mode 100644 index 993d95a854d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/identityprovider/method_listbyservice_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package identityprovider - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]IdentityProviderContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []IdentityProviderContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByService ... -func (c IdentityProviderClient) ListByService(ctx context.Context, id ServiceId) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c IdentityProviderClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/identityProviders", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c IdentityProviderClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []IdentityProviderContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c IdentityProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, IdentityProviderContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c IdentityProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate IdentityProviderContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]IdentityProviderContract, 0) - - page, err := c.ListByService(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_listsecrets.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_listsecrets.go new file mode 100644 index 00000000000..bf808b63434 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/identityprovider/method_listsecrets.go @@ -0,0 +1,52 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ClientSecretContract +} + +// ListSecrets ... +func (c IdentityProviderClient) ListSecrets(ctx context.Context, id IdentityProviderId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_listsecrets_autorest.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_listsecrets_autorest.go deleted file mode 100644 index 1e36cc02469..00000000000 --- a/resource-manager/apimanagement/2021-08-01/identityprovider/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package identityprovider - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *ClientSecretContract -} - -// ListSecrets ... -func (c IdentityProviderClient) ListSecrets(ctx context.Context, id IdentityProviderId) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c IdentityProviderClient) preparerForListSecrets(ctx context.Context, id IdentityProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_update.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_update.go new file mode 100644 index 00000000000..9ac8eaebfa4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/identityprovider/method_update.go @@ -0,0 +1,84 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IdentityProviderContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c IdentityProviderClient) Update(ctx context.Context, id IdentityProviderId, input IdentityProviderUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/identityprovider/method_update_autorest.go deleted file mode 100644 index 0f1cbf0647f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/identityprovider/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package identityprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *IdentityProviderContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c IdentityProviderClient) Update(ctx context.Context, id IdentityProviderId, input IdentityProviderUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c IdentityProviderClient) preparerForUpdate(ctx context.Context, id IdentityProviderId, input IdentityProviderUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/issue/client.go b/resource-manager/apimanagement/2021-08-01/issue/client.go index 973a74c9ec3..726d6359298 100644 --- a/resource-manager/apimanagement/2021-08-01/issue/client.go +++ b/resource-manager/apimanagement/2021-08-01/issue/client.go @@ -1,18 +1,26 @@ package issue -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type IssueClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewIssueClientWithBaseURI(endpoint string) IssueClient { - return IssueClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewIssueClientWithBaseURI(api sdkEnv.Api) (*IssueClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "issue", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating IssueClient: %+v", err) } + + return &IssueClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/issue/constants.go b/resource-manager/apimanagement/2021-08-01/issue/constants.go index 837f3883c24..737222a81b0 100644 --- a/resource-manager/apimanagement/2021-08-01/issue/constants.go +++ b/resource-manager/apimanagement/2021-08-01/issue/constants.go @@ -1,6 +1,10 @@ package issue -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -25,6 +29,19 @@ func PossibleValuesForState() []string { } } +func (s *State) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseState(input string) (*State, error) { vals := map[string]State{ "closed": StateClosed, diff --git a/resource-manager/apimanagement/2021-08-01/issue/method_get.go b/resource-manager/apimanagement/2021-08-01/issue/method_get.go new file mode 100644 index 00000000000..d23f005d647 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/issue/method_get.go @@ -0,0 +1,51 @@ +package issue + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueContract +} + +// Get ... +func (c IssueClient) Get(ctx context.Context, id IssueId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/issue/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/issue/method_get_autorest.go deleted file mode 100644 index fbdc95d1081..00000000000 --- a/resource-manager/apimanagement/2021-08-01/issue/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package issue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *IssueContract -} - -// Get ... -func (c IssueClient) Get(ctx context.Context, id IssueId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c IssueClient) preparerForGet(ctx context.Context, id IssueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c IssueClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/issue/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/issue/method_listbyservice.go new file mode 100644 index 00000000000..f18cb96e08c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/issue/method_listbyservice.go @@ -0,0 +1,125 @@ +package issue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]IssueContract +} + +type ListByServiceCompleteResult struct { + Items []IssueContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c IssueClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/issues", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]IssueContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c IssueClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c IssueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate IssueContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]IssueContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/issue/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/issue/method_listbyservice_autorest.go deleted file mode 100644 index c811024f3da..00000000000 --- a/resource-manager/apimanagement/2021-08-01/issue/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package issue - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]IssueContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []IssueContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c IssueClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c IssueClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/issues", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c IssueClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c IssueClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []IssueContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c IssueClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c IssueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate IssueContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]IssueContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/logger/client.go b/resource-manager/apimanagement/2021-08-01/logger/client.go index 35b0189b9e7..f38d60c4b30 100644 --- a/resource-manager/apimanagement/2021-08-01/logger/client.go +++ b/resource-manager/apimanagement/2021-08-01/logger/client.go @@ -1,18 +1,26 @@ package logger -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type LoggerClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewLoggerClientWithBaseURI(endpoint string) LoggerClient { - return LoggerClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewLoggerClientWithBaseURI(api sdkEnv.Api) (*LoggerClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "logger", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating LoggerClient: %+v", err) } + + return &LoggerClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/logger/constants.go b/resource-manager/apimanagement/2021-08-01/logger/constants.go index cf45d74e056..0aa7cb68a3e 100644 --- a/resource-manager/apimanagement/2021-08-01/logger/constants.go +++ b/resource-manager/apimanagement/2021-08-01/logger/constants.go @@ -1,6 +1,10 @@ package logger -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForLoggerType() []string { } } +func (s *LoggerType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLoggerType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLoggerType(input string) (*LoggerType, error) { vals := map[string]LoggerType{ "applicationinsights": LoggerTypeApplicationInsights, diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/logger/method_createorupdate.go new file mode 100644 index 00000000000..5afa3c7881e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/logger/method_createorupdate.go @@ -0,0 +1,85 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LoggerContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c LoggerClient) CreateOrUpdate(ctx context.Context, id LoggerId, input LoggerContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/logger/method_createorupdate_autorest.go deleted file mode 100644 index 0575dfc04e6..00000000000 --- a/resource-manager/apimanagement/2021-08-01/logger/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package logger - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *LoggerContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c LoggerClient) CreateOrUpdate(ctx context.Context, id LoggerId, input LoggerContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c LoggerClient) preparerForCreateOrUpdate(ctx context.Context, id LoggerId, input LoggerContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_delete.go b/resource-manager/apimanagement/2021-08-01/logger/method_delete.go new file mode 100644 index 00000000000..9a3b1b42ad9 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/logger/method_delete.go @@ -0,0 +1,76 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c LoggerClient) Delete(ctx context.Context, id LoggerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/logger/method_delete_autorest.go deleted file mode 100644 index cdc22bf87cc..00000000000 --- a/resource-manager/apimanagement/2021-08-01/logger/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package logger - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c LoggerClient) Delete(ctx context.Context, id LoggerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c LoggerClient) preparerForDelete(ctx context.Context, id LoggerId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_get.go b/resource-manager/apimanagement/2021-08-01/logger/method_get.go new file mode 100644 index 00000000000..a755ecf8263 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/logger/method_get.go @@ -0,0 +1,51 @@ +package logger + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LoggerContract +} + +// Get ... +func (c LoggerClient) Get(ctx context.Context, id LoggerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/logger/method_get_autorest.go deleted file mode 100644 index 37e10193f3d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/logger/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package logger - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *LoggerContract -} - -// Get ... -func (c LoggerClient) Get(ctx context.Context, id LoggerId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c LoggerClient) preparerForGet(ctx context.Context, id LoggerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/logger/method_getentitytag.go new file mode 100644 index 00000000000..b65f6ac22bd --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/logger/method_getentitytag.go @@ -0,0 +1,46 @@ +package logger + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c LoggerClient) GetEntityTag(ctx context.Context, id LoggerId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/logger/method_getentitytag_autorest.go deleted file mode 100644 index 4e2a41cb3a9..00000000000 --- a/resource-manager/apimanagement/2021-08-01/logger/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package logger - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c LoggerClient) GetEntityTag(ctx context.Context, id LoggerId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c LoggerClient) preparerForGetEntityTag(ctx context.Context, id LoggerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/logger/method_listbyservice.go new file mode 100644 index 00000000000..6049c405eb8 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/logger/method_listbyservice.go @@ -0,0 +1,125 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]LoggerContract +} + +type ListByServiceCompleteResult struct { + Items []LoggerContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c LoggerClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/loggers", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]LoggerContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c LoggerClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, LoggerContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c LoggerClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate LoggerContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]LoggerContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/logger/method_listbyservice_autorest.go deleted file mode 100644 index 23f43bba9ca..00000000000 --- a/resource-manager/apimanagement/2021-08-01/logger/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package logger - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]LoggerContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []LoggerContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c LoggerClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c LoggerClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/loggers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c LoggerClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []LoggerContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c LoggerClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, LoggerContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c LoggerClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate LoggerContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]LoggerContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_update.go b/resource-manager/apimanagement/2021-08-01/logger/method_update.go new file mode 100644 index 00000000000..f7245ad9404 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/logger/method_update.go @@ -0,0 +1,84 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LoggerContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c LoggerClient) Update(ctx context.Context, id LoggerId, input LoggerUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/logger/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/logger/method_update_autorest.go deleted file mode 100644 index 73a90ec1fbc..00000000000 --- a/resource-manager/apimanagement/2021-08-01/logger/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package logger - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *LoggerContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c LoggerClient) Update(ctx context.Context, id LoggerId, input LoggerUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c LoggerClient) preparerForUpdate(ctx context.Context, id LoggerId, input LoggerUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/client.go b/resource-manager/apimanagement/2021-08-01/namedvalue/client.go index 50c96afd343..cb03913825c 100644 --- a/resource-manager/apimanagement/2021-08-01/namedvalue/client.go +++ b/resource-manager/apimanagement/2021-08-01/namedvalue/client.go @@ -1,18 +1,26 @@ package namedvalue -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type NamedValueClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewNamedValueClientWithBaseURI(endpoint string) NamedValueClient { - return NamedValueClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewNamedValueClientWithBaseURI(api sdkEnv.Api) (*NamedValueClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "namedvalue", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NamedValueClient: %+v", err) } + + return &NamedValueClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_createorupdate.go new file mode 100644 index 00000000000..09c8aa0bbe5 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/namedvalue/method_createorupdate.go @@ -0,0 +1,103 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c NamedValueClient) CreateOrUpdate(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c NamedValueClient) CreateOrUpdateThenPoll(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_createorupdate_autorest.go deleted file mode 100644 index 7f838bb490b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/namedvalue/method_createorupdate_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package namedvalue - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c NamedValueClient) CreateOrUpdate(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c NamedValueClient) CreateOrUpdateThenPoll(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c NamedValueClient) preparerForCreateOrUpdate(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c NamedValueClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_delete.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_delete.go new file mode 100644 index 00000000000..82bbf62ac51 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/namedvalue/method_delete.go @@ -0,0 +1,76 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c NamedValueClient) Delete(ctx context.Context, id NamedValueId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_delete_autorest.go deleted file mode 100644 index da4a8178f35..00000000000 --- a/resource-manager/apimanagement/2021-08-01/namedvalue/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package namedvalue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c NamedValueClient) Delete(ctx context.Context, id NamedValueId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c NamedValueClient) preparerForDelete(ctx context.Context, id NamedValueId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c NamedValueClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_get.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_get.go new file mode 100644 index 00000000000..db6c7dc54e2 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/namedvalue/method_get.go @@ -0,0 +1,51 @@ +package namedvalue + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NamedValueContract +} + +// Get ... +func (c NamedValueClient) Get(ctx context.Context, id NamedValueId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_get_autorest.go deleted file mode 100644 index ce18c60cb5f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/namedvalue/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package namedvalue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *NamedValueContract -} - -// Get ... -func (c NamedValueClient) Get(ctx context.Context, id NamedValueId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c NamedValueClient) preparerForGet(ctx context.Context, id NamedValueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c NamedValueClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_getentitytag.go new file mode 100644 index 00000000000..d292a66e0af --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/namedvalue/method_getentitytag.go @@ -0,0 +1,46 @@ +package namedvalue + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c NamedValueClient) GetEntityTag(ctx context.Context, id NamedValueId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_getentitytag_autorest.go deleted file mode 100644 index ac30709913d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/namedvalue/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package namedvalue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c NamedValueClient) GetEntityTag(ctx context.Context, id NamedValueId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c NamedValueClient) preparerForGetEntityTag(ctx context.Context, id NamedValueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c NamedValueClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_listbyservice.go new file mode 100644 index 00000000000..ebb1b6b4849 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/namedvalue/method_listbyservice.go @@ -0,0 +1,129 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NamedValueContract +} + +type ListByServiceCompleteResult struct { + Items []NamedValueContract +} + +type ListByServiceOperationOptions struct { + Filter *string + IsKeyVaultRefreshFailed *bool + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IsKeyVaultRefreshFailed != nil { + out.Append("isKeyVaultRefreshFailed", fmt.Sprintf("%v", *o.IsKeyVaultRefreshFailed)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c NamedValueClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/namedValues", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]NamedValueContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c NamedValueClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, NamedValueContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c NamedValueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate NamedValueContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]NamedValueContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_listbyservice_autorest.go deleted file mode 100644 index cbfcd1b0b7b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/namedvalue/method_listbyservice_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package namedvalue - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]NamedValueContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []NamedValueContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - IsKeyVaultRefreshFailed *bool - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.IsKeyVaultRefreshFailed != nil { - out["isKeyVaultRefreshFailed"] = *o.IsKeyVaultRefreshFailed - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c NamedValueClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c NamedValueClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/namedValues", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c NamedValueClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c NamedValueClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []NamedValueContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c NamedValueClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, NamedValueContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c NamedValueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate NamedValueContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]NamedValueContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_listvalue.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_listvalue.go new file mode 100644 index 00000000000..4dbf0997989 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/namedvalue/method_listvalue.go @@ -0,0 +1,52 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListValueOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NamedValueSecretContract +} + +// ListValue ... +func (c NamedValueClient) ListValue(ctx context.Context, id NamedValueId) (result ListValueOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listValue", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_listvalue_autorest.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_listvalue_autorest.go deleted file mode 100644 index 0370e762206..00000000000 --- a/resource-manager/apimanagement/2021-08-01/namedvalue/method_listvalue_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package namedvalue - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListValueOperationResponse struct { - HttpResponse *http.Response - Model *NamedValueSecretContract -} - -// ListValue ... -func (c NamedValueClient) ListValue(ctx context.Context, id NamedValueId) (result ListValueOperationResponse, err error) { - req, err := c.preparerForListValue(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListValue", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListValue", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListValue(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListValue", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListValue prepares the ListValue request. -func (c NamedValueClient) preparerForListValue(ctx context.Context, id NamedValueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listValue", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListValue handles the response to the ListValue request. The method always -// closes the http.Response Body. -func (c NamedValueClient) responderForListValue(resp *http.Response) (result ListValueOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_refreshsecret.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_refreshsecret.go new file mode 100644 index 00000000000..0dd3a006aec --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/namedvalue/method_refreshsecret.go @@ -0,0 +1,70 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RefreshSecretOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RefreshSecret ... +func (c NamedValueClient) RefreshSecret(ctx context.Context, id NamedValueId) (result RefreshSecretOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/refreshSecret", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RefreshSecretThenPoll performs RefreshSecret then polls until it's completed +func (c NamedValueClient) RefreshSecretThenPoll(ctx context.Context, id NamedValueId) error { + result, err := c.RefreshSecret(ctx, id) + if err != nil { + return fmt.Errorf("performing RefreshSecret: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RefreshSecret: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_refreshsecret_autorest.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_refreshsecret_autorest.go deleted file mode 100644 index 7574f5aaaf5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/namedvalue/method_refreshsecret_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package namedvalue - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RefreshSecretOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RefreshSecret ... -func (c NamedValueClient) RefreshSecret(ctx context.Context, id NamedValueId) (result RefreshSecretOperationResponse, err error) { - req, err := c.preparerForRefreshSecret(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "RefreshSecret", nil, "Failure preparing request") - return - } - - result, err = c.senderForRefreshSecret(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "RefreshSecret", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RefreshSecretThenPoll performs RefreshSecret then polls until it's completed -func (c NamedValueClient) RefreshSecretThenPoll(ctx context.Context, id NamedValueId) error { - result, err := c.RefreshSecret(ctx, id) - if err != nil { - return fmt.Errorf("performing RefreshSecret: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RefreshSecret: %+v", err) - } - - return nil -} - -// preparerForRefreshSecret prepares the RefreshSecret request. -func (c NamedValueClient) preparerForRefreshSecret(ctx context.Context, id NamedValueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/refreshSecret", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRefreshSecret sends the RefreshSecret request. The method will close the -// http.Response Body if it receives an error. -func (c NamedValueClient) senderForRefreshSecret(ctx context.Context, req *http.Request) (future RefreshSecretOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_update.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_update.go new file mode 100644 index 00000000000..83793e803c7 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/namedvalue/method_update.go @@ -0,0 +1,102 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c NamedValueClient) Update(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c NamedValueClient) UpdateThenPoll(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/namedvalue/method_update_autorest.go deleted file mode 100644 index 9de4e8a7883..00000000000 --- a/resource-manager/apimanagement/2021-08-01/namedvalue/method_update_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package namedvalue - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c NamedValueClient) Update(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c NamedValueClient) UpdateThenPoll(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) error { - result, err := c.Update(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c NamedValueClient) preparerForUpdate(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c NamedValueClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/networkstatus/client.go b/resource-manager/apimanagement/2021-08-01/networkstatus/client.go index 7d6f9215235..5223df0ad30 100644 --- a/resource-manager/apimanagement/2021-08-01/networkstatus/client.go +++ b/resource-manager/apimanagement/2021-08-01/networkstatus/client.go @@ -1,18 +1,26 @@ package networkstatus -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type NetworkStatusClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewNetworkStatusClientWithBaseURI(endpoint string) NetworkStatusClient { - return NetworkStatusClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewNetworkStatusClientWithBaseURI(api sdkEnv.Api) (*NetworkStatusClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "networkstatus", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NetworkStatusClient: %+v", err) } + + return &NetworkStatusClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/networkstatus/constants.go b/resource-manager/apimanagement/2021-08-01/networkstatus/constants.go index fe5f4ceaf1c..caf05ed6a2c 100644 --- a/resource-manager/apimanagement/2021-08-01/networkstatus/constants.go +++ b/resource-manager/apimanagement/2021-08-01/networkstatus/constants.go @@ -1,6 +1,10 @@ package networkstatus -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForConnectivityStatusType() []string { } } +func (s *ConnectivityStatusType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConnectivityStatusType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseConnectivityStatusType(input string) (*ConnectivityStatusType, error) { vals := map[string]ConnectivityStatusType{ "failure": ConnectivityStatusTypeFailure, diff --git a/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbylocation.go b/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbylocation.go new file mode 100644 index 00000000000..040ec0de64d --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbylocation.go @@ -0,0 +1,52 @@ +package networkstatus + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NetworkStatusContract +} + +// ListByLocation ... +func (c NetworkStatusClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/networkstatus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbylocation_autorest.go b/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbylocation_autorest.go deleted file mode 100644 index bd98a6e965e..00000000000 --- a/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbylocation_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package networkstatus - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByLocationOperationResponse struct { - HttpResponse *http.Response - Model *NetworkStatusContract -} - -// ListByLocation ... -func (c NetworkStatusClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { - req, err := c.preparerForListByLocation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByLocation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByLocation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByLocation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByLocation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByLocation prepares the ListByLocation request. -func (c NetworkStatusClient) preparerForListByLocation(ctx context.Context, id LocationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/networkstatus", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByLocation handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (c NetworkStatusClient) responderForListByLocation(resp *http.Response) (result ListByLocationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbyservice.go new file mode 100644 index 00000000000..509a1b2da91 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbyservice.go @@ -0,0 +1,52 @@ +package networkstatus + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NetworkStatusContractByLocation +} + +// ListByService ... +func (c NetworkStatusClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/networkstatus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbyservice_autorest.go deleted file mode 100644 index e5f374af6e0..00000000000 --- a/resource-manager/apimanagement/2021-08-01/networkstatus/method_listbyservice_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package networkstatus - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]NetworkStatusContractByLocation -} - -// ListByService ... -func (c NetworkStatusClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c NetworkStatusClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/networkstatus", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c NetworkStatusClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/notification/client.go b/resource-manager/apimanagement/2021-08-01/notification/client.go index 090f6db749d..98d22942b6c 100644 --- a/resource-manager/apimanagement/2021-08-01/notification/client.go +++ b/resource-manager/apimanagement/2021-08-01/notification/client.go @@ -1,18 +1,26 @@ package notification -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type NotificationClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewNotificationClientWithBaseURI(endpoint string) NotificationClient { - return NotificationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewNotificationClientWithBaseURI(api sdkEnv.Api) (*NotificationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "notification", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NotificationClient: %+v", err) } + + return &NotificationClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/notification/constants.go b/resource-manager/apimanagement/2021-08-01/notification/constants.go index e4c9332d3bd..28634a3bb8e 100644 --- a/resource-manager/apimanagement/2021-08-01/notification/constants.go +++ b/resource-manager/apimanagement/2021-08-01/notification/constants.go @@ -1,6 +1,10 @@ package notification -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -29,6 +33,19 @@ func PossibleValuesForNotificationName() []string { } } +func (s *NotificationName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNotificationName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNotificationName(input string) (*NotificationName, error) { vals := map[string]NotificationName{ "accountclosedpublisher": NotificationNameAccountClosedPublisher, diff --git a/resource-manager/apimanagement/2021-08-01/notification/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/notification/method_createorupdate.go new file mode 100644 index 00000000000..f1f56dbe3ba --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/notification/method_createorupdate.go @@ -0,0 +1,80 @@ +package notification + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NotificationContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c NotificationClient) CreateOrUpdate(ctx context.Context, id NotificationId, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/notification/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/notification/method_createorupdate_autorest.go deleted file mode 100644 index 129cedaaadd..00000000000 --- a/resource-manager/apimanagement/2021-08-01/notification/method_createorupdate_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package notification - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *NotificationContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c NotificationClient) CreateOrUpdate(ctx context.Context, id NotificationId, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c NotificationClient) preparerForCreateOrUpdate(ctx context.Context, id NotificationId, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c NotificationClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/notification/method_get.go b/resource-manager/apimanagement/2021-08-01/notification/method_get.go new file mode 100644 index 00000000000..a5f0293b824 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/notification/method_get.go @@ -0,0 +1,51 @@ +package notification + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NotificationContract +} + +// Get ... +func (c NotificationClient) Get(ctx context.Context, id NotificationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/notification/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/notification/method_get_autorest.go deleted file mode 100644 index 1290bcc6685..00000000000 --- a/resource-manager/apimanagement/2021-08-01/notification/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package notification - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *NotificationContract -} - -// Get ... -func (c NotificationClient) Get(ctx context.Context, id NotificationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c NotificationClient) preparerForGet(ctx context.Context, id NotificationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c NotificationClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/notification/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/notification/method_listbyservice.go new file mode 100644 index 00000000000..ec6e29b47c6 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/notification/method_listbyservice.go @@ -0,0 +1,121 @@ +package notification + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NotificationContract +} + +type ListByServiceCompleteResult struct { + Items []NotificationContract +} + +type ListByServiceOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c NotificationClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/notifications", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]NotificationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c NotificationClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, NotificationContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c NotificationClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate NotificationContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]NotificationContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/notification/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/notification/method_listbyservice_autorest.go deleted file mode 100644 index d439d198b0c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/notification/method_listbyservice_autorest.go +++ /dev/null @@ -1,220 +0,0 @@ -package notification - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]NotificationContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []NotificationContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c NotificationClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c NotificationClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/notifications", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c NotificationClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c NotificationClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []NotificationContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c NotificationClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, NotificationContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c NotificationClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate NotificationContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]NotificationContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/client.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/client.go index 6f974759762..1a1b8cceb61 100644 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/client.go +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/client.go @@ -1,18 +1,26 @@ package notificationrecipientemail -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type NotificationRecipientEmailClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewNotificationRecipientEmailClientWithBaseURI(endpoint string) NotificationRecipientEmailClient { - return NotificationRecipientEmailClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewNotificationRecipientEmailClientWithBaseURI(api sdkEnv.Api) (*NotificationRecipientEmailClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "notificationrecipientemail", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NotificationRecipientEmailClient: %+v", err) } + + return &NotificationRecipientEmailClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/constants.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/constants.go index e48b9eee0a2..85940aee54e 100644 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/constants.go +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/constants.go @@ -1,6 +1,10 @@ package notificationrecipientemail -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -29,6 +33,19 @@ func PossibleValuesForNotificationName() []string { } } +func (s *NotificationName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNotificationName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNotificationName(input string) (*NotificationName, error) { vals := map[string]NotificationName{ "accountclosedpublisher": NotificationNameAccountClosedPublisher, diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_checkentityexists.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_checkentityexists.go new file mode 100644 index 00000000000..acddee29b82 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_checkentityexists.go @@ -0,0 +1,46 @@ +package notificationrecipientemail + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c NotificationRecipientEmailClient) CheckEntityExists(ctx context.Context, id RecipientEmailId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_checkentityexists_autorest.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_checkentityexists_autorest.go deleted file mode 100644 index da1fef7c04b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_checkentityexists_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package notificationrecipientemail - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckEntityExistsOperationResponse struct { - HttpResponse *http.Response -} - -// CheckEntityExists ... -func (c NotificationRecipientEmailClient) CheckEntityExists(ctx context.Context, id RecipientEmailId) (result CheckEntityExistsOperationResponse, err error) { - req, err := c.preparerForCheckEntityExists(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CheckEntityExists", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckEntityExists(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CheckEntityExists", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckEntityExists prepares the CheckEntityExists request. -func (c NotificationRecipientEmailClient) preparerForCheckEntityExists(ctx context.Context, id RecipientEmailId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckEntityExists handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (c NotificationRecipientEmailClient) responderForCheckEntityExists(resp *http.Response) (result CheckEntityExistsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_createorupdate.go new file mode 100644 index 00000000000..076065b12a4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_createorupdate.go @@ -0,0 +1,52 @@ +package notificationrecipientemail + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientEmailContract +} + +// CreateOrUpdate ... +func (c NotificationRecipientEmailClient) CreateOrUpdate(ctx context.Context, id RecipientEmailId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_createorupdate_autorest.go deleted file mode 100644 index 54e5266a7f4..00000000000 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_createorupdate_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package notificationrecipientemail - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *RecipientEmailContract -} - -// CreateOrUpdate ... -func (c NotificationRecipientEmailClient) CreateOrUpdate(ctx context.Context, id RecipientEmailId) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c NotificationRecipientEmailClient) preparerForCreateOrUpdate(ctx context.Context, id RecipientEmailId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c NotificationRecipientEmailClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_delete.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_delete.go new file mode 100644 index 00000000000..083dbc0417f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_delete.go @@ -0,0 +1,47 @@ +package notificationrecipientemail + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c NotificationRecipientEmailClient) Delete(ctx context.Context, id RecipientEmailId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_delete_autorest.go deleted file mode 100644 index c38e5d32b20..00000000000 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package notificationrecipientemail - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c NotificationRecipientEmailClient) Delete(ctx context.Context, id RecipientEmailId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c NotificationRecipientEmailClient) preparerForDelete(ctx context.Context, id RecipientEmailId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c NotificationRecipientEmailClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_listbynotification.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_listbynotification.go new file mode 100644 index 00000000000..091cf193ce9 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_listbynotification.go @@ -0,0 +1,52 @@ +package notificationrecipientemail + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNotificationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientEmailCollection +} + +// ListByNotification ... +func (c NotificationRecipientEmailClient) ListByNotification(ctx context.Context, id NotificationId) (result ListByNotificationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/recipientEmails", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_listbynotification_autorest.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_listbynotification_autorest.go deleted file mode 100644 index c694b327a26..00000000000 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/method_listbynotification_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package notificationrecipientemail - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByNotificationOperationResponse struct { - HttpResponse *http.Response - Model *RecipientEmailCollection -} - -// ListByNotification ... -func (c NotificationRecipientEmailClient) ListByNotification(ctx context.Context, id NotificationId) (result ListByNotificationOperationResponse, err error) { - req, err := c.preparerForListByNotification(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "ListByNotification", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "ListByNotification", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByNotification(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "ListByNotification", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByNotification prepares the ListByNotification request. -func (c NotificationRecipientEmailClient) preparerForListByNotification(ctx context.Context, id NotificationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/recipientEmails", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByNotification handles the response to the ListByNotification request. The method always -// closes the http.Response Body. -func (c NotificationRecipientEmailClient) responderForListByNotification(resp *http.Response) (result ListByNotificationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/client.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/client.go index ee1917a9307..eead3052766 100644 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/client.go +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/client.go @@ -1,18 +1,26 @@ package notificationrecipientuser -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type NotificationRecipientUserClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewNotificationRecipientUserClientWithBaseURI(endpoint string) NotificationRecipientUserClient { - return NotificationRecipientUserClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewNotificationRecipientUserClientWithBaseURI(api sdkEnv.Api) (*NotificationRecipientUserClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "notificationrecipientuser", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NotificationRecipientUserClient: %+v", err) } + + return &NotificationRecipientUserClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/constants.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/constants.go index 32178bd55a0..879dbf85c44 100644 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/constants.go +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/constants.go @@ -1,6 +1,10 @@ package notificationrecipientuser -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -29,6 +33,19 @@ func PossibleValuesForNotificationName() []string { } } +func (s *NotificationName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNotificationName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNotificationName(input string) (*NotificationName, error) { vals := map[string]NotificationName{ "accountclosedpublisher": NotificationNameAccountClosedPublisher, diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_checkentityexists.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_checkentityexists.go new file mode 100644 index 00000000000..baae87b86d1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_checkentityexists.go @@ -0,0 +1,46 @@ +package notificationrecipientuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c NotificationRecipientUserClient) CheckEntityExists(ctx context.Context, id RecipientUserId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_checkentityexists_autorest.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_checkentityexists_autorest.go deleted file mode 100644 index ddfad8eeecb..00000000000 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_checkentityexists_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package notificationrecipientuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckEntityExistsOperationResponse struct { - HttpResponse *http.Response -} - -// CheckEntityExists ... -func (c NotificationRecipientUserClient) CheckEntityExists(ctx context.Context, id RecipientUserId) (result CheckEntityExistsOperationResponse, err error) { - req, err := c.preparerForCheckEntityExists(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CheckEntityExists", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckEntityExists(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CheckEntityExists", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckEntityExists prepares the CheckEntityExists request. -func (c NotificationRecipientUserClient) preparerForCheckEntityExists(ctx context.Context, id RecipientUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckEntityExists handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (c NotificationRecipientUserClient) responderForCheckEntityExists(resp *http.Response) (result CheckEntityExistsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_createorupdate.go new file mode 100644 index 00000000000..a9b12b60ca8 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_createorupdate.go @@ -0,0 +1,52 @@ +package notificationrecipientuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientUserContract +} + +// CreateOrUpdate ... +func (c NotificationRecipientUserClient) CreateOrUpdate(ctx context.Context, id RecipientUserId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_createorupdate_autorest.go deleted file mode 100644 index 3c013a3fa62..00000000000 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_createorupdate_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package notificationrecipientuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *RecipientUserContract -} - -// CreateOrUpdate ... -func (c NotificationRecipientUserClient) CreateOrUpdate(ctx context.Context, id RecipientUserId) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c NotificationRecipientUserClient) preparerForCreateOrUpdate(ctx context.Context, id RecipientUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c NotificationRecipientUserClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_delete.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_delete.go new file mode 100644 index 00000000000..d0bf672da2e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_delete.go @@ -0,0 +1,47 @@ +package notificationrecipientuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c NotificationRecipientUserClient) Delete(ctx context.Context, id RecipientUserId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_delete_autorest.go deleted file mode 100644 index 808cdd48ac5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package notificationrecipientuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c NotificationRecipientUserClient) Delete(ctx context.Context, id RecipientUserId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c NotificationRecipientUserClient) preparerForDelete(ctx context.Context, id RecipientUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c NotificationRecipientUserClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_listbynotification.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_listbynotification.go new file mode 100644 index 00000000000..bfe4badf1f5 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_listbynotification.go @@ -0,0 +1,52 @@ +package notificationrecipientuser + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNotificationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientUserCollection +} + +// ListByNotification ... +func (c NotificationRecipientUserClient) ListByNotification(ctx context.Context, id NotificationId) (result ListByNotificationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/recipientUsers", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_listbynotification_autorest.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_listbynotification_autorest.go deleted file mode 100644 index adefe67aec1..00000000000 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/method_listbynotification_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package notificationrecipientuser - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByNotificationOperationResponse struct { - HttpResponse *http.Response - Model *RecipientUserCollection -} - -// ListByNotification ... -func (c NotificationRecipientUserClient) ListByNotification(ctx context.Context, id NotificationId) (result ListByNotificationOperationResponse, err error) { - req, err := c.preparerForListByNotification(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "ListByNotification", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "ListByNotification", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByNotification(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "ListByNotification", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByNotification prepares the ListByNotification request. -func (c NotificationRecipientUserClient) preparerForListByNotification(ctx context.Context, id NotificationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/recipientUsers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByNotification handles the response to the ListByNotification request. The method always -// closes the http.Response Body. -func (c NotificationRecipientUserClient) responderForListByNotification(resp *http.Response) (result ListByNotificationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/client.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/client.go index 6e9956e13eb..38b4e8fc97e 100644 --- a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/client.go +++ b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/client.go @@ -1,18 +1,26 @@ package openidconnectprovider -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type OpenidConnectProviderClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewOpenidConnectProviderClientWithBaseURI(endpoint string) OpenidConnectProviderClient { - return OpenidConnectProviderClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewOpenidConnectProviderClientWithBaseURI(api sdkEnv.Api) (*OpenidConnectProviderClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "openidconnectprovider", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating OpenidConnectProviderClient: %+v", err) } + + return &OpenidConnectProviderClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_createorupdate.go new file mode 100644 index 00000000000..022112dd8ee --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_createorupdate.go @@ -0,0 +1,85 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OpenidConnectProviderContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c OpenidConnectProviderClient) CreateOrUpdate(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_createorupdate_autorest.go deleted file mode 100644 index 4dc253d0cac..00000000000 --- a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *OpenidConnectProviderContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c OpenidConnectProviderClient) CreateOrUpdate(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c OpenidConnectProviderClient) preparerForCreateOrUpdate(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_delete.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_delete.go new file mode 100644 index 00000000000..dd6f6bbf9c4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_delete.go @@ -0,0 +1,76 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c OpenidConnectProviderClient) Delete(ctx context.Context, id OpenidConnectProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_delete_autorest.go deleted file mode 100644 index e8d831f0dbf..00000000000 --- a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c OpenidConnectProviderClient) Delete(ctx context.Context, id OpenidConnectProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c OpenidConnectProviderClient) preparerForDelete(ctx context.Context, id OpenidConnectProviderId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_get.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_get.go new file mode 100644 index 00000000000..25939c8a1ce --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_get.go @@ -0,0 +1,51 @@ +package openidconnectprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OpenidConnectProviderContract +} + +// Get ... +func (c OpenidConnectProviderClient) Get(ctx context.Context, id OpenidConnectProviderId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_get_autorest.go deleted file mode 100644 index b7d07f681e5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *OpenidConnectProviderContract -} - -// Get ... -func (c OpenidConnectProviderClient) Get(ctx context.Context, id OpenidConnectProviderId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c OpenidConnectProviderClient) preparerForGet(ctx context.Context, id OpenidConnectProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_getentitytag.go new file mode 100644 index 00000000000..3f411d67cae --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_getentitytag.go @@ -0,0 +1,46 @@ +package openidconnectprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c OpenidConnectProviderClient) GetEntityTag(ctx context.Context, id OpenidConnectProviderId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_getentitytag_autorest.go deleted file mode 100644 index 02fdba1af30..00000000000 --- a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c OpenidConnectProviderClient) GetEntityTag(ctx context.Context, id OpenidConnectProviderId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c OpenidConnectProviderClient) preparerForGetEntityTag(ctx context.Context, id OpenidConnectProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listbyservice.go new file mode 100644 index 00000000000..42ba42327c5 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listbyservice.go @@ -0,0 +1,125 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OpenidConnectProviderContract +} + +type ListByServiceCompleteResult struct { + Items []OpenidConnectProviderContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c OpenidConnectProviderClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/openidConnectProviders", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]OpenidConnectProviderContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c OpenidConnectProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, OpenidConnectProviderContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c OpenidConnectProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate OpenidConnectProviderContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]OpenidConnectProviderContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listbyservice_autorest.go deleted file mode 100644 index e84f3a32000..00000000000 --- a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]OpenidConnectProviderContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []OpenidConnectProviderContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c OpenidConnectProviderClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c OpenidConnectProviderClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/openidConnectProviders", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c OpenidConnectProviderClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []OpenidConnectProviderContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c OpenidConnectProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, OpenidConnectProviderContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c OpenidConnectProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate OpenidConnectProviderContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]OpenidConnectProviderContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listsecrets.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listsecrets.go new file mode 100644 index 00000000000..d05b3d3c365 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listsecrets.go @@ -0,0 +1,52 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ClientSecretContract +} + +// ListSecrets ... +func (c OpenidConnectProviderClient) ListSecrets(ctx context.Context, id OpenidConnectProviderId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listsecrets_autorest.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listsecrets_autorest.go deleted file mode 100644 index df2556cf4f3..00000000000 --- a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *ClientSecretContract -} - -// ListSecrets ... -func (c OpenidConnectProviderClient) ListSecrets(ctx context.Context, id OpenidConnectProviderId) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c OpenidConnectProviderClient) preparerForListSecrets(ctx context.Context, id OpenidConnectProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_update.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_update.go new file mode 100644 index 00000000000..5b2402019c0 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_update.go @@ -0,0 +1,84 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OpenidConnectProviderContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c OpenidConnectProviderClient) Update(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_update_autorest.go deleted file mode 100644 index 5f1845c884d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *OpenidConnectProviderContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c OpenidConnectProviderClient) Update(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c OpenidConnectProviderClient) preparerForUpdate(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/client.go b/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/client.go index 22c16a831a4..a9777dea6e6 100644 --- a/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/client.go +++ b/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/client.go @@ -1,18 +1,26 @@ package outboundnetworkdependenciesendpoints -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type OutboundNetworkDependenciesEndpointsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(endpoint string) OutboundNetworkDependenciesEndpointsClient { - return OutboundNetworkDependenciesEndpointsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api sdkEnv.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "outboundnetworkdependenciesendpoints", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating OutboundNetworkDependenciesEndpointsClient: %+v", err) } + + return &OutboundNetworkDependenciesEndpointsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/method_listbyservice.go new file mode 100644 index 00000000000..32234f6b430 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/method_listbyservice.go @@ -0,0 +1,52 @@ +package outboundnetworkdependenciesendpoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OutboundEnvironmentEndpointList +} + +// ListByService ... +func (c OutboundNetworkDependenciesEndpointsClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/method_listbyservice_autorest.go deleted file mode 100644 index 6c0aaf4214b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/method_listbyservice_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package outboundnetworkdependenciesendpoints - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *OutboundEnvironmentEndpointList -} - -// ListByService ... -func (c OutboundNetworkDependenciesEndpointsClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "outboundnetworkdependenciesendpoints.OutboundNetworkDependenciesEndpointsClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "outboundnetworkdependenciesendpoints.OutboundNetworkDependenciesEndpointsClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "outboundnetworkdependenciesendpoints.OutboundNetworkDependenciesEndpointsClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c OutboundNetworkDependenciesEndpointsClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c OutboundNetworkDependenciesEndpointsClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/client.go b/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/client.go index 9ad3cc36b7c..7edfe6f1c0d 100644 --- a/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/client.go +++ b/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/client.go @@ -1,18 +1,26 @@ package performconnectivitycheck -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PerformConnectivityCheckClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPerformConnectivityCheckClientWithBaseURI(endpoint string) PerformConnectivityCheckClient { - return PerformConnectivityCheckClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPerformConnectivityCheckClientWithBaseURI(api sdkEnv.Api) (*PerformConnectivityCheckClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "performconnectivitycheck", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PerformConnectivityCheckClient: %+v", err) } + + return &PerformConnectivityCheckClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/constants.go b/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/constants.go index 9bf9ce98491..df0ed03802b 100644 --- a/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/constants.go +++ b/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/constants.go @@ -1,6 +1,10 @@ package performconnectivitycheck -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForConnectionStatus() []string { } } +func (s *ConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseConnectionStatus(input string) (*ConnectionStatus, error) { vals := map[string]ConnectionStatus{ "connected": ConnectionStatusConnected, @@ -55,6 +72,19 @@ func PossibleValuesForConnectivityCheckProtocol() []string { } } +func (s *ConnectivityCheckProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConnectivityCheckProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseConnectivityCheckProtocol(input string) (*ConnectivityCheckProtocol, error) { vals := map[string]ConnectivityCheckProtocol{ "http": ConnectivityCheckProtocolHTTP, @@ -98,6 +128,19 @@ func PossibleValuesForIssueType() []string { } } +func (s *IssueType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIssueType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIssueType(input string) (*IssueType, error) { vals := map[string]IssueType{ "agentstopped": IssueTypeAgentStopped, @@ -133,6 +176,19 @@ func PossibleValuesForMethod() []string { } } +func (s *Method) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseMethod(input string) (*Method, error) { vals := map[string]Method{ "get": MethodGET, @@ -163,6 +219,19 @@ func PossibleValuesForOrigin() []string { } } +func (s *Origin) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrigin(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOrigin(input string) (*Origin, error) { vals := map[string]Origin{ "inbound": OriginInbound, @@ -190,6 +259,19 @@ func PossibleValuesForPreferredIPVersion() []string { } } +func (s *PreferredIPVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePreferredIPVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePreferredIPVersion(input string) (*PreferredIPVersion, error) { vals := map[string]PreferredIPVersion{ "ipv4": PreferredIPVersionIPvFour, @@ -217,6 +299,19 @@ func PossibleValuesForSeverity() []string { } } +func (s *Severity) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSeverity(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSeverity(input string) (*Severity, error) { vals := map[string]Severity{ "error": SeverityError, diff --git a/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/method_async.go b/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/method_async.go new file mode 100644 index 00000000000..ecb7574e628 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/method_async.go @@ -0,0 +1,74 @@ +package performconnectivitycheck + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AsyncOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Async ... +func (c PerformConnectivityCheckClient) Async(ctx context.Context, id ServiceId, input ConnectivityCheckRequest) (result AsyncOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/connectivityCheck", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AsyncThenPoll performs Async then polls until it's completed +func (c PerformConnectivityCheckClient) AsyncThenPoll(ctx context.Context, id ServiceId, input ConnectivityCheckRequest) error { + result, err := c.Async(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Async: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Async: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/method_async_autorest.go b/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/method_async_autorest.go deleted file mode 100644 index a2c486cc975..00000000000 --- a/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/method_async_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package performconnectivitycheck - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AsyncOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Async ... -func (c PerformConnectivityCheckClient) Async(ctx context.Context, id ServiceId, input ConnectivityCheckRequest) (result AsyncOperationResponse, err error) { - req, err := c.preparerForAsync(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "performconnectivitycheck.PerformConnectivityCheckClient", "Async", nil, "Failure preparing request") - return - } - - result, err = c.senderForAsync(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "performconnectivitycheck.PerformConnectivityCheckClient", "Async", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// AsyncThenPoll performs Async then polls until it's completed -func (c PerformConnectivityCheckClient) AsyncThenPoll(ctx context.Context, id ServiceId, input ConnectivityCheckRequest) error { - result, err := c.Async(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Async: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Async: %+v", err) - } - - return nil -} - -// preparerForAsync prepares the Async request. -func (c PerformConnectivityCheckClient) preparerForAsync(ctx context.Context, id ServiceId, input ConnectivityCheckRequest) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/connectivityCheck", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForAsync sends the Async request. The method will close the -// http.Response Body if it receives an error. -func (c PerformConnectivityCheckClient) senderForAsync(ctx context.Context, req *http.Request) (future AsyncOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/policy/client.go b/resource-manager/apimanagement/2021-08-01/policy/client.go index 100ea9be74e..3d97a46f131 100644 --- a/resource-manager/apimanagement/2021-08-01/policy/client.go +++ b/resource-manager/apimanagement/2021-08-01/policy/client.go @@ -1,18 +1,26 @@ package policy -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PolicyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPolicyClientWithBaseURI(endpoint string) PolicyClient { - return PolicyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPolicyClientWithBaseURI(api sdkEnv.Api) (*PolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "policy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PolicyClient: %+v", err) } + + return &PolicyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/policy/constants.go b/resource-manager/apimanagement/2021-08-01/policy/constants.go index d347a3402e1..10a4650a395 100644 --- a/resource-manager/apimanagement/2021-08-01/policy/constants.go +++ b/resource-manager/apimanagement/2021-08-01/policy/constants.go @@ -1,6 +1,10 @@ package policy -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPolicyContentFormat() []string { } } +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { vals := map[string]PolicyContentFormat{ "rawxml": PolicyContentFormatRawxml, @@ -53,6 +70,19 @@ func PossibleValuesForPolicyExportFormat() []string { } } +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { vals := map[string]PolicyExportFormat{ "rawxml": PolicyExportFormatRawxml, diff --git a/resource-manager/apimanagement/2021-08-01/policy/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/policy/method_createorupdate.go new file mode 100644 index 00000000000..0303d637d5e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/policy/method_createorupdate.go @@ -0,0 +1,85 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c PolicyClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/policy/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/policy/method_createorupdate_autorest.go deleted file mode 100644 index 6891db3acdb..00000000000 --- a/resource-manager/apimanagement/2021-08-01/policy/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package policy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c PolicyClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c PolicyClient) preparerForCreateOrUpdate(ctx context.Context, id ServiceId, input PolicyContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c PolicyClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/policy/method_delete.go b/resource-manager/apimanagement/2021-08-01/policy/method_delete.go new file mode 100644 index 00000000000..4ddd78e13cb --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/policy/method_delete.go @@ -0,0 +1,76 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c PolicyClient) Delete(ctx context.Context, id ServiceId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/policy/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/policy/method_delete_autorest.go deleted file mode 100644 index 48c0e129f41..00000000000 --- a/resource-manager/apimanagement/2021-08-01/policy/method_delete_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package policy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c PolicyClient) Delete(ctx context.Context, id ServiceId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c PolicyClient) preparerForDelete(ctx context.Context, id ServiceId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c PolicyClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/policy/method_get.go b/resource-manager/apimanagement/2021-08-01/policy/method_get.go new file mode 100644 index 00000000000..829e84ff74d --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/policy/method_get.go @@ -0,0 +1,80 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c PolicyClient) Get(ctx context.Context, id ServiceId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/policy/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/policy/method_get_autorest.go deleted file mode 100644 index 5b1f10a4714..00000000000 --- a/resource-manager/apimanagement/2021-08-01/policy/method_get_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package policy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type GetOperationOptions struct { - Format *PolicyExportFormat -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - return out -} - -// Get ... -func (c PolicyClient) Get(ctx context.Context, id ServiceId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c PolicyClient) preparerForGet(ctx context.Context, id ServiceId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c PolicyClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/policy/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/policy/method_getentitytag.go new file mode 100644 index 00000000000..d8575a5f4ca --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/policy/method_getentitytag.go @@ -0,0 +1,47 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c PolicyClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/policy/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/policy/method_getentitytag_autorest.go deleted file mode 100644 index 40957baa188..00000000000 --- a/resource-manager/apimanagement/2021-08-01/policy/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package policy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c PolicyClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c PolicyClient) preparerForGetEntityTag(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c PolicyClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/policy/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/policy/method_listbyservice.go new file mode 100644 index 00000000000..2cba37b4dd0 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/policy/method_listbyservice.go @@ -0,0 +1,52 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByService ... +func (c PolicyClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/policy/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/policy/method_listbyservice_autorest.go deleted file mode 100644 index 753788e2a82..00000000000 --- a/resource-manager/apimanagement/2021-08-01/policy/method_listbyservice_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package policy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *PolicyCollection -} - -// ListByService ... -func (c PolicyClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c PolicyClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c PolicyClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/policydescription/client.go b/resource-manager/apimanagement/2021-08-01/policydescription/client.go index 2ad1b60908c..92766324c7e 100644 --- a/resource-manager/apimanagement/2021-08-01/policydescription/client.go +++ b/resource-manager/apimanagement/2021-08-01/policydescription/client.go @@ -1,18 +1,26 @@ package policydescription -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PolicyDescriptionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPolicyDescriptionClientWithBaseURI(endpoint string) PolicyDescriptionClient { - return PolicyDescriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPolicyDescriptionClientWithBaseURI(api sdkEnv.Api) (*PolicyDescriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "policydescription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PolicyDescriptionClient: %+v", err) } + + return &PolicyDescriptionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/policydescription/constants.go b/resource-manager/apimanagement/2021-08-01/policydescription/constants.go index 5f73fe9e994..be5c274580c 100644 --- a/resource-manager/apimanagement/2021-08-01/policydescription/constants.go +++ b/resource-manager/apimanagement/2021-08-01/policydescription/constants.go @@ -1,6 +1,10 @@ package policydescription -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -25,6 +29,19 @@ func PossibleValuesForPolicyScopeContract() []string { } } +func (s *PolicyScopeContract) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyScopeContract(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyScopeContract(input string) (*PolicyScopeContract, error) { vals := map[string]PolicyScopeContract{ "all": PolicyScopeContractAll, diff --git a/resource-manager/apimanagement/2021-08-01/policydescription/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/policydescription/method_listbyservice.go new file mode 100644 index 00000000000..397951b3351 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/policydescription/method_listbyservice.go @@ -0,0 +1,80 @@ +package policydescription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyDescriptionCollection +} + +type ListByServiceOperationOptions struct { + Scope *PolicyScopeContract +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Scope != nil { + out.Append("scope", fmt.Sprintf("%v", *o.Scope)) + } + return &out +} + +// ListByService ... +func (c PolicyDescriptionClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policyDescriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/policydescription/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/policydescription/method_listbyservice_autorest.go deleted file mode 100644 index 0b74d09e511..00000000000 --- a/resource-manager/apimanagement/2021-08-01/policydescription/method_listbyservice_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package policydescription - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *PolicyDescriptionCollection -} - -type ListByServiceOperationOptions struct { - Scope *PolicyScopeContract -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Scope != nil { - out["scope"] = *o.Scope - } - - return out -} - -// ListByService ... -func (c PolicyDescriptionClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policydescription.PolicyDescriptionClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policydescription.PolicyDescriptionClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policydescription.PolicyDescriptionClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c PolicyDescriptionClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policyDescriptions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c PolicyDescriptionClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/client.go b/resource-manager/apimanagement/2021-08-01/portalrevision/client.go index b6215519652..98c00ef362f 100644 --- a/resource-manager/apimanagement/2021-08-01/portalrevision/client.go +++ b/resource-manager/apimanagement/2021-08-01/portalrevision/client.go @@ -1,18 +1,26 @@ package portalrevision -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PortalRevisionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPortalRevisionClientWithBaseURI(endpoint string) PortalRevisionClient { - return PortalRevisionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPortalRevisionClientWithBaseURI(api sdkEnv.Api) (*PortalRevisionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "portalrevision", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PortalRevisionClient: %+v", err) } + + return &PortalRevisionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/constants.go b/resource-manager/apimanagement/2021-08-01/portalrevision/constants.go index aa2001884d8..721b9d119dc 100644 --- a/resource-manager/apimanagement/2021-08-01/portalrevision/constants.go +++ b/resource-manager/apimanagement/2021-08-01/portalrevision/constants.go @@ -1,6 +1,10 @@ package portalrevision -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPortalRevisionStatus() []string { } } +func (s *PortalRevisionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePortalRevisionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePortalRevisionStatus(input string) (*PortalRevisionStatus, error) { vals := map[string]PortalRevisionStatus{ "completed": PortalRevisionStatusCompleted, diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/portalrevision/method_createorupdate.go new file mode 100644 index 00000000000..a28f2755f5b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/portalrevision/method_createorupdate.go @@ -0,0 +1,74 @@ +package portalrevision + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c PortalRevisionClient) CreateOrUpdate(ctx context.Context, id PortalRevisionId, input PortalRevisionContract) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PortalRevisionClient) CreateOrUpdateThenPoll(ctx context.Context, id PortalRevisionId, input PortalRevisionContract) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/portalrevision/method_createorupdate_autorest.go deleted file mode 100644 index e674d1c6391..00000000000 --- a/resource-manager/apimanagement/2021-08-01/portalrevision/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package portalrevision - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c PortalRevisionClient) CreateOrUpdate(ctx context.Context, id PortalRevisionId, input PortalRevisionContract) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c PortalRevisionClient) CreateOrUpdateThenPoll(ctx context.Context, id PortalRevisionId, input PortalRevisionContract) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c PortalRevisionClient) preparerForCreateOrUpdate(ctx context.Context, id PortalRevisionId, input PortalRevisionContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c PortalRevisionClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/method_get.go b/resource-manager/apimanagement/2021-08-01/portalrevision/method_get.go new file mode 100644 index 00000000000..ebc6cd16a57 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/portalrevision/method_get.go @@ -0,0 +1,51 @@ +package portalrevision + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalRevisionContract +} + +// Get ... +func (c PortalRevisionClient) Get(ctx context.Context, id PortalRevisionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/portalrevision/method_get_autorest.go deleted file mode 100644 index 2c81b2f3322..00000000000 --- a/resource-manager/apimanagement/2021-08-01/portalrevision/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package portalrevision - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PortalRevisionContract -} - -// Get ... -func (c PortalRevisionClient) Get(ctx context.Context, id PortalRevisionId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c PortalRevisionClient) preparerForGet(ctx context.Context, id PortalRevisionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c PortalRevisionClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/portalrevision/method_getentitytag.go new file mode 100644 index 00000000000..c29d462fb8e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/portalrevision/method_getentitytag.go @@ -0,0 +1,46 @@ +package portalrevision + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c PortalRevisionClient) GetEntityTag(ctx context.Context, id PortalRevisionId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/portalrevision/method_getentitytag_autorest.go deleted file mode 100644 index 673f88eb7c5..00000000000 --- a/resource-manager/apimanagement/2021-08-01/portalrevision/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package portalrevision - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c PortalRevisionClient) GetEntityTag(ctx context.Context, id PortalRevisionId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c PortalRevisionClient) preparerForGetEntityTag(ctx context.Context, id PortalRevisionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c PortalRevisionClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/portalrevision/method_listbyservice.go new file mode 100644 index 00000000000..367a0040241 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/portalrevision/method_listbyservice.go @@ -0,0 +1,125 @@ +package portalrevision + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PortalRevisionContract +} + +type ListByServiceCompleteResult struct { + Items []PortalRevisionContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c PortalRevisionClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalRevisions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]PortalRevisionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c PortalRevisionClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, PortalRevisionContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PortalRevisionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate PortalRevisionContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]PortalRevisionContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/portalrevision/method_listbyservice_autorest.go deleted file mode 100644 index e804ebd138b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/portalrevision/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package portalrevision - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]PortalRevisionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []PortalRevisionContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c PortalRevisionClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c PortalRevisionClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalRevisions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c PortalRevisionClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c PortalRevisionClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []PortalRevisionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c PortalRevisionClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, PortalRevisionContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c PortalRevisionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate PortalRevisionContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]PortalRevisionContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/method_update.go b/resource-manager/apimanagement/2021-08-01/portalrevision/method_update.go new file mode 100644 index 00000000000..d9b47a64729 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/portalrevision/method_update.go @@ -0,0 +1,102 @@ +package portalrevision + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c PortalRevisionClient) Update(ctx context.Context, id PortalRevisionId, input PortalRevisionContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c PortalRevisionClient) UpdateThenPoll(ctx context.Context, id PortalRevisionId, input PortalRevisionContract, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/portalrevision/method_update_autorest.go deleted file mode 100644 index e6c980e81fa..00000000000 --- a/resource-manager/apimanagement/2021-08-01/portalrevision/method_update_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package portalrevision - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c PortalRevisionClient) Update(ctx context.Context, id PortalRevisionId, input PortalRevisionContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c PortalRevisionClient) UpdateThenPoll(ctx context.Context, id PortalRevisionId, input PortalRevisionContract, options UpdateOperationOptions) error { - result, err := c.Update(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c PortalRevisionClient) preparerForUpdate(ctx context.Context, id PortalRevisionId, input PortalRevisionContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c PortalRevisionClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/portalsettings/client.go b/resource-manager/apimanagement/2021-08-01/portalsettings/client.go index 7f256742d89..c51b0c431f7 100644 --- a/resource-manager/apimanagement/2021-08-01/portalsettings/client.go +++ b/resource-manager/apimanagement/2021-08-01/portalsettings/client.go @@ -1,18 +1,26 @@ package portalsettings -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PortalSettingsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPortalSettingsClientWithBaseURI(endpoint string) PortalSettingsClient { - return PortalSettingsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPortalSettingsClientWithBaseURI(api sdkEnv.Api) (*PortalSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "portalsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PortalSettingsClient: %+v", err) } + + return &PortalSettingsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/portalsettings/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/portalsettings/method_listbyservice.go new file mode 100644 index 00000000000..5f25ab8003b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/portalsettings/method_listbyservice.go @@ -0,0 +1,52 @@ +package portalsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSettingsCollection +} + +// ListByService ... +func (c PortalSettingsClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalsettings", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/portalsettings/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/portalsettings/method_listbyservice_autorest.go deleted file mode 100644 index d9168eff5c9..00000000000 --- a/resource-manager/apimanagement/2021-08-01/portalsettings/method_listbyservice_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package portalsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *PortalSettingsCollection -} - -// ListByService ... -func (c PortalSettingsClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "portalsettings.PortalSettingsClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalsettings.PortalSettingsClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalsettings.PortalSettingsClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c PortalSettingsClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c PortalSettingsClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/client.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/client.go index 1de584406fe..869f8329c9a 100644 --- a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/client.go +++ b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/client.go @@ -1,18 +1,26 @@ package privateendpointconnections -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PrivateEndpointConnectionsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(endpoint string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) } + + return &PrivateEndpointConnectionsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/constants.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/constants.go index b6aed9e880a..c5850609650 100644 --- a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/constants.go +++ b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/constants.go @@ -1,6 +1,10 @@ package privateendpointconnections -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { } } +func (s *PrivateEndpointConnectionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { vals := map[string]PrivateEndpointConnectionProvisioningState{ "creating": PrivateEndpointConnectionProvisioningStateCreating, @@ -55,6 +72,19 @@ func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { } } +func (s *PrivateEndpointServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { vals := map[string]PrivateEndpointServiceConnectionStatus{ "approved": PrivateEndpointServiceConnectionStatusApproved, diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate.go new file mode 100644 index 00000000000..f348834c3ca --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate.go @@ -0,0 +1,74 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PrivateEndpointConnectionCreateOrUpdate ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionRequest) (result PrivateEndpointConnectionCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PrivateEndpointConnectionCreateOrUpdateThenPoll performs PrivateEndpointConnectionCreateOrUpdate then polls until it's completed +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionCreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionRequest) error { + result, err := c.PrivateEndpointConnectionCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PrivateEndpointConnectionCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PrivateEndpointConnectionCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate_autorest.go deleted file mode 100644 index f890917081c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionCreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// PrivateEndpointConnectionCreateOrUpdate ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionRequest) (result PrivateEndpointConnectionCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionCreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForPrivateEndpointConnectionCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// PrivateEndpointConnectionCreateOrUpdateThenPoll performs PrivateEndpointConnectionCreateOrUpdate then polls until it's completed -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionCreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionRequest) error { - result, err := c.PrivateEndpointConnectionCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing PrivateEndpointConnectionCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after PrivateEndpointConnectionCreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForPrivateEndpointConnectionCreateOrUpdate prepares the PrivateEndpointConnectionCreateOrUpdate request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionRequest) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForPrivateEndpointConnectionCreateOrUpdate sends the PrivateEndpointConnectionCreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateEndpointConnectionsClient) senderForPrivateEndpointConnectionCreateOrUpdate(ctx context.Context, req *http.Request) (future PrivateEndpointConnectionCreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiondelete.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiondelete.go new file mode 100644 index 00000000000..3dea5aca1b3 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiondelete.go @@ -0,0 +1,71 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PrivateEndpointConnectionDelete ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionDelete(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PrivateEndpointConnectionDeleteThenPoll performs PrivateEndpointConnectionDelete then polls until it's completed +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionDeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { + result, err := c.PrivateEndpointConnectionDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing PrivateEndpointConnectionDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PrivateEndpointConnectionDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiondelete_autorest.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiondelete_autorest.go deleted file mode 100644 index 6c53edbf85b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiondelete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionDeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// PrivateEndpointConnectionDelete ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionDelete(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionDeleteOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionDelete", nil, "Failure preparing request") - return - } - - result, err = c.senderForPrivateEndpointConnectionDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionDelete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// PrivateEndpointConnectionDeleteThenPoll performs PrivateEndpointConnectionDelete then polls until it's completed -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionDeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { - result, err := c.PrivateEndpointConnectionDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing PrivateEndpointConnectionDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after PrivateEndpointConnectionDelete: %+v", err) - } - - return nil -} - -// preparerForPrivateEndpointConnectionDelete prepares the PrivateEndpointConnectionDelete request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionDelete(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForPrivateEndpointConnectionDelete sends the PrivateEndpointConnectionDelete request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateEndpointConnectionsClient) senderForPrivateEndpointConnectionDelete(ctx context.Context, req *http.Request) (future PrivateEndpointConnectionDeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname.go new file mode 100644 index 00000000000..51d57d4f314 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname.go @@ -0,0 +1,51 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionGetByNameOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnection +} + +// PrivateEndpointConnectionGetByName ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionGetByName(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionGetByNameOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname_autorest.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname_autorest.go deleted file mode 100644 index 88167729441..00000000000 --- a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionGetByNameOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnection -} - -// PrivateEndpointConnectionGetByName ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionGetByName(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionGetByNameOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionGetByName(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetByName", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetByName", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionGetByName(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetByName", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionGetByName prepares the PrivateEndpointConnectionGetByName request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionGetByName(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionGetByName handles the response to the PrivateEndpointConnectionGetByName request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForPrivateEndpointConnectionGetByName(resp *http.Response) (result PrivateEndpointConnectionGetByNameOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource.go new file mode 100644 index 00000000000..fd334bbacc0 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource.go @@ -0,0 +1,51 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionGetPrivateLinkResourceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkResource +} + +// PrivateEndpointConnectionGetPrivateLinkResource ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionGetPrivateLinkResource(ctx context.Context, id PrivateLinkResourceId) (result PrivateEndpointConnectionGetPrivateLinkResourceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource_autorest.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource_autorest.go deleted file mode 100644 index 511f46e493e..00000000000 --- a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionGetPrivateLinkResourceOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkResource -} - -// PrivateEndpointConnectionGetPrivateLinkResource ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionGetPrivateLinkResource(ctx context.Context, id PrivateLinkResourceId) (result PrivateEndpointConnectionGetPrivateLinkResourceOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionGetPrivateLinkResource(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetPrivateLinkResource", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetPrivateLinkResource", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionGetPrivateLinkResource(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetPrivateLinkResource", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionGetPrivateLinkResource prepares the PrivateEndpointConnectionGetPrivateLinkResource request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionGetPrivateLinkResource(ctx context.Context, id PrivateLinkResourceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionGetPrivateLinkResource handles the response to the PrivateEndpointConnectionGetPrivateLinkResource request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForPrivateEndpointConnectionGetPrivateLinkResource(resp *http.Response) (result PrivateEndpointConnectionGetPrivateLinkResourceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice.go new file mode 100644 index 00000000000..7ac03e3c251 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice.go @@ -0,0 +1,52 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionListByService ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionListByService(ctx context.Context, id ServiceId) (result PrivateEndpointConnectionListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/privateEndpointConnections", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice_autorest.go deleted file mode 100644 index a3878a76021..00000000000 --- a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnectionListResult -} - -// PrivateEndpointConnectionListByService ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionListByService(ctx context.Context, id ServiceId) (result PrivateEndpointConnectionListByServiceOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionListByService prepares the PrivateEndpointConnectionListByService request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/privateEndpointConnections", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionListByService handles the response to the PrivateEndpointConnectionListByService request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForPrivateEndpointConnectionListByService(resp *http.Response) (result PrivateEndpointConnectionListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources.go new file mode 100644 index 00000000000..5d2881f7c92 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources.go @@ -0,0 +1,52 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionListPrivateLinkResourcesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkResourceListResult +} + +// PrivateEndpointConnectionListPrivateLinkResources ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionListPrivateLinkResources(ctx context.Context, id ServiceId) (result PrivateEndpointConnectionListPrivateLinkResourcesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/privateLinkResources", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources_autorest.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources_autorest.go deleted file mode 100644 index 2a3bdcb3962..00000000000 --- a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionListPrivateLinkResourcesOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkResourceListResult -} - -// PrivateEndpointConnectionListPrivateLinkResources ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionListPrivateLinkResources(ctx context.Context, id ServiceId) (result PrivateEndpointConnectionListPrivateLinkResourcesOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionListPrivateLinkResources(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListPrivateLinkResources", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListPrivateLinkResources", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionListPrivateLinkResources(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListPrivateLinkResources", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionListPrivateLinkResources prepares the PrivateEndpointConnectionListPrivateLinkResources request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionListPrivateLinkResources(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/privateLinkResources", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionListPrivateLinkResources handles the response to the PrivateEndpointConnectionListPrivateLinkResources request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForPrivateEndpointConnectionListPrivateLinkResources(resp *http.Response) (result PrivateEndpointConnectionListPrivateLinkResourcesOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/product/client.go b/resource-manager/apimanagement/2021-08-01/product/client.go index 964cb7131cc..f935e2591bc 100644 --- a/resource-manager/apimanagement/2021-08-01/product/client.go +++ b/resource-manager/apimanagement/2021-08-01/product/client.go @@ -1,18 +1,26 @@ package product -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductClientWithBaseURI(endpoint string) ProductClient { - return ProductClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductClientWithBaseURI(api sdkEnv.Api) (*ProductClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "product", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductClient: %+v", err) } + + return &ProductClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/product/constants.go b/resource-manager/apimanagement/2021-08-01/product/constants.go index d9ad59725fd..b1aa827fdb2 100644 --- a/resource-manager/apimanagement/2021-08-01/product/constants.go +++ b/resource-manager/apimanagement/2021-08-01/product/constants.go @@ -1,6 +1,10 @@ package product -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, diff --git a/resource-manager/apimanagement/2021-08-01/product/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/product/method_createorupdate.go new file mode 100644 index 00000000000..dc69508e31c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/product/method_createorupdate.go @@ -0,0 +1,85 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProductContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ProductClient) CreateOrUpdate(ctx context.Context, id ProductId, input ProductContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/product/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/product/method_createorupdate_autorest.go deleted file mode 100644 index 22bfb9119bf..00000000000 --- a/resource-manager/apimanagement/2021-08-01/product/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package product - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ProductContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ProductClient) CreateOrUpdate(ctx context.Context, id ProductId, input ProductContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ProductClient) preparerForCreateOrUpdate(ctx context.Context, id ProductId, input ProductContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/product/method_delete.go b/resource-manager/apimanagement/2021-08-01/product/method_delete.go new file mode 100644 index 00000000000..a2aebab1182 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/product/method_delete.go @@ -0,0 +1,79 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + DeleteSubscriptions *bool + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.DeleteSubscriptions != nil { + out.Append("deleteSubscriptions", fmt.Sprintf("%v", *o.DeleteSubscriptions)) + } + return &out +} + +// Delete ... +func (c ProductClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/product/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/product/method_delete_autorest.go deleted file mode 100644 index 6646be8a32f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/product/method_delete_autorest.go +++ /dev/null @@ -1,100 +0,0 @@ -package product - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - DeleteSubscriptions *bool - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.DeleteSubscriptions != nil { - out["deleteSubscriptions"] = *o.DeleteSubscriptions - } - - return out -} - -// Delete ... -func (c ProductClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ProductClient) preparerForDelete(ctx context.Context, id ProductId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/product/method_get.go b/resource-manager/apimanagement/2021-08-01/product/method_get.go new file mode 100644 index 00000000000..41152aebc0a --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/product/method_get.go @@ -0,0 +1,51 @@ +package product + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProductContract +} + +// Get ... +func (c ProductClient) Get(ctx context.Context, id ProductId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/product/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/product/method_get_autorest.go deleted file mode 100644 index 42680f3af9f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/product/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package product - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ProductContract -} - -// Get ... -func (c ProductClient) Get(ctx context.Context, id ProductId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ProductClient) preparerForGet(ctx context.Context, id ProductId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/product/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/product/method_getentitytag.go new file mode 100644 index 00000000000..667f4afad59 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/product/method_getentitytag.go @@ -0,0 +1,46 @@ +package product + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ProductClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/product/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/product/method_getentitytag_autorest.go deleted file mode 100644 index b25eb533c2c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/product/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package product - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ProductClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ProductClient) preparerForGetEntityTag(ctx context.Context, id ProductId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/product/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/product/method_listbyservice.go new file mode 100644 index 00000000000..66a835096aa --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/product/method_listbyservice.go @@ -0,0 +1,133 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ProductContract +} + +type ListByServiceCompleteResult struct { + Items []ProductContract +} + +type ListByServiceOperationOptions struct { + ExpandGroups *bool + Filter *string + Skip *int64 + Tags *string + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandGroups != nil { + out.Append("expandGroups", fmt.Sprintf("%v", *o.ExpandGroups)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Tags != nil { + out.Append("tags", fmt.Sprintf("%v", *o.Tags)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ProductClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/products", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ProductContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ProductClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ProductContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ProductContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ProductContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/product/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/product/method_listbyservice_autorest.go deleted file mode 100644 index 5187a25caa7..00000000000 --- a/resource-manager/apimanagement/2021-08-01/product/method_listbyservice_autorest.go +++ /dev/null @@ -1,235 +0,0 @@ -package product - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ProductContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ProductContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - ExpandGroups *bool - Filter *string - Skip *int64 - Tags *string - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ExpandGroups != nil { - out["expandGroups"] = *o.ExpandGroups - } - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Tags != nil { - out["tags"] = *o.Tags - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ProductClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ProductClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/products", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ProductClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ProductContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ProductClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ProductContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ProductContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ProductContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/product/method_update.go b/resource-manager/apimanagement/2021-08-01/product/method_update.go new file mode 100644 index 00000000000..a9a59bd595e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/product/method_update.go @@ -0,0 +1,84 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProductContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ProductClient) Update(ctx context.Context, id ProductId, input ProductUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/product/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/product/method_update_autorest.go deleted file mode 100644 index d0fbe1007f8..00000000000 --- a/resource-manager/apimanagement/2021-08-01/product/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package product - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *ProductContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ProductClient) Update(ctx context.Context, id ProductId, input ProductUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ProductClient) preparerForUpdate(ctx context.Context, id ProductId, input ProductUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productapi/client.go b/resource-manager/apimanagement/2021-08-01/productapi/client.go index 5241293a527..a3437408d7d 100644 --- a/resource-manager/apimanagement/2021-08-01/productapi/client.go +++ b/resource-manager/apimanagement/2021-08-01/productapi/client.go @@ -1,18 +1,26 @@ package productapi -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductApiClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductApiClientWithBaseURI(endpoint string) ProductApiClient { - return ProductApiClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductApiClientWithBaseURI(api sdkEnv.Api) (*ProductApiClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "productapi", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductApiClient: %+v", err) } + + return &ProductApiClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/productapi/constants.go b/resource-manager/apimanagement/2021-08-01/productapi/constants.go index 0b289271d26..a2efe7f0641 100644 --- a/resource-manager/apimanagement/2021-08-01/productapi/constants.go +++ b/resource-manager/apimanagement/2021-08-01/productapi/constants.go @@ -1,6 +1,10 @@ package productapi -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -85,6 +115,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, @@ -117,6 +160,19 @@ func PossibleValuesForVersioningScheme() []string { } } +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVersioningScheme(input string) (*VersioningScheme, error) { vals := map[string]VersioningScheme{ "header": VersioningSchemeHeader, diff --git a/resource-manager/apimanagement/2021-08-01/productapi/method_checkentityexists.go b/resource-manager/apimanagement/2021-08-01/productapi/method_checkentityexists.go new file mode 100644 index 00000000000..69d91adfcef --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productapi/method_checkentityexists.go @@ -0,0 +1,46 @@ +package productapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c ProductApiClient) CheckEntityExists(ctx context.Context, id ProductApiId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productapi/method_checkentityexists_autorest.go b/resource-manager/apimanagement/2021-08-01/productapi/method_checkentityexists_autorest.go deleted file mode 100644 index 37008921ef3..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productapi/method_checkentityexists_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package productapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckEntityExistsOperationResponse struct { - HttpResponse *http.Response -} - -// CheckEntityExists ... -func (c ProductApiClient) CheckEntityExists(ctx context.Context, id ProductApiId) (result CheckEntityExistsOperationResponse, err error) { - req, err := c.preparerForCheckEntityExists(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CheckEntityExists", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckEntityExists(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CheckEntityExists", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckEntityExists prepares the CheckEntityExists request. -func (c ProductApiClient) preparerForCheckEntityExists(ctx context.Context, id ProductApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckEntityExists handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (c ProductApiClient) responderForCheckEntityExists(resp *http.Response) (result CheckEntityExistsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productapi/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/productapi/method_createorupdate.go new file mode 100644 index 00000000000..cfa64d59695 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productapi/method_createorupdate.go @@ -0,0 +1,52 @@ +package productapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +// CreateOrUpdate ... +func (c ProductApiClient) CreateOrUpdate(ctx context.Context, id ProductApiId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productapi/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/productapi/method_createorupdate_autorest.go deleted file mode 100644 index 1df50bc936d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productapi/method_createorupdate_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package productapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiContract -} - -// CreateOrUpdate ... -func (c ProductApiClient) CreateOrUpdate(ctx context.Context, id ProductApiId) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ProductApiClient) preparerForCreateOrUpdate(ctx context.Context, id ProductApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ProductApiClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productapi/method_delete.go b/resource-manager/apimanagement/2021-08-01/productapi/method_delete.go new file mode 100644 index 00000000000..da188ce2e72 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productapi/method_delete.go @@ -0,0 +1,47 @@ +package productapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ProductApiClient) Delete(ctx context.Context, id ProductApiId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productapi/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/productapi/method_delete_autorest.go deleted file mode 100644 index b31ea2b6eef..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productapi/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package productapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c ProductApiClient) Delete(ctx context.Context, id ProductApiId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ProductApiClient) preparerForDelete(ctx context.Context, id ProductApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ProductApiClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productapi/method_listbyproduct.go b/resource-manager/apimanagement/2021-08-01/productapi/method_listbyproduct.go new file mode 100644 index 00000000000..fbe56652d12 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productapi/method_listbyproduct.go @@ -0,0 +1,125 @@ +package productapi + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiContract +} + +type ListByProductCompleteResult struct { + Items []ApiContract +} + +type ListByProductOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByProductOperationOptions() ListByProductOperationOptions { + return ListByProductOperationOptions{} +} + +func (o ListByProductOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByProductOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByProductOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByProduct ... +func (c ProductApiClient) ListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (result ListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apis", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByProductComplete retrieves all the results into a single object +func (c ProductApiClient) ListByProductComplete(ctx context.Context, id ProductId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { + return c.ListByProductCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) +} + +// ListByProductCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductApiClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListByProductOperationOptions, predicate ApiContractOperationPredicate) (result ListByProductCompleteResult, err error) { + items := make([]ApiContract, 0) + + resp, err := c.ListByProduct(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByProductCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productapi/method_listbyproduct_autorest.go b/resource-manager/apimanagement/2021-08-01/productapi/method_listbyproduct_autorest.go deleted file mode 100644 index 5a0bdb0c971..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productapi/method_listbyproduct_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package productapi - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByProductOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByProductOperationResponse, error) -} - -type ListByProductCompleteResult struct { - Items []ApiContract -} - -func (r ListByProductOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByProductOperationResponse) LoadMore(ctx context.Context) (resp ListByProductOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByProductOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByProductOperationOptions() ListByProductOperationOptions { - return ListByProductOperationOptions{} -} - -func (o ListByProductOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByProductOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByProduct ... -func (c ProductApiClient) ListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (resp ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProduct(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByProduct(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByProduct prepares the ListByProduct request. -func (c ProductApiClient) preparerForListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/apis", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByProductWithNextLink prepares the ListByProduct request with the given nextLink token. -func (c ProductApiClient) preparerForListByProductWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByProduct handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (c ProductApiClient) responderForListByProduct(resp *http.Response) (result ListByProductOperationResponse, err error) { - type page struct { - Values []ApiContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProductWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByProductComplete retrieves all of the results into a single object -func (c ProductApiClient) ListByProductComplete(ctx context.Context, id ProductId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { - return c.ListByProductCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) -} - -// ListByProductCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductApiClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListByProductOperationOptions, predicate ApiContractOperationPredicate) (resp ListByProductCompleteResult, err error) { - items := make([]ApiContract, 0) - - page, err := c.ListByProduct(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByProductCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/client.go b/resource-manager/apimanagement/2021-08-01/productgroup/client.go index 08ea091f6e7..d5a21f3aa0e 100644 --- a/resource-manager/apimanagement/2021-08-01/productgroup/client.go +++ b/resource-manager/apimanagement/2021-08-01/productgroup/client.go @@ -1,18 +1,26 @@ package productgroup -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductGroupClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductGroupClientWithBaseURI(endpoint string) ProductGroupClient { - return ProductGroupClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductGroupClientWithBaseURI(api sdkEnv.Api) (*ProductGroupClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "productgroup", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductGroupClient: %+v", err) } + + return &ProductGroupClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/constants.go b/resource-manager/apimanagement/2021-08-01/productgroup/constants.go index 07ce1de89e9..6ff85f660bd 100644 --- a/resource-manager/apimanagement/2021-08-01/productgroup/constants.go +++ b/resource-manager/apimanagement/2021-08-01/productgroup/constants.go @@ -1,6 +1,10 @@ package productgroup -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForGroupType() []string { } } +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGroupType(input string) (*GroupType, error) { vals := map[string]GroupType{ "custom": GroupTypeCustom, diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/method_checkentityexists.go b/resource-manager/apimanagement/2021-08-01/productgroup/method_checkentityexists.go new file mode 100644 index 00000000000..fd90f4c41cf --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productgroup/method_checkentityexists.go @@ -0,0 +1,46 @@ +package productgroup + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c ProductGroupClient) CheckEntityExists(ctx context.Context, id ProductGroupId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/method_checkentityexists_autorest.go b/resource-manager/apimanagement/2021-08-01/productgroup/method_checkentityexists_autorest.go deleted file mode 100644 index 034a222674f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productgroup/method_checkentityexists_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package productgroup - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckEntityExistsOperationResponse struct { - HttpResponse *http.Response -} - -// CheckEntityExists ... -func (c ProductGroupClient) CheckEntityExists(ctx context.Context, id ProductGroupId) (result CheckEntityExistsOperationResponse, err error) { - req, err := c.preparerForCheckEntityExists(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CheckEntityExists", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckEntityExists(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CheckEntityExists", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckEntityExists prepares the CheckEntityExists request. -func (c ProductGroupClient) preparerForCheckEntityExists(ctx context.Context, id ProductGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckEntityExists handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (c ProductGroupClient) responderForCheckEntityExists(resp *http.Response) (result CheckEntityExistsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/productgroup/method_createorupdate.go new file mode 100644 index 00000000000..20656a3ff19 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productgroup/method_createorupdate.go @@ -0,0 +1,52 @@ +package productgroup + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +// CreateOrUpdate ... +func (c ProductGroupClient) CreateOrUpdate(ctx context.Context, id ProductGroupId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/productgroup/method_createorupdate_autorest.go deleted file mode 100644 index 578f327aa82..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productgroup/method_createorupdate_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package productgroup - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *GroupContract -} - -// CreateOrUpdate ... -func (c ProductGroupClient) CreateOrUpdate(ctx context.Context, id ProductGroupId) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ProductGroupClient) preparerForCreateOrUpdate(ctx context.Context, id ProductGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ProductGroupClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/method_delete.go b/resource-manager/apimanagement/2021-08-01/productgroup/method_delete.go new file mode 100644 index 00000000000..3f6b1c8820e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productgroup/method_delete.go @@ -0,0 +1,47 @@ +package productgroup + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ProductGroupClient) Delete(ctx context.Context, id ProductGroupId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/productgroup/method_delete_autorest.go deleted file mode 100644 index 0bc4bd9be4c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productgroup/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package productgroup - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c ProductGroupClient) Delete(ctx context.Context, id ProductGroupId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ProductGroupClient) preparerForDelete(ctx context.Context, id ProductGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ProductGroupClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/method_listbyproduct.go b/resource-manager/apimanagement/2021-08-01/productgroup/method_listbyproduct.go new file mode 100644 index 00000000000..483d84c6da7 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productgroup/method_listbyproduct.go @@ -0,0 +1,125 @@ +package productgroup + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GroupContract +} + +type ListByProductCompleteResult struct { + Items []GroupContract +} + +type ListByProductOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByProductOperationOptions() ListByProductOperationOptions { + return ListByProductOperationOptions{} +} + +func (o ListByProductOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByProductOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByProductOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByProduct ... +func (c ProductGroupClient) ListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (result ListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/groups", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GroupContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByProductComplete retrieves all the results into a single object +func (c ProductGroupClient) ListByProductComplete(ctx context.Context, id ProductId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { + return c.ListByProductCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) +} + +// ListByProductCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductGroupClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListByProductOperationOptions, predicate GroupContractOperationPredicate) (result ListByProductCompleteResult, err error) { + items := make([]GroupContract, 0) + + resp, err := c.ListByProduct(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByProductCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/method_listbyproduct_autorest.go b/resource-manager/apimanagement/2021-08-01/productgroup/method_listbyproduct_autorest.go deleted file mode 100644 index f5f186c5b31..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productgroup/method_listbyproduct_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package productgroup - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByProductOperationResponse struct { - HttpResponse *http.Response - Model *[]GroupContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByProductOperationResponse, error) -} - -type ListByProductCompleteResult struct { - Items []GroupContract -} - -func (r ListByProductOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByProductOperationResponse) LoadMore(ctx context.Context) (resp ListByProductOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByProductOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByProductOperationOptions() ListByProductOperationOptions { - return ListByProductOperationOptions{} -} - -func (o ListByProductOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByProductOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByProduct ... -func (c ProductGroupClient) ListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (resp ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProduct(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByProduct(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByProduct prepares the ListByProduct request. -func (c ProductGroupClient) preparerForListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/groups", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByProductWithNextLink prepares the ListByProduct request with the given nextLink token. -func (c ProductGroupClient) preparerForListByProductWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByProduct handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (c ProductGroupClient) responderForListByProduct(resp *http.Response) (result ListByProductOperationResponse, err error) { - type page struct { - Values []GroupContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProductWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByProductComplete retrieves all of the results into a single object -func (c ProductGroupClient) ListByProductComplete(ctx context.Context, id ProductId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { - return c.ListByProductCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) -} - -// ListByProductCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductGroupClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListByProductOperationOptions, predicate GroupContractOperationPredicate) (resp ListByProductCompleteResult, err error) { - items := make([]GroupContract, 0) - - page, err := c.ListByProduct(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByProductCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/client.go b/resource-manager/apimanagement/2021-08-01/productpolicy/client.go index dfce4d67a5d..329f197dd22 100644 --- a/resource-manager/apimanagement/2021-08-01/productpolicy/client.go +++ b/resource-manager/apimanagement/2021-08-01/productpolicy/client.go @@ -1,18 +1,26 @@ package productpolicy -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductPolicyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductPolicyClientWithBaseURI(endpoint string) ProductPolicyClient { - return ProductPolicyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductPolicyClientWithBaseURI(api sdkEnv.Api) (*ProductPolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "productpolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductPolicyClient: %+v", err) } + + return &ProductPolicyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/constants.go b/resource-manager/apimanagement/2021-08-01/productpolicy/constants.go index 9408a1eb3a8..196b57d596f 100644 --- a/resource-manager/apimanagement/2021-08-01/productpolicy/constants.go +++ b/resource-manager/apimanagement/2021-08-01/productpolicy/constants.go @@ -1,6 +1,10 @@ package productpolicy -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPolicyContentFormat() []string { } } +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { vals := map[string]PolicyContentFormat{ "rawxml": PolicyContentFormatRawxml, @@ -53,6 +70,19 @@ func PossibleValuesForPolicyExportFormat() []string { } } +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { vals := map[string]PolicyExportFormat{ "rawxml": PolicyExportFormatRawxml, diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/productpolicy/method_createorupdate.go new file mode 100644 index 00000000000..0471e0e461f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productpolicy/method_createorupdate.go @@ -0,0 +1,85 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ProductPolicyClient) CreateOrUpdate(ctx context.Context, id ProductId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/productpolicy/method_createorupdate_autorest.go deleted file mode 100644 index 43f5c165d57..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productpolicy/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package productpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ProductPolicyClient) CreateOrUpdate(ctx context.Context, id ProductId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ProductPolicyClient) preparerForCreateOrUpdate(ctx context.Context, id ProductId, input PolicyContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ProductPolicyClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/method_delete.go b/resource-manager/apimanagement/2021-08-01/productpolicy/method_delete.go new file mode 100644 index 00000000000..09bc23bd22e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productpolicy/method_delete.go @@ -0,0 +1,76 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ProductPolicyClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/productpolicy/method_delete_autorest.go deleted file mode 100644 index d18f700767f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productpolicy/method_delete_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package productpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ProductPolicyClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ProductPolicyClient) preparerForDelete(ctx context.Context, id ProductId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ProductPolicyClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/method_get.go b/resource-manager/apimanagement/2021-08-01/productpolicy/method_get.go new file mode 100644 index 00000000000..46284c64c32 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productpolicy/method_get.go @@ -0,0 +1,80 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c ProductPolicyClient) Get(ctx context.Context, id ProductId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/productpolicy/method_get_autorest.go deleted file mode 100644 index b2933e55f93..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productpolicy/method_get_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package productpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type GetOperationOptions struct { - Format *PolicyExportFormat -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - return out -} - -// Get ... -func (c ProductPolicyClient) Get(ctx context.Context, id ProductId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ProductPolicyClient) preparerForGet(ctx context.Context, id ProductId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ProductPolicyClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/productpolicy/method_getentitytag.go new file mode 100644 index 00000000000..3e3787982d6 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productpolicy/method_getentitytag.go @@ -0,0 +1,47 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ProductPolicyClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/productpolicy/method_getentitytag_autorest.go deleted file mode 100644 index f446b88fb66..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productpolicy/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package productpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ProductPolicyClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ProductPolicyClient) preparerForGetEntityTag(ctx context.Context, id ProductId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ProductPolicyClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/method_listbyproduct.go b/resource-manager/apimanagement/2021-08-01/productpolicy/method_listbyproduct.go new file mode 100644 index 00000000000..d9cbc9812e4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productpolicy/method_listbyproduct.go @@ -0,0 +1,52 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByProduct ... +func (c ProductPolicyClient) ListByProduct(ctx context.Context, id ProductId) (result ListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/method_listbyproduct_autorest.go b/resource-manager/apimanagement/2021-08-01/productpolicy/method_listbyproduct_autorest.go deleted file mode 100644 index 40fab3bcf62..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productpolicy/method_listbyproduct_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package productpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByProductOperationResponse struct { - HttpResponse *http.Response - Model *PolicyCollection -} - -// ListByProduct ... -func (c ProductPolicyClient) ListByProduct(ctx context.Context, id ProductId) (result ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProduct(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "ListByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "ListByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "ListByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByProduct prepares the ListByProduct request. -func (c ProductPolicyClient) preparerForListByProduct(ctx context.Context, id ProductId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByProduct handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (c ProductPolicyClient) responderForListByProduct(resp *http.Response) (result ListByProductOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/productsbytag/client.go b/resource-manager/apimanagement/2021-08-01/productsbytag/client.go index 819f4c151ff..fd8812ebfff 100644 --- a/resource-manager/apimanagement/2021-08-01/productsbytag/client.go +++ b/resource-manager/apimanagement/2021-08-01/productsbytag/client.go @@ -1,18 +1,26 @@ package productsbytag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductsByTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductsByTagClientWithBaseURI(endpoint string) ProductsByTagClient { - return ProductsByTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductsByTagClientWithBaseURI(api sdkEnv.Api) (*ProductsByTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "productsbytag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductsByTagClient: %+v", err) } + + return &ProductsByTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/productsbytag/constants.go b/resource-manager/apimanagement/2021-08-01/productsbytag/constants.go index a3a2af687c4..6380c578cd4 100644 --- a/resource-manager/apimanagement/2021-08-01/productsbytag/constants.go +++ b/resource-manager/apimanagement/2021-08-01/productsbytag/constants.go @@ -1,6 +1,10 @@ package productsbytag -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -81,6 +111,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, @@ -113,6 +156,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, diff --git a/resource-manager/apimanagement/2021-08-01/productsbytag/method_productlistbytags.go b/resource-manager/apimanagement/2021-08-01/productsbytag/method_productlistbytags.go new file mode 100644 index 00000000000..bd145c12a02 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productsbytag/method_productlistbytags.go @@ -0,0 +1,129 @@ +package productsbytag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductListByTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagResourceContract +} + +type ProductListByTagsCompleteResult struct { + Items []TagResourceContract +} + +type ProductListByTagsOperationOptions struct { + Filter *string + IncludeNotTaggedProducts *bool + Skip *int64 + Top *int64 +} + +func DefaultProductListByTagsOperationOptions() ProductListByTagsOperationOptions { + return ProductListByTagsOperationOptions{} +} + +func (o ProductListByTagsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ProductListByTagsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ProductListByTagsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IncludeNotTaggedProducts != nil { + out.Append("includeNotTaggedProducts", fmt.Sprintf("%v", *o.IncludeNotTaggedProducts)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ProductListByTags ... +func (c ProductsByTagClient) ProductListByTags(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions) (result ProductListByTagsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/productsByTags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagResourceContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ProductListByTagsComplete retrieves all the results into a single object +func (c ProductsByTagClient) ProductListByTagsComplete(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions) (ProductListByTagsCompleteResult, error) { + return c.ProductListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) +} + +// ProductListByTagsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductsByTagClient) ProductListByTagsCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (result ProductListByTagsCompleteResult, err error) { + items := make([]TagResourceContract, 0) + + resp, err := c.ProductListByTags(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ProductListByTagsCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productsbytag/method_productlistbytags_autorest.go b/resource-manager/apimanagement/2021-08-01/productsbytag/method_productlistbytags_autorest.go deleted file mode 100644 index 2cff77a5a10..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productsbytag/method_productlistbytags_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package productsbytag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ProductListByTagsOperationResponse struct { - HttpResponse *http.Response - Model *[]TagResourceContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ProductListByTagsOperationResponse, error) -} - -type ProductListByTagsCompleteResult struct { - Items []TagResourceContract -} - -func (r ProductListByTagsOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ProductListByTagsOperationResponse) LoadMore(ctx context.Context) (resp ProductListByTagsOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ProductListByTagsOperationOptions struct { - Filter *string - IncludeNotTaggedProducts *bool - Skip *int64 - Top *int64 -} - -func DefaultProductListByTagsOperationOptions() ProductListByTagsOperationOptions { - return ProductListByTagsOperationOptions{} -} - -func (o ProductListByTagsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ProductListByTagsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.IncludeNotTaggedProducts != nil { - out["includeNotTaggedProducts"] = *o.IncludeNotTaggedProducts - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ProductListByTags ... -func (c ProductsByTagClient) ProductListByTags(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions) (resp ProductListByTagsOperationResponse, err error) { - req, err := c.preparerForProductListByTags(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForProductListByTags(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForProductListByTags prepares the ProductListByTags request. -func (c ProductsByTagClient) preparerForProductListByTags(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/productsByTags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForProductListByTagsWithNextLink prepares the ProductListByTags request with the given nextLink token. -func (c ProductsByTagClient) preparerForProductListByTagsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForProductListByTags handles the response to the ProductListByTags request. The method always -// closes the http.Response Body. -func (c ProductsByTagClient) responderForProductListByTags(resp *http.Response) (result ProductListByTagsOperationResponse, err error) { - type page struct { - Values []TagResourceContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ProductListByTagsOperationResponse, err error) { - req, err := c.preparerForProductListByTagsWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForProductListByTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ProductListByTagsComplete retrieves all of the results into a single object -func (c ProductsByTagClient) ProductListByTagsComplete(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions) (ProductListByTagsCompleteResult, error) { - return c.ProductListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) -} - -// ProductListByTagsCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductsByTagClient) ProductListByTagsCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (resp ProductListByTagsCompleteResult, err error) { - items := make([]TagResourceContract, 0) - - page, err := c.ProductListByTags(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ProductListByTagsCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/productsubscription/client.go b/resource-manager/apimanagement/2021-08-01/productsubscription/client.go index e6fc998ab6f..12d5d6aa707 100644 --- a/resource-manager/apimanagement/2021-08-01/productsubscription/client.go +++ b/resource-manager/apimanagement/2021-08-01/productsubscription/client.go @@ -1,18 +1,26 @@ package productsubscription -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductSubscriptionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductSubscriptionClientWithBaseURI(endpoint string) ProductSubscriptionClient { - return ProductSubscriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductSubscriptionClientWithBaseURI(api sdkEnv.Api) (*ProductSubscriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "productsubscription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductSubscriptionClient: %+v", err) } + + return &ProductSubscriptionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/productsubscription/constants.go b/resource-manager/apimanagement/2021-08-01/productsubscription/constants.go index 3d9bc9cb116..b701ce04fea 100644 --- a/resource-manager/apimanagement/2021-08-01/productsubscription/constants.go +++ b/resource-manager/apimanagement/2021-08-01/productsubscription/constants.go @@ -1,6 +1,10 @@ package productsubscription -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -27,6 +31,19 @@ func PossibleValuesForSubscriptionState() []string { } } +func (s *SubscriptionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSubscriptionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSubscriptionState(input string) (*SubscriptionState, error) { vals := map[string]SubscriptionState{ "active": SubscriptionStateActive, diff --git a/resource-manager/apimanagement/2021-08-01/productsubscription/method_list.go b/resource-manager/apimanagement/2021-08-01/productsubscription/method_list.go new file mode 100644 index 00000000000..6e4d8a7a32c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/productsubscription/method_list.go @@ -0,0 +1,125 @@ +package productsubscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SubscriptionContract +} + +type ListCompleteResult struct { + Items []SubscriptionContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c ProductSubscriptionClient) List(ctx context.Context, id ProductId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/subscriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SubscriptionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ProductSubscriptionClient) ListComplete(ctx context.Context, id ProductId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductSubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]SubscriptionContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/productsubscription/method_list_autorest.go b/resource-manager/apimanagement/2021-08-01/productsubscription/method_list_autorest.go deleted file mode 100644 index c90464fedfa..00000000000 --- a/resource-manager/apimanagement/2021-08-01/productsubscription/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package productsubscription - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]SubscriptionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []SubscriptionContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c ProductSubscriptionClient) List(ctx context.Context, id ProductId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ProductSubscriptionClient) preparerForList(ctx context.Context, id ProductId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/subscriptions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ProductSubscriptionClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ProductSubscriptionClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []SubscriptionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ProductSubscriptionClient) ListComplete(ctx context.Context, id ProductId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductSubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]SubscriptionContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/producttag/client.go b/resource-manager/apimanagement/2021-08-01/producttag/client.go index 852ad05f1e6..543b28deb80 100644 --- a/resource-manager/apimanagement/2021-08-01/producttag/client.go +++ b/resource-manager/apimanagement/2021-08-01/producttag/client.go @@ -1,18 +1,26 @@ package producttag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductTagClientWithBaseURI(endpoint string) ProductTagClient { - return ProductTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductTagClientWithBaseURI(api sdkEnv.Api) (*ProductTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "producttag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductTagClient: %+v", err) } + + return &ProductTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/producttag/method_tagassigntoproduct.go b/resource-manager/apimanagement/2021-08-01/producttag/method_tagassigntoproduct.go new file mode 100644 index 00000000000..55885dbd935 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/producttag/method_tagassigntoproduct.go @@ -0,0 +1,52 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagAssignToProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagAssignToProduct ... +func (c ProductTagClient) TagAssignToProduct(ctx context.Context, id ProductTagId) (result TagAssignToProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/producttag/method_tagassigntoproduct_autorest.go b/resource-manager/apimanagement/2021-08-01/producttag/method_tagassigntoproduct_autorest.go deleted file mode 100644 index 6a0b20cfc9a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/producttag/method_tagassigntoproduct_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package producttag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagAssignToProductOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagAssignToProduct ... -func (c ProductTagClient) TagAssignToProduct(ctx context.Context, id ProductTagId) (result TagAssignToProductOperationResponse, err error) { - req, err := c.preparerForTagAssignToProduct(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagAssignToProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagAssignToProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagAssignToProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagAssignToProduct", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagAssignToProduct prepares the TagAssignToProduct request. -func (c ProductTagClient) preparerForTagAssignToProduct(ctx context.Context, id ProductTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagAssignToProduct handles the response to the TagAssignToProduct request. The method always -// closes the http.Response Body. -func (c ProductTagClient) responderForTagAssignToProduct(resp *http.Response) (result TagAssignToProductOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/producttag/method_tagdetachfromproduct.go b/resource-manager/apimanagement/2021-08-01/producttag/method_tagdetachfromproduct.go new file mode 100644 index 00000000000..9564ceb67e1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/producttag/method_tagdetachfromproduct.go @@ -0,0 +1,47 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDetachFromProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagDetachFromProduct ... +func (c ProductTagClient) TagDetachFromProduct(ctx context.Context, id ProductTagId) (result TagDetachFromProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/producttag/method_tagdetachfromproduct_autorest.go b/resource-manager/apimanagement/2021-08-01/producttag/method_tagdetachfromproduct_autorest.go deleted file mode 100644 index de37a803293..00000000000 --- a/resource-manager/apimanagement/2021-08-01/producttag/method_tagdetachfromproduct_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package producttag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagDetachFromProductOperationResponse struct { - HttpResponse *http.Response -} - -// TagDetachFromProduct ... -func (c ProductTagClient) TagDetachFromProduct(ctx context.Context, id ProductTagId) (result TagDetachFromProductOperationResponse, err error) { - req, err := c.preparerForTagDetachFromProduct(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagDetachFromProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagDetachFromProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagDetachFromProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagDetachFromProduct", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagDetachFromProduct prepares the TagDetachFromProduct request. -func (c ProductTagClient) preparerForTagDetachFromProduct(ctx context.Context, id ProductTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagDetachFromProduct handles the response to the TagDetachFromProduct request. The method always -// closes the http.Response Body. -func (c ProductTagClient) responderForTagDetachFromProduct(resp *http.Response) (result TagDetachFromProductOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/producttag/method_taggetbyproduct.go b/resource-manager/apimanagement/2021-08-01/producttag/method_taggetbyproduct.go new file mode 100644 index 00000000000..413a4b52b72 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/producttag/method_taggetbyproduct.go @@ -0,0 +1,51 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagGetByProduct ... +func (c ProductTagClient) TagGetByProduct(ctx context.Context, id ProductTagId) (result TagGetByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/producttag/method_taggetbyproduct_autorest.go b/resource-manager/apimanagement/2021-08-01/producttag/method_taggetbyproduct_autorest.go deleted file mode 100644 index beb3693330c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/producttag/method_taggetbyproduct_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package producttag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetByProductOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagGetByProduct ... -func (c ProductTagClient) TagGetByProduct(ctx context.Context, id ProductTagId) (result TagGetByProductOperationResponse, err error) { - req, err := c.preparerForTagGetByProduct(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetByProduct prepares the TagGetByProduct request. -func (c ProductTagClient) preparerForTagGetByProduct(ctx context.Context, id ProductTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetByProduct handles the response to the TagGetByProduct request. The method always -// closes the http.Response Body. -func (c ProductTagClient) responderForTagGetByProduct(resp *http.Response) (result TagGetByProductOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/producttag/method_taggetentitystatebyproduct.go b/resource-manager/apimanagement/2021-08-01/producttag/method_taggetentitystatebyproduct.go new file mode 100644 index 00000000000..8f023009406 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/producttag/method_taggetentitystatebyproduct.go @@ -0,0 +1,46 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetEntityStateByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagGetEntityStateByProduct ... +func (c ProductTagClient) TagGetEntityStateByProduct(ctx context.Context, id ProductTagId) (result TagGetEntityStateByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/producttag/method_taggetentitystatebyproduct_autorest.go b/resource-manager/apimanagement/2021-08-01/producttag/method_taggetentitystatebyproduct_autorest.go deleted file mode 100644 index ba4e65f8cd1..00000000000 --- a/resource-manager/apimanagement/2021-08-01/producttag/method_taggetentitystatebyproduct_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package producttag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetEntityStateByProductOperationResponse struct { - HttpResponse *http.Response -} - -// TagGetEntityStateByProduct ... -func (c ProductTagClient) TagGetEntityStateByProduct(ctx context.Context, id ProductTagId) (result TagGetEntityStateByProductOperationResponse, err error) { - req, err := c.preparerForTagGetEntityStateByProduct(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetEntityStateByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetEntityStateByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetEntityStateByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetEntityStateByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetEntityStateByProduct prepares the TagGetEntityStateByProduct request. -func (c ProductTagClient) preparerForTagGetEntityStateByProduct(ctx context.Context, id ProductTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetEntityStateByProduct handles the response to the TagGetEntityStateByProduct request. The method always -// closes the http.Response Body. -func (c ProductTagClient) responderForTagGetEntityStateByProduct(resp *http.Response) (result TagGetEntityStateByProductOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/producttag/method_taglistbyproduct.go b/resource-manager/apimanagement/2021-08-01/producttag/method_taglistbyproduct.go new file mode 100644 index 00000000000..0b73c472a25 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/producttag/method_taglistbyproduct.go @@ -0,0 +1,125 @@ +package producttag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type TagListByProductCompleteResult struct { + Items []TagContract +} + +type TagListByProductOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultTagListByProductOperationOptions() TagListByProductOperationOptions { + return TagListByProductOperationOptions{} +} + +func (o TagListByProductOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o TagListByProductOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o TagListByProductOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// TagListByProduct ... +func (c ProductTagClient) TagListByProduct(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (result TagListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// TagListByProductComplete retrieves all the results into a single object +func (c ProductTagClient) TagListByProductComplete(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (TagListByProductCompleteResult, error) { + return c.TagListByProductCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// TagListByProductCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductTagClient) TagListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options TagListByProductOperationOptions, predicate TagContractOperationPredicate) (result TagListByProductCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.TagListByProduct(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = TagListByProductCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/producttag/method_taglistbyproduct_autorest.go b/resource-manager/apimanagement/2021-08-01/producttag/method_taglistbyproduct_autorest.go deleted file mode 100644 index f0717ee0f77..00000000000 --- a/resource-manager/apimanagement/2021-08-01/producttag/method_taglistbyproduct_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package producttag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagListByProductOperationResponse struct { - HttpResponse *http.Response - Model *[]TagContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (TagListByProductOperationResponse, error) -} - -type TagListByProductCompleteResult struct { - Items []TagContract -} - -func (r TagListByProductOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r TagListByProductOperationResponse) LoadMore(ctx context.Context) (resp TagListByProductOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type TagListByProductOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultTagListByProductOperationOptions() TagListByProductOperationOptions { - return TagListByProductOperationOptions{} -} - -func (o TagListByProductOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o TagListByProductOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// TagListByProduct ... -func (c ProductTagClient) TagListByProduct(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (resp TagListByProductOperationResponse, err error) { - req, err := c.preparerForTagListByProduct(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForTagListByProduct(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForTagListByProduct prepares the TagListByProduct request. -func (c ProductTagClient) preparerForTagListByProduct(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForTagListByProductWithNextLink prepares the TagListByProduct request with the given nextLink token. -func (c ProductTagClient) preparerForTagListByProductWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagListByProduct handles the response to the TagListByProduct request. The method always -// closes the http.Response Body. -func (c ProductTagClient) responderForTagListByProduct(resp *http.Response) (result TagListByProductOperationResponse, err error) { - type page struct { - Values []TagContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result TagListByProductOperationResponse, err error) { - req, err := c.preparerForTagListByProductWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagListByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// TagListByProductComplete retrieves all of the results into a single object -func (c ProductTagClient) TagListByProductComplete(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (TagListByProductCompleteResult, error) { - return c.TagListByProductCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) -} - -// TagListByProductCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductTagClient) TagListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options TagListByProductOperationOptions, predicate TagContractOperationPredicate) (resp TagListByProductCompleteResult, err error) { - items := make([]TagContract, 0) - - page, err := c.TagListByProduct(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := TagListByProductCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/client.go b/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/client.go index 2671480732c..1e508477264 100644 --- a/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/client.go +++ b/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/client.go @@ -1,18 +1,26 @@ package quotabycounterkeys -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type QuotaByCounterKeysClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewQuotaByCounterKeysClientWithBaseURI(endpoint string) QuotaByCounterKeysClient { - return QuotaByCounterKeysClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewQuotaByCounterKeysClientWithBaseURI(api sdkEnv.Api) (*QuotaByCounterKeysClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "quotabycounterkeys", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating QuotaByCounterKeysClient: %+v", err) } + + return &QuotaByCounterKeysClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_listbyservice.go new file mode 100644 index 00000000000..dea7040ba8b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_listbyservice.go @@ -0,0 +1,51 @@ +package quotabycounterkeys + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *QuotaCounterCollection +} + +// ListByService ... +func (c QuotaByCounterKeysClient) ListByService(ctx context.Context, id QuotaId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_listbyservice_autorest.go deleted file mode 100644 index bc4c2e7a4c2..00000000000 --- a/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_listbyservice_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package quotabycounterkeys - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *QuotaCounterCollection -} - -// ListByService ... -func (c QuotaByCounterKeysClient) ListByService(ctx context.Context, id QuotaId) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c QuotaByCounterKeysClient) preparerForListByService(ctx context.Context, id QuotaId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c QuotaByCounterKeysClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_update.go b/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_update.go new file mode 100644 index 00000000000..f9bc3fcc0d4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_update.go @@ -0,0 +1,55 @@ +package quotabycounterkeys + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *QuotaCounterCollection +} + +// Update ... +func (c QuotaByCounterKeysClient) Update(ctx context.Context, id QuotaId, input QuotaCounterValueUpdateContract) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_update_autorest.go deleted file mode 100644 index 4acf4507ad4..00000000000 --- a/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/method_update_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package quotabycounterkeys - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *QuotaCounterCollection -} - -// Update ... -func (c QuotaByCounterKeysClient) Update(ctx context.Context, id QuotaId, input QuotaCounterValueUpdateContract) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c QuotaByCounterKeysClient) preparerForUpdate(ctx context.Context, id QuotaId, input QuotaCounterValueUpdateContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c QuotaByCounterKeysClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/client.go b/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/client.go index 09577f5147f..d102ff247cf 100644 --- a/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/client.go +++ b/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/client.go @@ -1,18 +1,26 @@ package quotabyperiodkeys -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type QuotaByPeriodKeysClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewQuotaByPeriodKeysClientWithBaseURI(endpoint string) QuotaByPeriodKeysClient { - return QuotaByPeriodKeysClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewQuotaByPeriodKeysClientWithBaseURI(api sdkEnv.Api) (*QuotaByPeriodKeysClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "quotabyperiodkeys", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating QuotaByPeriodKeysClient: %+v", err) } + + return &QuotaByPeriodKeysClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_get.go b/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_get.go new file mode 100644 index 00000000000..d5d20c15b6f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_get.go @@ -0,0 +1,51 @@ +package quotabyperiodkeys + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *QuotaCounterContract +} + +// Get ... +func (c QuotaByPeriodKeysClient) Get(ctx context.Context, id PeriodId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_get_autorest.go deleted file mode 100644 index 01ee60c2d53..00000000000 --- a/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package quotabyperiodkeys - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *QuotaCounterContract -} - -// Get ... -func (c QuotaByPeriodKeysClient) Get(ctx context.Context, id PeriodId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c QuotaByPeriodKeysClient) preparerForGet(ctx context.Context, id PeriodId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c QuotaByPeriodKeysClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_update.go b/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_update.go new file mode 100644 index 00000000000..0d078a397a0 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_update.go @@ -0,0 +1,55 @@ +package quotabyperiodkeys + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *QuotaCounterContract +} + +// Update ... +func (c QuotaByPeriodKeysClient) Update(ctx context.Context, id PeriodId, input QuotaCounterValueUpdateContract) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_update_autorest.go deleted file mode 100644 index 40b49856a3c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/method_update_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package quotabyperiodkeys - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *QuotaCounterContract -} - -// Update ... -func (c QuotaByPeriodKeysClient) Update(ctx context.Context, id PeriodId, input QuotaCounterValueUpdateContract) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c QuotaByPeriodKeysClient) preparerForUpdate(ctx context.Context, id PeriodId, input QuotaCounterValueUpdateContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c QuotaByPeriodKeysClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/region/client.go b/resource-manager/apimanagement/2021-08-01/region/client.go index 68b48c48347..3cea33f9d0f 100644 --- a/resource-manager/apimanagement/2021-08-01/region/client.go +++ b/resource-manager/apimanagement/2021-08-01/region/client.go @@ -1,18 +1,26 @@ package region -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type RegionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewRegionClientWithBaseURI(endpoint string) RegionClient { - return RegionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewRegionClientWithBaseURI(api sdkEnv.Api) (*RegionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "region", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RegionClient: %+v", err) } + + return &RegionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/region/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/region/method_listbyservice.go new file mode 100644 index 00000000000..5969f7e8fea --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/region/method_listbyservice.go @@ -0,0 +1,89 @@ +package region + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]RegionContract +} + +type ListByServiceCompleteResult struct { + Items []RegionContract +} + +// ListByService ... +func (c RegionClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/regions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]RegionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c RegionClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, RegionContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RegionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate RegionContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]RegionContract, 0) + + resp, err := c.ListByService(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/region/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/region/method_listbyservice_autorest.go deleted file mode 100644 index f1bc29a5de4..00000000000 --- a/resource-manager/apimanagement/2021-08-01/region/method_listbyservice_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package region - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]RegionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []RegionContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByService ... -func (c RegionClient) ListByService(ctx context.Context, id ServiceId) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c RegionClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c RegionClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c RegionClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []RegionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c RegionClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, RegionContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c RegionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate RegionContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]RegionContract, 0) - - page, err := c.ListByService(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/reports/client.go b/resource-manager/apimanagement/2021-08-01/reports/client.go index 605c74c6124..ffc51ba0d7a 100644 --- a/resource-manager/apimanagement/2021-08-01/reports/client.go +++ b/resource-manager/apimanagement/2021-08-01/reports/client.go @@ -1,18 +1,26 @@ package reports -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ReportsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewReportsClientWithBaseURI(endpoint string) ReportsClient { - return ReportsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewReportsClientWithBaseURI(api sdkEnv.Api) (*ReportsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "reports", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ReportsClient: %+v", err) } + + return &ReportsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbyapi.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbyapi.go new file mode 100644 index 00000000000..06522bae2a6 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/reports/method_listbyapi.go @@ -0,0 +1,129 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByApiCompleteResult struct { + Items []ReportRecordContract +} + +type ListByApiOperationOptions struct { + Filter *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListByApiOperationOptions() ListByApiOperationOptions { + return ListByApiOperationOptions{} +} + +func (o ListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByApi ... +func (c ReportsClient) ListByApi(ctx context.Context, id ServiceId, options ListByApiOperationOptions) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byApi", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByApiComplete retrieves all the results into a single object +func (c ReportsClient) ListByApiComplete(ctx context.Context, id ServiceId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { + return c.ListByApiCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByApiOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByApiCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbyapi_autorest.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbyapi_autorest.go deleted file mode 100644 index 61513c4e70d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/reports/method_listbyapi_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByApiOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByApiOperationResponse, error) -} - -type ListByApiCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByApiOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByApiOperationResponse) LoadMore(ctx context.Context) (resp ListByApiOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByApiOperationOptions struct { - Filter *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListByApiOperationOptions() ListByApiOperationOptions { - return ListByApiOperationOptions{} -} - -func (o ListByApiOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByApiOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByApi ... -func (c ReportsClient) ListByApi(ctx context.Context, id ServiceId, options ListByApiOperationOptions) (resp ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApi(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByApi(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByApi prepares the ListByApi request. -func (c ReportsClient) preparerForListByApi(ctx context.Context, id ServiceId, options ListByApiOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byApi", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByApiWithNextLink prepares the ListByApi request with the given nextLink token. -func (c ReportsClient) preparerForListByApiWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByApi handles the response to the ListByApi request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByApi(resp *http.Response) (result ListByApiOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApiWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByApiComplete retrieves all of the results into a single object -func (c ReportsClient) ListByApiComplete(ctx context.Context, id ServiceId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { - return c.ListByApiCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByApiCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByApiOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByApiCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByApi(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByApiCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbygeo.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbygeo.go new file mode 100644 index 00000000000..2532e17d25b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/reports/method_listbygeo.go @@ -0,0 +1,125 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByGeoOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByGeoCompleteResult struct { + Items []ReportRecordContract +} + +type ListByGeoOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByGeoOperationOptions() ListByGeoOperationOptions { + return ListByGeoOperationOptions{} +} + +func (o ListByGeoOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByGeoOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByGeoOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByGeo ... +func (c ReportsClient) ListByGeo(ctx context.Context, id ServiceId, options ListByGeoOperationOptions) (result ListByGeoOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byGeo", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByGeoComplete retrieves all the results into a single object +func (c ReportsClient) ListByGeoComplete(ctx context.Context, id ServiceId, options ListByGeoOperationOptions) (ListByGeoCompleteResult, error) { + return c.ListByGeoCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByGeoCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByGeoCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByGeoOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByGeoCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByGeo(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByGeoCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbygeo_autorest.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbygeo_autorest.go deleted file mode 100644 index 946c693c961..00000000000 --- a/resource-manager/apimanagement/2021-08-01/reports/method_listbygeo_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByGeoOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByGeoOperationResponse, error) -} - -type ListByGeoCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByGeoOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByGeoOperationResponse) LoadMore(ctx context.Context) (resp ListByGeoOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByGeoOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByGeoOperationOptions() ListByGeoOperationOptions { - return ListByGeoOperationOptions{} -} - -func (o ListByGeoOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByGeoOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByGeo ... -func (c ReportsClient) ListByGeo(ctx context.Context, id ServiceId, options ListByGeoOperationOptions) (resp ListByGeoOperationResponse, err error) { - req, err := c.preparerForListByGeo(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByGeo(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByGeo prepares the ListByGeo request. -func (c ReportsClient) preparerForListByGeo(ctx context.Context, id ServiceId, options ListByGeoOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byGeo", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByGeoWithNextLink prepares the ListByGeo request with the given nextLink token. -func (c ReportsClient) preparerForListByGeoWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByGeo handles the response to the ListByGeo request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByGeo(resp *http.Response) (result ListByGeoOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByGeoOperationResponse, err error) { - req, err := c.preparerForListByGeoWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByGeo(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByGeoComplete retrieves all of the results into a single object -func (c ReportsClient) ListByGeoComplete(ctx context.Context, id ServiceId, options ListByGeoOperationOptions) (ListByGeoCompleteResult, error) { - return c.ListByGeoCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByGeoCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByGeoCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByGeoOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByGeoCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByGeo(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByGeoCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbyoperation.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbyoperation.go new file mode 100644 index 00000000000..80567e9f209 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/reports/method_listbyoperation.go @@ -0,0 +1,129 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByOperationCompleteResult struct { + Items []ReportRecordContract +} + +type ListByOperationOperationOptions struct { + Filter *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListByOperationOperationOptions() ListByOperationOperationOptions { + return ListByOperationOperationOptions{} +} + +func (o ListByOperationOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByOperationOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByOperationOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByOperation ... +func (c ReportsClient) ListByOperation(ctx context.Context, id ServiceId, options ListByOperationOperationOptions) (result ListByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byOperation", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByOperationComplete retrieves all the results into a single object +func (c ReportsClient) ListByOperationComplete(ctx context.Context, id ServiceId, options ListByOperationOperationOptions) (ListByOperationCompleteResult, error) { + return c.ListByOperationCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByOperationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByOperationCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByOperationOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByOperationCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByOperation(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByOperationCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbyoperation_autorest.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbyoperation_autorest.go deleted file mode 100644 index 3aa660eb04c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/reports/method_listbyoperation_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByOperationOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByOperationOperationResponse, error) -} - -type ListByOperationCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByOperationOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByOperationOperationResponse) LoadMore(ctx context.Context) (resp ListByOperationOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByOperationOperationOptions struct { - Filter *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListByOperationOperationOptions() ListByOperationOperationOptions { - return ListByOperationOperationOptions{} -} - -func (o ListByOperationOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByOperationOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByOperation ... -func (c ReportsClient) ListByOperation(ctx context.Context, id ServiceId, options ListByOperationOperationOptions) (resp ListByOperationOperationResponse, err error) { - req, err := c.preparerForListByOperation(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByOperation(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByOperation prepares the ListByOperation request. -func (c ReportsClient) preparerForListByOperation(ctx context.Context, id ServiceId, options ListByOperationOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byOperation", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByOperationWithNextLink prepares the ListByOperation request with the given nextLink token. -func (c ReportsClient) preparerForListByOperationWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByOperation handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByOperation(resp *http.Response) (result ListByOperationOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByOperationOperationResponse, err error) { - req, err := c.preparerForListByOperationWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByOperationComplete retrieves all of the results into a single object -func (c ReportsClient) ListByOperationComplete(ctx context.Context, id ServiceId, options ListByOperationOperationOptions) (ListByOperationCompleteResult, error) { - return c.ListByOperationCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByOperationCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByOperationCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByOperationOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByOperationCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByOperation(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByOperationCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbyproduct.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbyproduct.go new file mode 100644 index 00000000000..de187303948 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/reports/method_listbyproduct.go @@ -0,0 +1,129 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByProductCompleteResult struct { + Items []ReportRecordContract +} + +type ListByProductOperationOptions struct { + Filter *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListByProductOperationOptions() ListByProductOperationOptions { + return ListByProductOperationOptions{} +} + +func (o ListByProductOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByProductOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByProductOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByProduct ... +func (c ReportsClient) ListByProduct(ctx context.Context, id ServiceId, options ListByProductOperationOptions) (result ListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byProduct", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByProductComplete retrieves all the results into a single object +func (c ReportsClient) ListByProductComplete(ctx context.Context, id ServiceId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { + return c.ListByProductCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByProductCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByProductOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByProductCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByProduct(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByProductCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbyproduct_autorest.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbyproduct_autorest.go deleted file mode 100644 index 507a05240b8..00000000000 --- a/resource-manager/apimanagement/2021-08-01/reports/method_listbyproduct_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByProductOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByProductOperationResponse, error) -} - -type ListByProductCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByProductOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByProductOperationResponse) LoadMore(ctx context.Context) (resp ListByProductOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByProductOperationOptions struct { - Filter *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListByProductOperationOptions() ListByProductOperationOptions { - return ListByProductOperationOptions{} -} - -func (o ListByProductOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByProductOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByProduct ... -func (c ReportsClient) ListByProduct(ctx context.Context, id ServiceId, options ListByProductOperationOptions) (resp ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProduct(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByProduct(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByProduct prepares the ListByProduct request. -func (c ReportsClient) preparerForListByProduct(ctx context.Context, id ServiceId, options ListByProductOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byProduct", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByProductWithNextLink prepares the ListByProduct request with the given nextLink token. -func (c ReportsClient) preparerForListByProductWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByProduct handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByProduct(resp *http.Response) (result ListByProductOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProductWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByProductComplete retrieves all of the results into a single object -func (c ReportsClient) ListByProductComplete(ctx context.Context, id ServiceId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { - return c.ListByProductCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByProductCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByProductOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByProductCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByProduct(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByProductCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbyrequest.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbyrequest.go new file mode 100644 index 00000000000..bd4c8b54a0d --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/reports/method_listbyrequest.go @@ -0,0 +1,88 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByRequestOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RequestReportCollection +} + +type ListByRequestOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByRequestOperationOptions() ListByRequestOperationOptions { + return ListByRequestOperationOptions{} +} + +func (o ListByRequestOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByRequestOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByRequestOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByRequest ... +func (c ReportsClient) ListByRequest(ctx context.Context, id ServiceId, options ListByRequestOperationOptions) (result ListByRequestOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byRequest", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbyrequest_autorest.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbyrequest_autorest.go deleted file mode 100644 index 27f2a2395ef..00000000000 --- a/resource-manager/apimanagement/2021-08-01/reports/method_listbyrequest_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByRequestOperationResponse struct { - HttpResponse *http.Response - Model *RequestReportCollection -} - -type ListByRequestOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByRequestOperationOptions() ListByRequestOperationOptions { - return ListByRequestOperationOptions{} -} - -func (o ListByRequestOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByRequestOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByRequest ... -func (c ReportsClient) ListByRequest(ctx context.Context, id ServiceId, options ListByRequestOperationOptions) (result ListByRequestOperationResponse, err error) { - req, err := c.preparerForListByRequest(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByRequest", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByRequest", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByRequest(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByRequest", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByRequest prepares the ListByRequest request. -func (c ReportsClient) preparerForListByRequest(ctx context.Context, id ServiceId, options ListByRequestOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byRequest", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByRequest handles the response to the ListByRequest request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByRequest(resp *http.Response) (result ListByRequestOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbysubscription.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbysubscription.go new file mode 100644 index 00000000000..22df641c1c4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/reports/method_listbysubscription.go @@ -0,0 +1,129 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListBySubscriptionCompleteResult struct { + Items []ReportRecordContract +} + +type ListBySubscriptionOperationOptions struct { + Filter *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListBySubscriptionOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListBySubscriptionOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListBySubscription ... +func (c ReportsClient) ListBySubscription(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/bySubscription", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c ReportsClient) ListBySubscriptionComplete(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbysubscription_autorest.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbysubscription_autorest.go deleted file mode 100644 index e0c5065d369..00000000000 --- a/resource-manager/apimanagement/2021-08-01/reports/method_listbysubscription_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListBySubscriptionOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListBySubscriptionOperationOptions struct { - Filter *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { - return ListBySubscriptionOperationOptions{} -} - -func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListBySubscription ... -func (c ReportsClient) ListBySubscription(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c ReportsClient) preparerForListBySubscription(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/bySubscription", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c ReportsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c ReportsClient) ListBySubscriptionComplete(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListBySubscription(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbytime.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbytime.go new file mode 100644 index 00000000000..7667748e6bb --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/reports/method_listbytime.go @@ -0,0 +1,133 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByTimeOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByTimeCompleteResult struct { + Items []ReportRecordContract +} + +type ListByTimeOperationOptions struct { + Filter *string + Interval *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListByTimeOperationOptions() ListByTimeOperationOptions { + return ListByTimeOperationOptions{} +} + +func (o ListByTimeOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByTimeOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByTimeOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Interval != nil { + out.Append("interval", fmt.Sprintf("%v", *o.Interval)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByTime ... +func (c ReportsClient) ListByTime(ctx context.Context, id ServiceId, options ListByTimeOperationOptions) (result ListByTimeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byTime", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByTimeComplete retrieves all the results into a single object +func (c ReportsClient) ListByTimeComplete(ctx context.Context, id ServiceId, options ListByTimeOperationOptions) (ListByTimeCompleteResult, error) { + return c.ListByTimeCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByTimeCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByTimeCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByTimeOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByTimeCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByTime(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByTimeCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbytime_autorest.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbytime_autorest.go deleted file mode 100644 index b13857ba750..00000000000 --- a/resource-manager/apimanagement/2021-08-01/reports/method_listbytime_autorest.go +++ /dev/null @@ -1,235 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByTimeOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByTimeOperationResponse, error) -} - -type ListByTimeCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByTimeOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByTimeOperationResponse) LoadMore(ctx context.Context) (resp ListByTimeOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByTimeOperationOptions struct { - Filter *string - Interval *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListByTimeOperationOptions() ListByTimeOperationOptions { - return ListByTimeOperationOptions{} -} - -func (o ListByTimeOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByTimeOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Interval != nil { - out["interval"] = *o.Interval - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByTime ... -func (c ReportsClient) ListByTime(ctx context.Context, id ServiceId, options ListByTimeOperationOptions) (resp ListByTimeOperationResponse, err error) { - req, err := c.preparerForListByTime(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByTime(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByTime prepares the ListByTime request. -func (c ReportsClient) preparerForListByTime(ctx context.Context, id ServiceId, options ListByTimeOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byTime", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByTimeWithNextLink prepares the ListByTime request with the given nextLink token. -func (c ReportsClient) preparerForListByTimeWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByTime handles the response to the ListByTime request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByTime(resp *http.Response) (result ListByTimeOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByTimeOperationResponse, err error) { - req, err := c.preparerForListByTimeWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByTime(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByTimeComplete retrieves all of the results into a single object -func (c ReportsClient) ListByTimeComplete(ctx context.Context, id ServiceId, options ListByTimeOperationOptions) (ListByTimeCompleteResult, error) { - return c.ListByTimeCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByTimeCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByTimeCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByTimeOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByTimeCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByTime(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByTimeCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbyuser.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbyuser.go new file mode 100644 index 00000000000..66a39254bdc --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/reports/method_listbyuser.go @@ -0,0 +1,129 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByUserOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByUserCompleteResult struct { + Items []ReportRecordContract +} + +type ListByUserOperationOptions struct { + Filter *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListByUserOperationOptions() ListByUserOperationOptions { + return ListByUserOperationOptions{} +} + +func (o ListByUserOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByUserOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByUserOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByUser ... +func (c ReportsClient) ListByUser(ctx context.Context, id ServiceId, options ListByUserOperationOptions) (result ListByUserOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byUser", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByUserComplete retrieves all the results into a single object +func (c ReportsClient) ListByUserComplete(ctx context.Context, id ServiceId, options ListByUserOperationOptions) (ListByUserCompleteResult, error) { + return c.ListByUserCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByUserCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByUserCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByUserOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByUserCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByUser(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByUserCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/reports/method_listbyuser_autorest.go b/resource-manager/apimanagement/2021-08-01/reports/method_listbyuser_autorest.go deleted file mode 100644 index 2bd9f434043..00000000000 --- a/resource-manager/apimanagement/2021-08-01/reports/method_listbyuser_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByUserOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByUserOperationResponse, error) -} - -type ListByUserCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByUserOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByUserOperationResponse) LoadMore(ctx context.Context) (resp ListByUserOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByUserOperationOptions struct { - Filter *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListByUserOperationOptions() ListByUserOperationOptions { - return ListByUserOperationOptions{} -} - -func (o ListByUserOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByUserOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByUser ... -func (c ReportsClient) ListByUser(ctx context.Context, id ServiceId, options ListByUserOperationOptions) (resp ListByUserOperationResponse, err error) { - req, err := c.preparerForListByUser(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByUser(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByUser prepares the ListByUser request. -func (c ReportsClient) preparerForListByUser(ctx context.Context, id ServiceId, options ListByUserOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byUser", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByUserWithNextLink prepares the ListByUser request with the given nextLink token. -func (c ReportsClient) preparerForListByUserWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByUser handles the response to the ListByUser request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByUser(resp *http.Response) (result ListByUserOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByUserOperationResponse, err error) { - req, err := c.preparerForListByUserWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByUser(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByUserComplete retrieves all of the results into a single object -func (c ReportsClient) ListByUserComplete(ctx context.Context, id ServiceId, options ListByUserOperationOptions) (ListByUserCompleteResult, error) { - return c.ListByUserCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByUserCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByUserCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByUserOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByUserCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByUser(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByUserCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/schema/client.go b/resource-manager/apimanagement/2021-08-01/schema/client.go index 8905f2ce375..15ce21e01f4 100644 --- a/resource-manager/apimanagement/2021-08-01/schema/client.go +++ b/resource-manager/apimanagement/2021-08-01/schema/client.go @@ -1,18 +1,26 @@ package schema -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SchemaClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSchemaClientWithBaseURI(endpoint string) SchemaClient { - return SchemaClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSchemaClientWithBaseURI(api sdkEnv.Api) (*SchemaClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "schema", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SchemaClient: %+v", err) } + + return &SchemaClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/schema/constants.go b/resource-manager/apimanagement/2021-08-01/schema/constants.go index ab4513e2c37..fc6c0c9faf6 100644 --- a/resource-manager/apimanagement/2021-08-01/schema/constants.go +++ b/resource-manager/apimanagement/2021-08-01/schema/constants.go @@ -1,6 +1,10 @@ package schema -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForSchemaType() []string { } } +func (s *SchemaType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSchemaType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSchemaType(input string) (*SchemaType, error) { vals := map[string]SchemaType{ "json": SchemaTypeJson, diff --git a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemacreateorupdate.go b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemacreateorupdate.go new file mode 100644 index 00000000000..3e9e658a682 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemacreateorupdate.go @@ -0,0 +1,103 @@ +package schema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GlobalSchemaCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type GlobalSchemaCreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultGlobalSchemaCreateOrUpdateOperationOptions() GlobalSchemaCreateOrUpdateOperationOptions { + return GlobalSchemaCreateOrUpdateOperationOptions{} +} + +func (o GlobalSchemaCreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o GlobalSchemaCreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GlobalSchemaCreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// GlobalSchemaCreateOrUpdate ... +func (c SchemaClient) GlobalSchemaCreateOrUpdate(ctx context.Context, id SchemaId, input GlobalSchemaContract, options GlobalSchemaCreateOrUpdateOperationOptions) (result GlobalSchemaCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// GlobalSchemaCreateOrUpdateThenPoll performs GlobalSchemaCreateOrUpdate then polls until it's completed +func (c SchemaClient) GlobalSchemaCreateOrUpdateThenPoll(ctx context.Context, id SchemaId, input GlobalSchemaContract, options GlobalSchemaCreateOrUpdateOperationOptions) error { + result, err := c.GlobalSchemaCreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing GlobalSchemaCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after GlobalSchemaCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemacreateorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemacreateorupdate_autorest.go deleted file mode 100644 index 169dc63374e..00000000000 --- a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemacreateorupdate_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package schema - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GlobalSchemaCreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type GlobalSchemaCreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultGlobalSchemaCreateOrUpdateOperationOptions() GlobalSchemaCreateOrUpdateOperationOptions { - return GlobalSchemaCreateOrUpdateOperationOptions{} -} - -func (o GlobalSchemaCreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o GlobalSchemaCreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// GlobalSchemaCreateOrUpdate ... -func (c SchemaClient) GlobalSchemaCreateOrUpdate(ctx context.Context, id SchemaId, input GlobalSchemaContract, options GlobalSchemaCreateOrUpdateOperationOptions) (result GlobalSchemaCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaCreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForGlobalSchemaCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// GlobalSchemaCreateOrUpdateThenPoll performs GlobalSchemaCreateOrUpdate then polls until it's completed -func (c SchemaClient) GlobalSchemaCreateOrUpdateThenPoll(ctx context.Context, id SchemaId, input GlobalSchemaContract, options GlobalSchemaCreateOrUpdateOperationOptions) error { - result, err := c.GlobalSchemaCreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing GlobalSchemaCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after GlobalSchemaCreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForGlobalSchemaCreateOrUpdate prepares the GlobalSchemaCreateOrUpdate request. -func (c SchemaClient) preparerForGlobalSchemaCreateOrUpdate(ctx context.Context, id SchemaId, input GlobalSchemaContract, options GlobalSchemaCreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForGlobalSchemaCreateOrUpdate sends the GlobalSchemaCreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c SchemaClient) senderForGlobalSchemaCreateOrUpdate(ctx context.Context, req *http.Request) (future GlobalSchemaCreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemadelete.go b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemadelete.go new file mode 100644 index 00000000000..f7169489c2b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemadelete.go @@ -0,0 +1,76 @@ +package schema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GlobalSchemaDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type GlobalSchemaDeleteOperationOptions struct { + IfMatch *string +} + +func DefaultGlobalSchemaDeleteOperationOptions() GlobalSchemaDeleteOperationOptions { + return GlobalSchemaDeleteOperationOptions{} +} + +func (o GlobalSchemaDeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o GlobalSchemaDeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GlobalSchemaDeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// GlobalSchemaDelete ... +func (c SchemaClient) GlobalSchemaDelete(ctx context.Context, id SchemaId, options GlobalSchemaDeleteOperationOptions) (result GlobalSchemaDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemadelete_autorest.go b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemadelete_autorest.go deleted file mode 100644 index ec3f0417e40..00000000000 --- a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemadelete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package schema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GlobalSchemaDeleteOperationResponse struct { - HttpResponse *http.Response -} - -type GlobalSchemaDeleteOperationOptions struct { - IfMatch *string -} - -func DefaultGlobalSchemaDeleteOperationOptions() GlobalSchemaDeleteOperationOptions { - return GlobalSchemaDeleteOperationOptions{} -} - -func (o GlobalSchemaDeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o GlobalSchemaDeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// GlobalSchemaDelete ... -func (c SchemaClient) GlobalSchemaDelete(ctx context.Context, id SchemaId, options GlobalSchemaDeleteOperationOptions) (result GlobalSchemaDeleteOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGlobalSchemaDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGlobalSchemaDelete prepares the GlobalSchemaDelete request. -func (c SchemaClient) preparerForGlobalSchemaDelete(ctx context.Context, id SchemaId, options GlobalSchemaDeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGlobalSchemaDelete handles the response to the GlobalSchemaDelete request. The method always -// closes the http.Response Body. -func (c SchemaClient) responderForGlobalSchemaDelete(resp *http.Response) (result GlobalSchemaDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemaget.go b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemaget.go new file mode 100644 index 00000000000..3d7e9fd46ef --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemaget.go @@ -0,0 +1,51 @@ +package schema + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GlobalSchemaGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GlobalSchemaContract +} + +// GlobalSchemaGet ... +func (c SchemaClient) GlobalSchemaGet(ctx context.Context, id SchemaId) (result GlobalSchemaGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemaget_autorest.go b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemaget_autorest.go deleted file mode 100644 index d87e67a9d30..00000000000 --- a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemaget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package schema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GlobalSchemaGetOperationResponse struct { - HttpResponse *http.Response - Model *GlobalSchemaContract -} - -// GlobalSchemaGet ... -func (c SchemaClient) GlobalSchemaGet(ctx context.Context, id SchemaId) (result GlobalSchemaGetOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGlobalSchemaGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGlobalSchemaGet prepares the GlobalSchemaGet request. -func (c SchemaClient) preparerForGlobalSchemaGet(ctx context.Context, id SchemaId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGlobalSchemaGet handles the response to the GlobalSchemaGet request. The method always -// closes the http.Response Body. -func (c SchemaClient) responderForGlobalSchemaGet(resp *http.Response) (result GlobalSchemaGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemagetentitytag.go b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemagetentitytag.go new file mode 100644 index 00000000000..b62a3956afc --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemagetentitytag.go @@ -0,0 +1,46 @@ +package schema + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GlobalSchemaGetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GlobalSchemaGetEntityTag ... +func (c SchemaClient) GlobalSchemaGetEntityTag(ctx context.Context, id SchemaId) (result GlobalSchemaGetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemagetentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemagetentitytag_autorest.go deleted file mode 100644 index a02a95a3402..00000000000 --- a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemagetentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package schema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GlobalSchemaGetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GlobalSchemaGetEntityTag ... -func (c SchemaClient) GlobalSchemaGetEntityTag(ctx context.Context, id SchemaId) (result GlobalSchemaGetEntityTagOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGlobalSchemaGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGlobalSchemaGetEntityTag prepares the GlobalSchemaGetEntityTag request. -func (c SchemaClient) preparerForGlobalSchemaGetEntityTag(ctx context.Context, id SchemaId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGlobalSchemaGetEntityTag handles the response to the GlobalSchemaGetEntityTag request. The method always -// closes the http.Response Body. -func (c SchemaClient) responderForGlobalSchemaGetEntityTag(resp *http.Response) (result GlobalSchemaGetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemalistbyservice.go b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemalistbyservice.go new file mode 100644 index 00000000000..739c27caee5 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemalistbyservice.go @@ -0,0 +1,125 @@ +package schema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GlobalSchemaListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GlobalSchemaContract +} + +type GlobalSchemaListByServiceCompleteResult struct { + Items []GlobalSchemaContract +} + +type GlobalSchemaListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultGlobalSchemaListByServiceOperationOptions() GlobalSchemaListByServiceOperationOptions { + return GlobalSchemaListByServiceOperationOptions{} +} + +func (o GlobalSchemaListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GlobalSchemaListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GlobalSchemaListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// GlobalSchemaListByService ... +func (c SchemaClient) GlobalSchemaListByService(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions) (result GlobalSchemaListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/schemas", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GlobalSchemaContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// GlobalSchemaListByServiceComplete retrieves all the results into a single object +func (c SchemaClient) GlobalSchemaListByServiceComplete(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions) (GlobalSchemaListByServiceCompleteResult, error) { + return c.GlobalSchemaListByServiceCompleteMatchingPredicate(ctx, id, options, GlobalSchemaContractOperationPredicate{}) +} + +// GlobalSchemaListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SchemaClient) GlobalSchemaListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions, predicate GlobalSchemaContractOperationPredicate) (result GlobalSchemaListByServiceCompleteResult, err error) { + items := make([]GlobalSchemaContract, 0) + + resp, err := c.GlobalSchemaListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = GlobalSchemaListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemalistbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/schema/method_globalschemalistbyservice_autorest.go deleted file mode 100644 index f69bb14a594..00000000000 --- a/resource-manager/apimanagement/2021-08-01/schema/method_globalschemalistbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package schema - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GlobalSchemaListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]GlobalSchemaContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (GlobalSchemaListByServiceOperationResponse, error) -} - -type GlobalSchemaListByServiceCompleteResult struct { - Items []GlobalSchemaContract -} - -func (r GlobalSchemaListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r GlobalSchemaListByServiceOperationResponse) LoadMore(ctx context.Context) (resp GlobalSchemaListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type GlobalSchemaListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultGlobalSchemaListByServiceOperationOptions() GlobalSchemaListByServiceOperationOptions { - return GlobalSchemaListByServiceOperationOptions{} -} - -func (o GlobalSchemaListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GlobalSchemaListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// GlobalSchemaListByService ... -func (c SchemaClient) GlobalSchemaListByService(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions) (resp GlobalSchemaListByServiceOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForGlobalSchemaListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForGlobalSchemaListByService prepares the GlobalSchemaListByService request. -func (c SchemaClient) preparerForGlobalSchemaListByService(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/schemas", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForGlobalSchemaListByServiceWithNextLink prepares the GlobalSchemaListByService request with the given nextLink token. -func (c SchemaClient) preparerForGlobalSchemaListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGlobalSchemaListByService handles the response to the GlobalSchemaListByService request. The method always -// closes the http.Response Body. -func (c SchemaClient) responderForGlobalSchemaListByService(resp *http.Response) (result GlobalSchemaListByServiceOperationResponse, err error) { - type page struct { - Values []GlobalSchemaContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result GlobalSchemaListByServiceOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGlobalSchemaListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// GlobalSchemaListByServiceComplete retrieves all of the results into a single object -func (c SchemaClient) GlobalSchemaListByServiceComplete(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions) (GlobalSchemaListByServiceCompleteResult, error) { - return c.GlobalSchemaListByServiceCompleteMatchingPredicate(ctx, id, options, GlobalSchemaContractOperationPredicate{}) -} - -// GlobalSchemaListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SchemaClient) GlobalSchemaListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions, predicate GlobalSchemaContractOperationPredicate) (resp GlobalSchemaListByServiceCompleteResult, err error) { - items := make([]GlobalSchemaContract, 0) - - page, err := c.GlobalSchemaListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := GlobalSchemaListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/signinsettings/client.go b/resource-manager/apimanagement/2021-08-01/signinsettings/client.go index b4213de27ba..c2b9d49feb7 100644 --- a/resource-manager/apimanagement/2021-08-01/signinsettings/client.go +++ b/resource-manager/apimanagement/2021-08-01/signinsettings/client.go @@ -1,18 +1,26 @@ package signinsettings -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SignInSettingsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSignInSettingsClientWithBaseURI(endpoint string) SignInSettingsClient { - return SignInSettingsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSignInSettingsClientWithBaseURI(api sdkEnv.Api) (*SignInSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "signinsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SignInSettingsClient: %+v", err) } + + return &SignInSettingsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/signinsettings/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/signinsettings/method_createorupdate.go new file mode 100644 index 00000000000..7b9767c2fbe --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/signinsettings/method_createorupdate.go @@ -0,0 +1,84 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSigninSettings +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c SignInSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalSigninSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/signinsettings/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/signinsettings/method_createorupdate_autorest.go deleted file mode 100644 index b4f0296beba..00000000000 --- a/resource-manager/apimanagement/2021-08-01/signinsettings/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package signinsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PortalSigninSettings -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c SignInSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalSigninSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c SignInSettingsClient) preparerForCreateOrUpdate(ctx context.Context, id ServiceId, input PortalSigninSettings, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signin", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c SignInSettingsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/signinsettings/method_get.go b/resource-manager/apimanagement/2021-08-01/signinsettings/method_get.go new file mode 100644 index 00000000000..173524f6cc7 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/signinsettings/method_get.go @@ -0,0 +1,52 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSigninSettings +} + +// Get ... +func (c SignInSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/signinsettings/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/signinsettings/method_get_autorest.go deleted file mode 100644 index 3ac4891a75c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/signinsettings/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package signinsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PortalSigninSettings -} - -// Get ... -func (c SignInSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c SignInSettingsClient) preparerForGet(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signin", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c SignInSettingsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/signinsettings/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/signinsettings/method_getentitytag.go new file mode 100644 index 00000000000..25861ccf2a4 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/signinsettings/method_getentitytag.go @@ -0,0 +1,47 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c SignInSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/signinsettings/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/signinsettings/method_getentitytag_autorest.go deleted file mode 100644 index 1209ff66c99..00000000000 --- a/resource-manager/apimanagement/2021-08-01/signinsettings/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package signinsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c SignInSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c SignInSettingsClient) preparerForGetEntityTag(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signin", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c SignInSettingsClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/signinsettings/method_update.go b/resource-manager/apimanagement/2021-08-01/signinsettings/method_update.go new file mode 100644 index 00000000000..cdef3702ed0 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/signinsettings/method_update.go @@ -0,0 +1,79 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c SignInSettingsClient) Update(ctx context.Context, id ServiceId, input PortalSigninSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/signinsettings/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/signinsettings/method_update_autorest.go deleted file mode 100644 index 0a95b9f7fa1..00000000000 --- a/resource-manager/apimanagement/2021-08-01/signinsettings/method_update_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package signinsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c SignInSettingsClient) Update(ctx context.Context, id ServiceId, input PortalSigninSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c SignInSettingsClient) preparerForUpdate(ctx context.Context, id ServiceId, input PortalSigninSettings, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signin", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c SignInSettingsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/signupsettings/client.go b/resource-manager/apimanagement/2021-08-01/signupsettings/client.go index 539431c37b7..0d30a04c8e6 100644 --- a/resource-manager/apimanagement/2021-08-01/signupsettings/client.go +++ b/resource-manager/apimanagement/2021-08-01/signupsettings/client.go @@ -1,18 +1,26 @@ package signupsettings -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SignUpSettingsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSignUpSettingsClientWithBaseURI(endpoint string) SignUpSettingsClient { - return SignUpSettingsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSignUpSettingsClientWithBaseURI(api sdkEnv.Api) (*SignUpSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "signupsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SignUpSettingsClient: %+v", err) } + + return &SignUpSettingsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/signupsettings/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/signupsettings/method_createorupdate.go new file mode 100644 index 00000000000..7269ad66a33 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/signupsettings/method_createorupdate.go @@ -0,0 +1,84 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSignupSettings +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c SignUpSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalSignupSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/signupsettings/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/signupsettings/method_createorupdate_autorest.go deleted file mode 100644 index 096041ff364..00000000000 --- a/resource-manager/apimanagement/2021-08-01/signupsettings/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package signupsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PortalSignupSettings -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c SignUpSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalSignupSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c SignUpSettingsClient) preparerForCreateOrUpdate(ctx context.Context, id ServiceId, input PortalSignupSettings, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signup", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c SignUpSettingsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/signupsettings/method_get.go b/resource-manager/apimanagement/2021-08-01/signupsettings/method_get.go new file mode 100644 index 00000000000..9c83e5e83ec --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/signupsettings/method_get.go @@ -0,0 +1,52 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSignupSettings +} + +// Get ... +func (c SignUpSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/signupsettings/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/signupsettings/method_get_autorest.go deleted file mode 100644 index 0f67ad8685a..00000000000 --- a/resource-manager/apimanagement/2021-08-01/signupsettings/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package signupsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PortalSignupSettings -} - -// Get ... -func (c SignUpSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c SignUpSettingsClient) preparerForGet(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signup", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c SignUpSettingsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/signupsettings/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/signupsettings/method_getentitytag.go new file mode 100644 index 00000000000..c664f2c2ea8 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/signupsettings/method_getentitytag.go @@ -0,0 +1,47 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c SignUpSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/signupsettings/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/signupsettings/method_getentitytag_autorest.go deleted file mode 100644 index 3fa59c81432..00000000000 --- a/resource-manager/apimanagement/2021-08-01/signupsettings/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package signupsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c SignUpSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c SignUpSettingsClient) preparerForGetEntityTag(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signup", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c SignUpSettingsClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/signupsettings/method_update.go b/resource-manager/apimanagement/2021-08-01/signupsettings/method_update.go new file mode 100644 index 00000000000..fd56de21870 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/signupsettings/method_update.go @@ -0,0 +1,79 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c SignUpSettingsClient) Update(ctx context.Context, id ServiceId, input PortalSignupSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/signupsettings/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/signupsettings/method_update_autorest.go deleted file mode 100644 index 6ab1c8cf856..00000000000 --- a/resource-manager/apimanagement/2021-08-01/signupsettings/method_update_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package signupsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c SignUpSettingsClient) Update(ctx context.Context, id ServiceId, input PortalSignupSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c SignUpSettingsClient) preparerForUpdate(ctx context.Context, id ServiceId, input PortalSignupSettings, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signup", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c SignUpSettingsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/skus/client.go b/resource-manager/apimanagement/2021-08-01/skus/client.go index bb4f8409006..ee82463b163 100644 --- a/resource-manager/apimanagement/2021-08-01/skus/client.go +++ b/resource-manager/apimanagement/2021-08-01/skus/client.go @@ -1,18 +1,26 @@ package skus -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SkusClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSkusClientWithBaseURI(endpoint string) SkusClient { - return SkusClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSkusClientWithBaseURI(api sdkEnv.Api) (*SkusClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "skus", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SkusClient: %+v", err) } + + return &SkusClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/skus/constants.go b/resource-manager/apimanagement/2021-08-01/skus/constants.go index 0e5b4b734b7..97daf30eeec 100644 --- a/resource-manager/apimanagement/2021-08-01/skus/constants.go +++ b/resource-manager/apimanagement/2021-08-01/skus/constants.go @@ -1,6 +1,10 @@ package skus -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForApiManagementSkuCapacityScaleType() []string { } } +func (s *ApiManagementSkuCapacityScaleType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiManagementSkuCapacityScaleType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiManagementSkuCapacityScaleType(input string) (*ApiManagementSkuCapacityScaleType, error) { vals := map[string]ApiManagementSkuCapacityScaleType{ "automatic": ApiManagementSkuCapacityScaleTypeAutomatic, @@ -50,6 +67,19 @@ func PossibleValuesForApiManagementSkuRestrictionsReasonCode() []string { } } +func (s *ApiManagementSkuRestrictionsReasonCode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiManagementSkuRestrictionsReasonCode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiManagementSkuRestrictionsReasonCode(input string) (*ApiManagementSkuRestrictionsReasonCode, error) { vals := map[string]ApiManagementSkuRestrictionsReasonCode{ "notavailableforsubscription": ApiManagementSkuRestrictionsReasonCodeNotAvailableForSubscription, @@ -78,6 +108,19 @@ func PossibleValuesForApiManagementSkuRestrictionsType() []string { } } +func (s *ApiManagementSkuRestrictionsType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiManagementSkuRestrictionsType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiManagementSkuRestrictionsType(input string) (*ApiManagementSkuRestrictionsType, error) { vals := map[string]ApiManagementSkuRestrictionsType{ "location": ApiManagementSkuRestrictionsTypeLocation, diff --git a/resource-manager/apimanagement/2021-08-01/skus/method_apimanagementskuslist.go b/resource-manager/apimanagement/2021-08-01/skus/method_apimanagementskuslist.go new file mode 100644 index 00000000000..4818d802b31 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/skus/method_apimanagementskuslist.go @@ -0,0 +1,90 @@ +package skus + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementSkusListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiManagementSku +} + +type ApiManagementSkusListCompleteResult struct { + Items []ApiManagementSku +} + +// ApiManagementSkusList ... +func (c SkusClient) ApiManagementSkusList(ctx context.Context, id commonids.SubscriptionId) (result ApiManagementSkusListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/skus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiManagementSku `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ApiManagementSkusListComplete retrieves all the results into a single object +func (c SkusClient) ApiManagementSkusListComplete(ctx context.Context, id commonids.SubscriptionId) (ApiManagementSkusListCompleteResult, error) { + return c.ApiManagementSkusListCompleteMatchingPredicate(ctx, id, ApiManagementSkuOperationPredicate{}) +} + +// ApiManagementSkusListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SkusClient) ApiManagementSkusListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApiManagementSkuOperationPredicate) (result ApiManagementSkusListCompleteResult, err error) { + items := make([]ApiManagementSku, 0) + + resp, err := c.ApiManagementSkusList(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ApiManagementSkusListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/skus/method_apimanagementskuslist_autorest.go b/resource-manager/apimanagement/2021-08-01/skus/method_apimanagementskuslist_autorest.go deleted file mode 100644 index d9bb79afd90..00000000000 --- a/resource-manager/apimanagement/2021-08-01/skus/method_apimanagementskuslist_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package skus - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ApiManagementSkusListOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiManagementSku - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ApiManagementSkusListOperationResponse, error) -} - -type ApiManagementSkusListCompleteResult struct { - Items []ApiManagementSku -} - -func (r ApiManagementSkusListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ApiManagementSkusListOperationResponse) LoadMore(ctx context.Context) (resp ApiManagementSkusListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ApiManagementSkusList ... -func (c SkusClient) ApiManagementSkusList(ctx context.Context, id commonids.SubscriptionId) (resp ApiManagementSkusListOperationResponse, err error) { - req, err := c.preparerForApiManagementSkusList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForApiManagementSkusList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForApiManagementSkusList prepares the ApiManagementSkusList request. -func (c SkusClient) preparerForApiManagementSkusList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/skus", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForApiManagementSkusListWithNextLink prepares the ApiManagementSkusList request with the given nextLink token. -func (c SkusClient) preparerForApiManagementSkusListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForApiManagementSkusList handles the response to the ApiManagementSkusList request. The method always -// closes the http.Response Body. -func (c SkusClient) responderForApiManagementSkusList(resp *http.Response) (result ApiManagementSkusListOperationResponse, err error) { - type page struct { - Values []ApiManagementSku `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ApiManagementSkusListOperationResponse, err error) { - req, err := c.preparerForApiManagementSkusListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForApiManagementSkusList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ApiManagementSkusListComplete retrieves all of the results into a single object -func (c SkusClient) ApiManagementSkusListComplete(ctx context.Context, id commonids.SubscriptionId) (ApiManagementSkusListCompleteResult, error) { - return c.ApiManagementSkusListCompleteMatchingPredicate(ctx, id, ApiManagementSkuOperationPredicate{}) -} - -// ApiManagementSkusListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SkusClient) ApiManagementSkusListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApiManagementSkuOperationPredicate) (resp ApiManagementSkusListCompleteResult, err error) { - items := make([]ApiManagementSku, 0) - - page, err := c.ApiManagementSkusList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ApiManagementSkusListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/client.go b/resource-manager/apimanagement/2021-08-01/subscription/client.go index 9b6b77e38d7..e39cec765af 100644 --- a/resource-manager/apimanagement/2021-08-01/subscription/client.go +++ b/resource-manager/apimanagement/2021-08-01/subscription/client.go @@ -1,18 +1,26 @@ package subscription -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SubscriptionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSubscriptionClientWithBaseURI(endpoint string) SubscriptionClient { - return SubscriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSubscriptionClientWithBaseURI(api sdkEnv.Api) (*SubscriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "subscription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SubscriptionClient: %+v", err) } + + return &SubscriptionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/subscription/constants.go b/resource-manager/apimanagement/2021-08-01/subscription/constants.go index 720ab13b7df..71ac415eaca 100644 --- a/resource-manager/apimanagement/2021-08-01/subscription/constants.go +++ b/resource-manager/apimanagement/2021-08-01/subscription/constants.go @@ -1,6 +1,10 @@ package subscription -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAppType() []string { } } +func (s *AppType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAppType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAppType(input string) (*AppType, error) { vals := map[string]AppType{ "developerportal": AppTypeDeveloperPortal, @@ -55,6 +72,19 @@ func PossibleValuesForSubscriptionState() []string { } } +func (s *SubscriptionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSubscriptionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSubscriptionState(input string) (*SubscriptionState, error) { vals := map[string]SubscriptionState{ "active": SubscriptionStateActive, diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/subscription/method_createorupdate.go new file mode 100644 index 00000000000..d69e1efca03 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/subscription/method_createorupdate.go @@ -0,0 +1,92 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +type CreateOrUpdateOperationOptions struct { + AppType *AppType + IfMatch *string + Notify *bool +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.AppType != nil { + out.Append("appType", fmt.Sprintf("%v", *o.AppType)) + } + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// CreateOrUpdate ... +func (c SubscriptionClient) CreateOrUpdate(ctx context.Context, id Subscriptions2Id, input SubscriptionCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/subscription/method_createorupdate_autorest.go deleted file mode 100644 index a0ed6895a04..00000000000 --- a/resource-manager/apimanagement/2021-08-01/subscription/method_createorupdate_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *SubscriptionContract -} - -type CreateOrUpdateOperationOptions struct { - AppType *AppType - IfMatch *string - Notify *bool -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.AppType != nil { - out["appType"] = *o.AppType - } - - if o.Notify != nil { - out["notify"] = *o.Notify - } - - return out -} - -// CreateOrUpdate ... -func (c SubscriptionClient) CreateOrUpdate(ctx context.Context, id Subscriptions2Id, input SubscriptionCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c SubscriptionClient) preparerForCreateOrUpdate(ctx context.Context, id Subscriptions2Id, input SubscriptionCreateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_delete.go b/resource-manager/apimanagement/2021-08-01/subscription/method_delete.go new file mode 100644 index 00000000000..a14c0ad04e1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/subscription/method_delete.go @@ -0,0 +1,76 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c SubscriptionClient) Delete(ctx context.Context, id Subscriptions2Id, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/subscription/method_delete_autorest.go deleted file mode 100644 index e9f7fe282a7..00000000000 --- a/resource-manager/apimanagement/2021-08-01/subscription/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c SubscriptionClient) Delete(ctx context.Context, id Subscriptions2Id, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c SubscriptionClient) preparerForDelete(ctx context.Context, id Subscriptions2Id, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_get.go b/resource-manager/apimanagement/2021-08-01/subscription/method_get.go new file mode 100644 index 00000000000..8aabef6e59e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/subscription/method_get.go @@ -0,0 +1,51 @@ +package subscription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +// Get ... +func (c SubscriptionClient) Get(ctx context.Context, id Subscriptions2Id) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/subscription/method_get_autorest.go deleted file mode 100644 index 5c650032d00..00000000000 --- a/resource-manager/apimanagement/2021-08-01/subscription/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *SubscriptionContract -} - -// Get ... -func (c SubscriptionClient) Get(ctx context.Context, id Subscriptions2Id) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c SubscriptionClient) preparerForGet(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/subscription/method_getentitytag.go new file mode 100644 index 00000000000..70173b87ce1 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/subscription/method_getentitytag.go @@ -0,0 +1,46 @@ +package subscription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c SubscriptionClient) GetEntityTag(ctx context.Context, id Subscriptions2Id) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/subscription/method_getentitytag_autorest.go deleted file mode 100644 index e088e054ada..00000000000 --- a/resource-manager/apimanagement/2021-08-01/subscription/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c SubscriptionClient) GetEntityTag(ctx context.Context, id Subscriptions2Id) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c SubscriptionClient) preparerForGetEntityTag(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_list.go b/resource-manager/apimanagement/2021-08-01/subscription/method_list.go new file mode 100644 index 00000000000..5a583cace4b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/subscription/method_list.go @@ -0,0 +1,125 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SubscriptionContract +} + +type ListCompleteResult struct { + Items []SubscriptionContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c SubscriptionClient) List(ctx context.Context, id ServiceId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/subscriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SubscriptionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c SubscriptionClient) ListComplete(ctx context.Context, id ServiceId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]SubscriptionContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_list_autorest.go b/resource-manager/apimanagement/2021-08-01/subscription/method_list_autorest.go deleted file mode 100644 index 7cf7939d59c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/subscription/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package subscription - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]SubscriptionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []SubscriptionContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c SubscriptionClient) List(ctx context.Context, id ServiceId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c SubscriptionClient) preparerForList(ctx context.Context, id ServiceId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/subscriptions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c SubscriptionClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []SubscriptionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c SubscriptionClient) ListComplete(ctx context.Context, id ServiceId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]SubscriptionContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_listsecrets.go b/resource-manager/apimanagement/2021-08-01/subscription/method_listsecrets.go new file mode 100644 index 00000000000..f204e457940 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/subscription/method_listsecrets.go @@ -0,0 +1,52 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionKeysContract +} + +// ListSecrets ... +func (c SubscriptionClient) ListSecrets(ctx context.Context, id Subscriptions2Id) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_listsecrets_autorest.go b/resource-manager/apimanagement/2021-08-01/subscription/method_listsecrets_autorest.go deleted file mode 100644 index 0e76aeca560..00000000000 --- a/resource-manager/apimanagement/2021-08-01/subscription/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package subscription - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *SubscriptionKeysContract -} - -// ListSecrets ... -func (c SubscriptionClient) ListSecrets(ctx context.Context, id Subscriptions2Id) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c SubscriptionClient) preparerForListSecrets(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_regenerateprimarykey.go b/resource-manager/apimanagement/2021-08-01/subscription/method_regenerateprimarykey.go new file mode 100644 index 00000000000..d2ae52bbb7c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/subscription/method_regenerateprimarykey.go @@ -0,0 +1,47 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegeneratePrimaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegeneratePrimaryKey ... +func (c SubscriptionClient) RegeneratePrimaryKey(ctx context.Context, id Subscriptions2Id) (result RegeneratePrimaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regeneratePrimaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_regenerateprimarykey_autorest.go b/resource-manager/apimanagement/2021-08-01/subscription/method_regenerateprimarykey_autorest.go deleted file mode 100644 index 846602df9ec..00000000000 --- a/resource-manager/apimanagement/2021-08-01/subscription/method_regenerateprimarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package subscription - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegeneratePrimaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegeneratePrimaryKey ... -func (c SubscriptionClient) RegeneratePrimaryKey(ctx context.Context, id Subscriptions2Id) (result RegeneratePrimaryKeyOperationResponse, err error) { - req, err := c.preparerForRegeneratePrimaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegeneratePrimaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegeneratePrimaryKey prepares the RegeneratePrimaryKey request. -func (c SubscriptionClient) preparerForRegeneratePrimaryKey(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regeneratePrimaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegeneratePrimaryKey handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForRegeneratePrimaryKey(resp *http.Response) (result RegeneratePrimaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_regeneratesecondarykey.go b/resource-manager/apimanagement/2021-08-01/subscription/method_regeneratesecondarykey.go new file mode 100644 index 00000000000..7e3998ced00 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/subscription/method_regeneratesecondarykey.go @@ -0,0 +1,47 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateSecondaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegenerateSecondaryKey ... +func (c SubscriptionClient) RegenerateSecondaryKey(ctx context.Context, id Subscriptions2Id) (result RegenerateSecondaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateSecondaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_regeneratesecondarykey_autorest.go b/resource-manager/apimanagement/2021-08-01/subscription/method_regeneratesecondarykey_autorest.go deleted file mode 100644 index 44faa9e3409..00000000000 --- a/resource-manager/apimanagement/2021-08-01/subscription/method_regeneratesecondarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package subscription - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegenerateSecondaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegenerateSecondaryKey ... -func (c SubscriptionClient) RegenerateSecondaryKey(ctx context.Context, id Subscriptions2Id) (result RegenerateSecondaryKeyOperationResponse, err error) { - req, err := c.preparerForRegenerateSecondaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegenerateSecondaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegenerateSecondaryKey prepares the RegenerateSecondaryKey request. -func (c SubscriptionClient) preparerForRegenerateSecondaryKey(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateSecondaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegenerateSecondaryKey handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForRegenerateSecondaryKey(resp *http.Response) (result RegenerateSecondaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_update.go b/resource-manager/apimanagement/2021-08-01/subscription/method_update.go new file mode 100644 index 00000000000..f01dc48db34 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/subscription/method_update.go @@ -0,0 +1,91 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +type UpdateOperationOptions struct { + AppType *AppType + IfMatch *string + Notify *bool +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.AppType != nil { + out.Append("appType", fmt.Sprintf("%v", *o.AppType)) + } + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// Update ... +func (c SubscriptionClient) Update(ctx context.Context, id Subscriptions2Id, input SubscriptionUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/subscription/method_update_autorest.go deleted file mode 100644 index 000a788ba77..00000000000 --- a/resource-manager/apimanagement/2021-08-01/subscription/method_update_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *SubscriptionContract -} - -type UpdateOperationOptions struct { - AppType *AppType - IfMatch *string - Notify *bool -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.AppType != nil { - out["appType"] = *o.AppType - } - - if o.Notify != nil { - out["notify"] = *o.Notify - } - - return out -} - -// Update ... -func (c SubscriptionClient) Update(ctx context.Context, id Subscriptions2Id, input SubscriptionUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c SubscriptionClient) preparerForUpdate(ctx context.Context, id Subscriptions2Id, input SubscriptionUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_usersubscriptionget.go b/resource-manager/apimanagement/2021-08-01/subscription/method_usersubscriptionget.go new file mode 100644 index 00000000000..7553f7391d9 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/subscription/method_usersubscriptionget.go @@ -0,0 +1,51 @@ +package subscription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserSubscriptionGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +// UserSubscriptionGet ... +func (c SubscriptionClient) UserSubscriptionGet(ctx context.Context, id UserSubscriptions2Id) (result UserSubscriptionGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/subscription/method_usersubscriptionget_autorest.go b/resource-manager/apimanagement/2021-08-01/subscription/method_usersubscriptionget_autorest.go deleted file mode 100644 index cc4667c6c9c..00000000000 --- a/resource-manager/apimanagement/2021-08-01/subscription/method_usersubscriptionget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserSubscriptionGetOperationResponse struct { - HttpResponse *http.Response - Model *SubscriptionContract -} - -// UserSubscriptionGet ... -func (c SubscriptionClient) UserSubscriptionGet(ctx context.Context, id UserSubscriptions2Id) (result UserSubscriptionGetOperationResponse, err error) { - req, err := c.preparerForUserSubscriptionGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "UserSubscriptionGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "UserSubscriptionGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserSubscriptionGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "UserSubscriptionGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserSubscriptionGet prepares the UserSubscriptionGet request. -func (c SubscriptionClient) preparerForUserSubscriptionGet(ctx context.Context, id UserSubscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserSubscriptionGet handles the response to the UserSubscriptionGet request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForUserSubscriptionGet(resp *http.Response) (result UserSubscriptionGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tag/client.go b/resource-manager/apimanagement/2021-08-01/tag/client.go index 859dfa3f85e..18edf105ea7 100644 --- a/resource-manager/apimanagement/2021-08-01/tag/client.go +++ b/resource-manager/apimanagement/2021-08-01/tag/client.go @@ -1,18 +1,26 @@ package tag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTagClientWithBaseURI(endpoint string) TagClient { - return TagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTagClientWithBaseURI(api sdkEnv.Api) (*TagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TagClient: %+v", err) } + + return &TagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/tag/method_createorupdate.go new file mode 100644 index 00000000000..b7c955b4480 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tag/method_createorupdate.go @@ -0,0 +1,85 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c TagClient) CreateOrUpdate(ctx context.Context, id TagId, input TagCreateUpdateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/tag/method_createorupdate_autorest.go deleted file mode 100644 index 48f02bbd515..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tag/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package tag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c TagClient) CreateOrUpdate(ctx context.Context, id TagId, input TagCreateUpdateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c TagClient) preparerForCreateOrUpdate(ctx context.Context, id TagId, input TagCreateUpdateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c TagClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_delete.go b/resource-manager/apimanagement/2021-08-01/tag/method_delete.go new file mode 100644 index 00000000000..01b72128471 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tag/method_delete.go @@ -0,0 +1,76 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c TagClient) Delete(ctx context.Context, id TagId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/tag/method_delete_autorest.go deleted file mode 100644 index fad1b450db3..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tag/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package tag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c TagClient) Delete(ctx context.Context, id TagId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c TagClient) preparerForDelete(ctx context.Context, id TagId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c TagClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_get.go b/resource-manager/apimanagement/2021-08-01/tag/method_get.go new file mode 100644 index 00000000000..340922be21e --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tag/method_get.go @@ -0,0 +1,51 @@ +package tag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// Get ... +func (c TagClient) Get(ctx context.Context, id TagId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/tag/method_get_autorest.go deleted file mode 100644 index 0a9cd67ede7..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tag/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package tag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// Get ... -func (c TagClient) Get(ctx context.Context, id TagId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c TagClient) preparerForGet(ctx context.Context, id TagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c TagClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_getentitystate.go b/resource-manager/apimanagement/2021-08-01/tag/method_getentitystate.go new file mode 100644 index 00000000000..b56c0026a99 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tag/method_getentitystate.go @@ -0,0 +1,46 @@ +package tag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityStateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityState ... +func (c TagClient) GetEntityState(ctx context.Context, id TagId) (result GetEntityStateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_getentitystate_autorest.go b/resource-manager/apimanagement/2021-08-01/tag/method_getentitystate_autorest.go deleted file mode 100644 index a058ebd7e9b..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tag/method_getentitystate_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package tag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityStateOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityState ... -func (c TagClient) GetEntityState(ctx context.Context, id TagId) (result GetEntityStateOperationResponse, err error) { - req, err := c.preparerForGetEntityState(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "GetEntityState", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "GetEntityState", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityState(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "GetEntityState", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityState prepares the GetEntityState request. -func (c TagClient) preparerForGetEntityState(ctx context.Context, id TagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityState handles the response to the GetEntityState request. The method always -// closes the http.Response Body. -func (c TagClient) responderForGetEntityState(resp *http.Response) (result GetEntityStateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/tag/method_listbyservice.go new file mode 100644 index 00000000000..110e8d13d3c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tag/method_listbyservice.go @@ -0,0 +1,129 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type ListByServiceCompleteResult struct { + Items []TagContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Scope *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Scope != nil { + out.Append("scope", fmt.Sprintf("%v", *o.Scope)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c TagClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c TagClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TagClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TagContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/tag/method_listbyservice_autorest.go deleted file mode 100644 index 1e241c14508..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tag/method_listbyservice_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package tag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]TagContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []TagContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Scope *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Scope != nil { - out["scope"] = *o.Scope - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c TagClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c TagClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c TagClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c TagClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []TagContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c TagClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TagClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TagContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]TagContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_update.go b/resource-manager/apimanagement/2021-08-01/tag/method_update.go new file mode 100644 index 00000000000..a301e054137 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tag/method_update.go @@ -0,0 +1,84 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c TagClient) Update(ctx context.Context, id TagId, input TagCreateUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tag/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/tag/method_update_autorest.go deleted file mode 100644 index 6a13a61027d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tag/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package tag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c TagClient) Update(ctx context.Context, id TagId, input TagCreateUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c TagClient) preparerForUpdate(ctx context.Context, id TagId, input TagCreateUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c TagClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tagresource/client.go b/resource-manager/apimanagement/2021-08-01/tagresource/client.go index 10f42e3996e..7e160526668 100644 --- a/resource-manager/apimanagement/2021-08-01/tagresource/client.go +++ b/resource-manager/apimanagement/2021-08-01/tagresource/client.go @@ -1,18 +1,26 @@ package tagresource -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TagResourceClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTagResourceClientWithBaseURI(endpoint string) TagResourceClient { - return TagResourceClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTagResourceClientWithBaseURI(api sdkEnv.Api) (*TagResourceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tagresource", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TagResourceClient: %+v", err) } + + return &TagResourceClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/tagresource/constants.go b/resource-manager/apimanagement/2021-08-01/tagresource/constants.go index 97e2cdd7620..93cbbc002a0 100644 --- a/resource-manager/apimanagement/2021-08-01/tagresource/constants.go +++ b/resource-manager/apimanagement/2021-08-01/tagresource/constants.go @@ -1,6 +1,10 @@ package tagresource -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -81,6 +111,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, @@ -113,6 +156,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, diff --git a/resource-manager/apimanagement/2021-08-01/tagresource/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/tagresource/method_listbyservice.go new file mode 100644 index 00000000000..c896fcb2dfc --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tagresource/method_listbyservice.go @@ -0,0 +1,125 @@ +package tagresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagResourceContract +} + +type ListByServiceCompleteResult struct { + Items []TagResourceContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c TagResourceClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tagResources", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagResourceContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c TagResourceClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TagResourceClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TagResourceContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]TagResourceContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tagresource/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/tagresource/method_listbyservice_autorest.go deleted file mode 100644 index b86fedc24e7..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tagresource/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package tagresource - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]TagResourceContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []TagResourceContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c TagResourceClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c TagResourceClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tagResources", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c TagResourceClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c TagResourceClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []TagResourceContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c TagResourceClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TagResourceClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TagResourceContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]TagResourceContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/client.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/client.go index 7a6208f3d69..cd60e8064da 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/client.go +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/client.go @@ -1,18 +1,26 @@ package tenantaccess -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TenantAccessClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTenantAccessClientWithBaseURI(endpoint string) TenantAccessClient { - return TenantAccessClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTenantAccessClientWithBaseURI(api sdkEnv.Api) (*TenantAccessClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tenantaccess", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TenantAccessClient: %+v", err) } + + return &TenantAccessClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/constants.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/constants.go index 3fe8372dbcb..0a9a890aae2 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/constants.go +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/constants.go @@ -1,6 +1,10 @@ package tenantaccess -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAccessIdName() []string { } } +func (s *AccessIdName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessIdName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAccessIdName(input string) (*AccessIdName, error) { vals := map[string]AccessIdName{ "access": AccessIdNameAccess, diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_create.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_create.go new file mode 100644 index 00000000000..cf2902da389 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_create.go @@ -0,0 +1,84 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationContract +} + +type CreateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOperationOptions() CreateOperationOptions { + return CreateOperationOptions{} +} + +func (o CreateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Create ... +func (c TenantAccessClient) Create(ctx context.Context, id AccessId, input AccessInformationCreateParameters, options CreateOperationOptions) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_create_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_create_autorest.go deleted file mode 100644 index cc2d34137c2..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_create_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package tenantaccess - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOperationResponse struct { - HttpResponse *http.Response - Model *AccessInformationContract -} - -type CreateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOperationOptions() CreateOperationOptions { - return CreateOperationOptions{} -} - -func (o CreateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Create ... -func (c TenantAccessClient) Create(ctx context.Context, id AccessId, input AccessInformationCreateParameters, options CreateOperationOptions) (result CreateOperationResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Create", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Create", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreate prepares the Create request. -func (c TenantAccessClient) preparerForCreate(ctx context.Context, id AccessId, input AccessInformationCreateParameters, options CreateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreate handles the response to the Create request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_get.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_get.go new file mode 100644 index 00000000000..b1f7d18cc3b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_get.go @@ -0,0 +1,51 @@ +package tenantaccess + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationContract +} + +// Get ... +func (c TenantAccessClient) Get(ctx context.Context, id AccessId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_get_autorest.go deleted file mode 100644 index 3a070ae9892..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package tenantaccess - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *AccessInformationContract -} - -// Get ... -func (c TenantAccessClient) Get(ctx context.Context, id AccessId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c TenantAccessClient) preparerForGet(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_getentitytag.go new file mode 100644 index 00000000000..d1d42ee00fd --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_getentitytag.go @@ -0,0 +1,46 @@ +package tenantaccess + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c TenantAccessClient) GetEntityTag(ctx context.Context, id AccessId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_getentitytag_autorest.go deleted file mode 100644 index 8300d23c3f6..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package tenantaccess - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c TenantAccessClient) GetEntityTag(ctx context.Context, id AccessId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c TenantAccessClient) preparerForGetEntityTag(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listbyservice.go new file mode 100644 index 00000000000..d332a10b9d5 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listbyservice.go @@ -0,0 +1,117 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AccessInformationContract +} + +type ListByServiceCompleteResult struct { + Items []AccessInformationContract +} + +type ListByServiceOperationOptions struct { + Filter *string +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + return &out +} + +// ListByService ... +func (c TenantAccessClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tenant", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AccessInformationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c TenantAccessClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AccessInformationContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TenantAccessClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AccessInformationContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]AccessInformationContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listbyservice_autorest.go deleted file mode 100644 index 8e83891260f..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listbyservice_autorest.go +++ /dev/null @@ -1,215 +0,0 @@ -package tenantaccess - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]AccessInformationContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []AccessInformationContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// ListByService ... -func (c TenantAccessClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c TenantAccessClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tenant", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c TenantAccessClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []AccessInformationContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c TenantAccessClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AccessInformationContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TenantAccessClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AccessInformationContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]AccessInformationContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listsecrets.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listsecrets.go new file mode 100644 index 00000000000..67b0b5f3a0b --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listsecrets.go @@ -0,0 +1,52 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationSecretsContract +} + +// ListSecrets ... +func (c TenantAccessClient) ListSecrets(ctx context.Context, id AccessId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listsecrets_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listsecrets_autorest.go deleted file mode 100644 index 2a1515ff216..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package tenantaccess - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *AccessInformationSecretsContract -} - -// ListSecrets ... -func (c TenantAccessClient) ListSecrets(ctx context.Context, id AccessId) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c TenantAccessClient) preparerForListSecrets(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regenerateprimarykey.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regenerateprimarykey.go new file mode 100644 index 00000000000..6d6aa0f1ccf --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regenerateprimarykey.go @@ -0,0 +1,47 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegeneratePrimaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegeneratePrimaryKey ... +func (c TenantAccessClient) RegeneratePrimaryKey(ctx context.Context, id AccessId) (result RegeneratePrimaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regeneratePrimaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regenerateprimarykey_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regenerateprimarykey_autorest.go deleted file mode 100644 index 18cb875e657..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regenerateprimarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package tenantaccess - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegeneratePrimaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegeneratePrimaryKey ... -func (c TenantAccessClient) RegeneratePrimaryKey(ctx context.Context, id AccessId) (result RegeneratePrimaryKeyOperationResponse, err error) { - req, err := c.preparerForRegeneratePrimaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegeneratePrimaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegeneratePrimaryKey prepares the RegeneratePrimaryKey request. -func (c TenantAccessClient) preparerForRegeneratePrimaryKey(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regeneratePrimaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegeneratePrimaryKey handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForRegeneratePrimaryKey(resp *http.Response) (result RegeneratePrimaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regeneratesecondarykey.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regeneratesecondarykey.go new file mode 100644 index 00000000000..0fd0b8fd296 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regeneratesecondarykey.go @@ -0,0 +1,47 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateSecondaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegenerateSecondaryKey ... +func (c TenantAccessClient) RegenerateSecondaryKey(ctx context.Context, id AccessId) (result RegenerateSecondaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateSecondaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regeneratesecondarykey_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regeneratesecondarykey_autorest.go deleted file mode 100644 index 60839456731..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_regeneratesecondarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package tenantaccess - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegenerateSecondaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegenerateSecondaryKey ... -func (c TenantAccessClient) RegenerateSecondaryKey(ctx context.Context, id AccessId) (result RegenerateSecondaryKeyOperationResponse, err error) { - req, err := c.preparerForRegenerateSecondaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegenerateSecondaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegenerateSecondaryKey prepares the RegenerateSecondaryKey request. -func (c TenantAccessClient) preparerForRegenerateSecondaryKey(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateSecondaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegenerateSecondaryKey handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForRegenerateSecondaryKey(resp *http.Response) (result RegenerateSecondaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_update.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_update.go new file mode 100644 index 00000000000..255888180b3 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_update.go @@ -0,0 +1,84 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c TenantAccessClient) Update(ctx context.Context, id AccessId, input AccessInformationUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/method_update_autorest.go deleted file mode 100644 index 87eb5439426..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package tenantaccess - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *AccessInformationContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c TenantAccessClient) Update(ctx context.Context, id AccessId, input AccessInformationUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c TenantAccessClient) preparerForUpdate(ctx context.Context, id AccessId, input AccessInformationUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/client.go b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/client.go index 015bab0d24f..a466ef34ccf 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/client.go +++ b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/client.go @@ -1,18 +1,26 @@ package tenantaccessgit -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TenantAccessGitClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTenantAccessGitClientWithBaseURI(endpoint string) TenantAccessGitClient { - return TenantAccessGitClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTenantAccessGitClientWithBaseURI(api sdkEnv.Api) (*TenantAccessGitClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tenantaccessgit", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TenantAccessGitClient: %+v", err) } + + return &TenantAccessGitClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/constants.go b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/constants.go index b35272377f3..0423218f1c5 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/constants.go +++ b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/constants.go @@ -1,6 +1,10 @@ package tenantaccessgit -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAccessIdName() []string { } } +func (s *AccessIdName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessIdName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAccessIdName(input string) (*AccessIdName, error) { vals := map[string]AccessIdName{ "access": AccessIdNameAccess, diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regenerateprimarykey.go b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regenerateprimarykey.go new file mode 100644 index 00000000000..5b6c503576f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regenerateprimarykey.go @@ -0,0 +1,47 @@ +package tenantaccessgit + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegeneratePrimaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegeneratePrimaryKey ... +func (c TenantAccessGitClient) RegeneratePrimaryKey(ctx context.Context, id AccessId) (result RegeneratePrimaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/git/regeneratePrimaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regenerateprimarykey_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regenerateprimarykey_autorest.go deleted file mode 100644 index 4783b820c9d..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regenerateprimarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package tenantaccessgit - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegeneratePrimaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegeneratePrimaryKey ... -func (c TenantAccessGitClient) RegeneratePrimaryKey(ctx context.Context, id AccessId) (result RegeneratePrimaryKeyOperationResponse, err error) { - req, err := c.preparerForRegeneratePrimaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegeneratePrimaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegeneratePrimaryKey prepares the RegeneratePrimaryKey request. -func (c TenantAccessGitClient) preparerForRegeneratePrimaryKey(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/git/regeneratePrimaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegeneratePrimaryKey handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (c TenantAccessGitClient) responderForRegeneratePrimaryKey(resp *http.Response) (result RegeneratePrimaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regeneratesecondarykey.go b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regeneratesecondarykey.go new file mode 100644 index 00000000000..fa55bca8deb --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regeneratesecondarykey.go @@ -0,0 +1,47 @@ +package tenantaccessgit + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateSecondaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegenerateSecondaryKey ... +func (c TenantAccessGitClient) RegenerateSecondaryKey(ctx context.Context, id AccessId) (result RegenerateSecondaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/git/regenerateSecondaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regeneratesecondarykey_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regeneratesecondarykey_autorest.go deleted file mode 100644 index d0375fcb447..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/method_regeneratesecondarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package tenantaccessgit - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegenerateSecondaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegenerateSecondaryKey ... -func (c TenantAccessGitClient) RegenerateSecondaryKey(ctx context.Context, id AccessId) (result RegenerateSecondaryKeyOperationResponse, err error) { - req, err := c.preparerForRegenerateSecondaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegenerateSecondaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegenerateSecondaryKey prepares the RegenerateSecondaryKey request. -func (c TenantAccessGitClient) preparerForRegenerateSecondaryKey(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/git/regenerateSecondaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegenerateSecondaryKey handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (c TenantAccessGitClient) responderForRegenerateSecondaryKey(resp *http.Response) (result RegenerateSecondaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/client.go b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/client.go index b4cf4a17cf2..1c9a2f1304b 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/client.go +++ b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/client.go @@ -1,18 +1,26 @@ package tenantconfiguration -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TenantConfigurationClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTenantConfigurationClientWithBaseURI(endpoint string) TenantConfigurationClient { - return TenantConfigurationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTenantConfigurationClientWithBaseURI(api sdkEnv.Api) (*TenantConfigurationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tenantconfiguration", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TenantConfigurationClient: %+v", err) } + + return &TenantConfigurationClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/constants.go b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/constants.go index 68f7b36814f..c896fa35bce 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/constants.go +++ b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/constants.go @@ -1,6 +1,10 @@ package tenantconfiguration -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForAsyncOperationStatus() []string { } } +func (s *AsyncOperationStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAsyncOperationStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAsyncOperationStatus(input string) (*AsyncOperationStatus, error) { vals := map[string]AsyncOperationStatus{ "failed": AsyncOperationStatusFailed, diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_deploy.go b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_deploy.go new file mode 100644 index 00000000000..e71bf7ad1b6 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_deploy.go @@ -0,0 +1,74 @@ +package tenantconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeployOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Deploy ... +func (c TenantConfigurationClient) Deploy(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (result DeployOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/tenant/configuration/deploy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeployThenPoll performs Deploy then polls until it's completed +func (c TenantConfigurationClient) DeployThenPoll(ctx context.Context, id ServiceId, input DeployConfigurationParameters) error { + result, err := c.Deploy(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Deploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Deploy: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_deploy_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_deploy_autorest.go deleted file mode 100644 index 659a8ef5465..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_deploy_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package tenantconfiguration - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeployOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Deploy ... -func (c TenantConfigurationClient) Deploy(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (result DeployOperationResponse, err error) { - req, err := c.preparerForDeploy(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Deploy", nil, "Failure preparing request") - return - } - - result, err = c.senderForDeploy(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Deploy", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeployThenPoll performs Deploy then polls until it's completed -func (c TenantConfigurationClient) DeployThenPoll(ctx context.Context, id ServiceId, input DeployConfigurationParameters) error { - result, err := c.Deploy(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Deploy: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Deploy: %+v", err) - } - - return nil -} - -// preparerForDeploy prepares the Deploy request. -func (c TenantConfigurationClient) preparerForDeploy(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/tenant/configuration/deploy", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDeploy sends the Deploy request. The method will close the -// http.Response Body if it receives an error. -func (c TenantConfigurationClient) senderForDeploy(ctx context.Context, req *http.Request) (future DeployOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_save.go b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_save.go new file mode 100644 index 00000000000..c261c455120 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_save.go @@ -0,0 +1,74 @@ +package tenantconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SaveOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Save ... +func (c TenantConfigurationClient) Save(ctx context.Context, id ServiceId, input SaveConfigurationParameter) (result SaveOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/tenant/configuration/save", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// SaveThenPoll performs Save then polls until it's completed +func (c TenantConfigurationClient) SaveThenPoll(ctx context.Context, id ServiceId, input SaveConfigurationParameter) error { + result, err := c.Save(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Save: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Save: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_save_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_save_autorest.go deleted file mode 100644 index 989e1db8216..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_save_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package tenantconfiguration - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SaveOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Save ... -func (c TenantConfigurationClient) Save(ctx context.Context, id ServiceId, input SaveConfigurationParameter) (result SaveOperationResponse, err error) { - req, err := c.preparerForSave(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Save", nil, "Failure preparing request") - return - } - - result, err = c.senderForSave(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Save", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// SaveThenPoll performs Save then polls until it's completed -func (c TenantConfigurationClient) SaveThenPoll(ctx context.Context, id ServiceId, input SaveConfigurationParameter) error { - result, err := c.Save(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Save: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Save: %+v", err) - } - - return nil -} - -// preparerForSave prepares the Save request. -func (c TenantConfigurationClient) preparerForSave(ctx context.Context, id ServiceId, input SaveConfigurationParameter) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/tenant/configuration/save", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForSave sends the Save request. The method will close the -// http.Response Body if it receives an error. -func (c TenantConfigurationClient) senderForSave(ctx context.Context, req *http.Request) (future SaveOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_validate.go b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_validate.go new file mode 100644 index 00000000000..26401e0e77f --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_validate.go @@ -0,0 +1,74 @@ +package tenantconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Validate ... +func (c TenantConfigurationClient) Validate(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (result ValidateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/tenant/configuration/validate", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ValidateThenPoll performs Validate then polls until it's completed +func (c TenantConfigurationClient) ValidateThenPoll(ctx context.Context, id ServiceId, input DeployConfigurationParameters) error { + result, err := c.Validate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Validate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Validate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_validate_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_validate_autorest.go deleted file mode 100644 index 64e2904b423..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/method_validate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package tenantconfiguration - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ValidateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Validate ... -func (c TenantConfigurationClient) Validate(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (result ValidateOperationResponse, err error) { - req, err := c.preparerForValidate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Validate", nil, "Failure preparing request") - return - } - - result, err = c.senderForValidate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Validate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ValidateThenPoll performs Validate then polls until it's completed -func (c TenantConfigurationClient) ValidateThenPoll(ctx context.Context, id ServiceId, input DeployConfigurationParameters) error { - result, err := c.Validate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Validate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Validate: %+v", err) - } - - return nil -} - -// preparerForValidate prepares the Validate request. -func (c TenantConfigurationClient) preparerForValidate(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/tenant/configuration/validate", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForValidate sends the Validate request. The method will close the -// http.Response Body if it receives an error. -func (c TenantConfigurationClient) senderForValidate(ctx context.Context, req *http.Request) (future ValidateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/client.go b/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/client.go index b005ecbaebc..5f4816a7f3c 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/client.go +++ b/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/client.go @@ -1,18 +1,26 @@ package tenantconfigurationsyncstate -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TenantConfigurationSyncStateClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTenantConfigurationSyncStateClientWithBaseURI(endpoint string) TenantConfigurationSyncStateClient { - return TenantConfigurationSyncStateClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTenantConfigurationSyncStateClientWithBaseURI(api sdkEnv.Api) (*TenantConfigurationSyncStateClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tenantconfigurationsyncstate", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TenantConfigurationSyncStateClient: %+v", err) } + + return &TenantConfigurationSyncStateClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate.go b/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate.go new file mode 100644 index 00000000000..4ea64f710b0 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate.go @@ -0,0 +1,52 @@ +package tenantconfigurationsyncstate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TenantConfigurationGetSyncStateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TenantConfigurationSyncStateContract +} + +// TenantConfigurationGetSyncState ... +func (c TenantConfigurationSyncStateClient) TenantConfigurationGetSyncState(ctx context.Context, id ServiceId) (result TenantConfigurationGetSyncStateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tenant/configuration/syncState", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate_autorest.go deleted file mode 100644 index 8761b63aaa1..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package tenantconfigurationsyncstate - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TenantConfigurationGetSyncStateOperationResponse struct { - HttpResponse *http.Response - Model *TenantConfigurationSyncStateContract -} - -// TenantConfigurationGetSyncState ... -func (c TenantConfigurationSyncStateClient) TenantConfigurationGetSyncState(ctx context.Context, id ServiceId) (result TenantConfigurationGetSyncStateOperationResponse, err error) { - req, err := c.preparerForTenantConfigurationGetSyncState(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfigurationsyncstate.TenantConfigurationSyncStateClient", "TenantConfigurationGetSyncState", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfigurationsyncstate.TenantConfigurationSyncStateClient", "TenantConfigurationGetSyncState", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTenantConfigurationGetSyncState(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfigurationsyncstate.TenantConfigurationSyncStateClient", "TenantConfigurationGetSyncState", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTenantConfigurationGetSyncState prepares the TenantConfigurationGetSyncState request. -func (c TenantConfigurationSyncStateClient) preparerForTenantConfigurationGetSyncState(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/tenant/configuration/syncState", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTenantConfigurationGetSyncState handles the response to the TenantConfigurationGetSyncState request. The method always -// closes the http.Response Body. -func (c TenantConfigurationSyncStateClient) responderForTenantConfigurationGetSyncState(resp *http.Response) (result TenantConfigurationGetSyncStateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantsettings/client.go b/resource-manager/apimanagement/2021-08-01/tenantsettings/client.go index 1e3e819d2fe..bf14c2adc9f 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantsettings/client.go +++ b/resource-manager/apimanagement/2021-08-01/tenantsettings/client.go @@ -1,18 +1,26 @@ package tenantsettings -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TenantSettingsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTenantSettingsClientWithBaseURI(endpoint string) TenantSettingsClient { - return TenantSettingsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTenantSettingsClientWithBaseURI(api sdkEnv.Api) (*TenantSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tenantsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TenantSettingsClient: %+v", err) } + + return &TenantSettingsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/tenantsettings/method_get.go b/resource-manager/apimanagement/2021-08-01/tenantsettings/method_get.go new file mode 100644 index 00000000000..9f42162d776 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantsettings/method_get.go @@ -0,0 +1,52 @@ +package tenantsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TenantSettingsContract +} + +// Get ... +func (c TenantSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/settings/public", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantsettings/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantsettings/method_get_autorest.go deleted file mode 100644 index 5fe75ae615e..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantsettings/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package tenantsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *TenantSettingsContract -} - -// Get ... -func (c TenantSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c TenantSettingsClient) preparerForGet(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/settings/public", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c TenantSettingsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/tenantsettings/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/tenantsettings/method_listbyservice.go new file mode 100644 index 00000000000..6d94b36d733 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/tenantsettings/method_listbyservice.go @@ -0,0 +1,117 @@ +package tenantsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TenantSettingsContract +} + +type ListByServiceCompleteResult struct { + Items []TenantSettingsContract +} + +type ListByServiceOperationOptions struct { + Filter *string +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + return &out +} + +// ListByService ... +func (c TenantSettingsClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/settings", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TenantSettingsContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c TenantSettingsClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TenantSettingsContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TenantSettingsClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TenantSettingsContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]TenantSettingsContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/tenantsettings/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/tenantsettings/method_listbyservice_autorest.go deleted file mode 100644 index 1514f996e50..00000000000 --- a/resource-manager/apimanagement/2021-08-01/tenantsettings/method_listbyservice_autorest.go +++ /dev/null @@ -1,215 +0,0 @@ -package tenantsettings - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]TenantSettingsContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []TenantSettingsContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// ListByService ... -func (c TenantSettingsClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c TenantSettingsClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/settings", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c TenantSettingsClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c TenantSettingsClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []TenantSettingsContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c TenantSettingsClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TenantSettingsContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TenantSettingsClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TenantSettingsContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]TenantSettingsContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/user/client.go b/resource-manager/apimanagement/2021-08-01/user/client.go index edf5ba84ceb..35a8027a782 100644 --- a/resource-manager/apimanagement/2021-08-01/user/client.go +++ b/resource-manager/apimanagement/2021-08-01/user/client.go @@ -1,18 +1,26 @@ package user -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserClientWithBaseURI(endpoint string) UserClient { - return UserClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserClientWithBaseURI(api sdkEnv.Api) (*UserClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "user", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserClient: %+v", err) } + + return &UserClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/user/constants.go b/resource-manager/apimanagement/2021-08-01/user/constants.go index e5b9de9b614..83573cf87af 100644 --- a/resource-manager/apimanagement/2021-08-01/user/constants.go +++ b/resource-manager/apimanagement/2021-08-01/user/constants.go @@ -1,6 +1,10 @@ package user -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAppType() []string { } } +func (s *AppType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAppType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAppType(input string) (*AppType, error) { vals := map[string]AppType{ "developerportal": AppTypeDeveloperPortal, @@ -47,6 +64,19 @@ func PossibleValuesForConfirmation() []string { } } +func (s *Confirmation) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConfirmation(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseConfirmation(input string) (*Confirmation, error) { vals := map[string]Confirmation{ "invite": ConfirmationInvite, @@ -77,6 +107,19 @@ func PossibleValuesForGroupType() []string { } } +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGroupType(input string) (*GroupType, error) { vals := map[string]GroupType{ "custom": GroupTypeCustom, @@ -110,6 +153,19 @@ func PossibleValuesForUserState() []string { } } +func (s *UserState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUserState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUserState(input string) (*UserState, error) { vals := map[string]UserState{ "active": UserStateActive, diff --git a/resource-manager/apimanagement/2021-08-01/user/method_createorupdate.go b/resource-manager/apimanagement/2021-08-01/user/method_createorupdate.go new file mode 100644 index 00000000000..6ff0ddbf251 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/user/method_createorupdate.go @@ -0,0 +1,88 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + Notify *bool +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// CreateOrUpdate ... +func (c UserClient) CreateOrUpdate(ctx context.Context, id UserId, input UserCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/user/method_createorupdate_autorest.go b/resource-manager/apimanagement/2021-08-01/user/method_createorupdate_autorest.go deleted file mode 100644 index 2d354273eac..00000000000 --- a/resource-manager/apimanagement/2021-08-01/user/method_createorupdate_autorest.go +++ /dev/null @@ -1,103 +0,0 @@ -package user - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *UserContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string - Notify *bool -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Notify != nil { - out["notify"] = *o.Notify - } - - return out -} - -// CreateOrUpdate ... -func (c UserClient) CreateOrUpdate(ctx context.Context, id UserId, input UserCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c UserClient) preparerForCreateOrUpdate(ctx context.Context, id UserId, input UserCreateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c UserClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/user/method_delete.go b/resource-manager/apimanagement/2021-08-01/user/method_delete.go new file mode 100644 index 00000000000..fd6b3518902 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/user/method_delete.go @@ -0,0 +1,87 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + AppType *AppType + DeleteSubscriptions *bool + IfMatch *string + Notify *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.AppType != nil { + out.Append("appType", fmt.Sprintf("%v", *o.AppType)) + } + if o.DeleteSubscriptions != nil { + out.Append("deleteSubscriptions", fmt.Sprintf("%v", *o.DeleteSubscriptions)) + } + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// Delete ... +func (c UserClient) Delete(ctx context.Context, id UserId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/user/method_delete_autorest.go b/resource-manager/apimanagement/2021-08-01/user/method_delete_autorest.go deleted file mode 100644 index 34b48b3fa26..00000000000 --- a/resource-manager/apimanagement/2021-08-01/user/method_delete_autorest.go +++ /dev/null @@ -1,110 +0,0 @@ -package user - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - AppType *AppType - DeleteSubscriptions *bool - IfMatch *string - Notify *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.AppType != nil { - out["appType"] = *o.AppType - } - - if o.DeleteSubscriptions != nil { - out["deleteSubscriptions"] = *o.DeleteSubscriptions - } - - if o.Notify != nil { - out["notify"] = *o.Notify - } - - return out -} - -// Delete ... -func (c UserClient) Delete(ctx context.Context, id UserId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c UserClient) preparerForDelete(ctx context.Context, id UserId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c UserClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/user/method_get.go b/resource-manager/apimanagement/2021-08-01/user/method_get.go new file mode 100644 index 00000000000..c70fed38ef8 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/user/method_get.go @@ -0,0 +1,51 @@ +package user + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +// Get ... +func (c UserClient) Get(ctx context.Context, id UserId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/user/method_get_autorest.go b/resource-manager/apimanagement/2021-08-01/user/method_get_autorest.go deleted file mode 100644 index e3b8b477c77..00000000000 --- a/resource-manager/apimanagement/2021-08-01/user/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package user - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *UserContract -} - -// Get ... -func (c UserClient) Get(ctx context.Context, id UserId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c UserClient) preparerForGet(ctx context.Context, id UserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c UserClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/user/method_getentitytag.go b/resource-manager/apimanagement/2021-08-01/user/method_getentitytag.go new file mode 100644 index 00000000000..bc31a7c3697 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/user/method_getentitytag.go @@ -0,0 +1,46 @@ +package user + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c UserClient) GetEntityTag(ctx context.Context, id UserId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/user/method_getentitytag_autorest.go b/resource-manager/apimanagement/2021-08-01/user/method_getentitytag_autorest.go deleted file mode 100644 index ec2d361cccd..00000000000 --- a/resource-manager/apimanagement/2021-08-01/user/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package user - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c UserClient) GetEntityTag(ctx context.Context, id UserId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c UserClient) preparerForGetEntityTag(ctx context.Context, id UserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c UserClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/user/method_listbyservice.go b/resource-manager/apimanagement/2021-08-01/user/method_listbyservice.go new file mode 100644 index 00000000000..5882829e90c --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/user/method_listbyservice.go @@ -0,0 +1,129 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]UserContract +} + +type ListByServiceCompleteResult struct { + Items []UserContract +} + +type ListByServiceOperationOptions struct { + ExpandGroups *bool + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandGroups != nil { + out.Append("expandGroups", fmt.Sprintf("%v", *o.ExpandGroups)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c UserClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/users", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]UserContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c UserClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, UserContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c UserClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate UserContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]UserContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/user/method_listbyservice_autorest.go b/resource-manager/apimanagement/2021-08-01/user/method_listbyservice_autorest.go deleted file mode 100644 index 8304e22f9e4..00000000000 --- a/resource-manager/apimanagement/2021-08-01/user/method_listbyservice_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package user - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]UserContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []UserContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - ExpandGroups *bool - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ExpandGroups != nil { - out["expandGroups"] = *o.ExpandGroups - } - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c UserClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c UserClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/users", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c UserClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c UserClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []UserContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c UserClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, UserContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c UserClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate UserContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]UserContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/user/method_update.go b/resource-manager/apimanagement/2021-08-01/user/method_update.go new file mode 100644 index 00000000000..ed43e43248d --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/user/method_update.go @@ -0,0 +1,84 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c UserClient) Update(ctx context.Context, id UserId, input UserUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/user/method_update_autorest.go b/resource-manager/apimanagement/2021-08-01/user/method_update_autorest.go deleted file mode 100644 index 38f81f608fd..00000000000 --- a/resource-manager/apimanagement/2021-08-01/user/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package user - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *UserContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c UserClient) Update(ctx context.Context, id UserId, input UserUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c UserClient) preparerForUpdate(ctx context.Context, id UserId, input UserUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c UserClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/client.go b/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/client.go index 756489454aa..e8eb5e76d55 100644 --- a/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/client.go +++ b/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/client.go @@ -1,18 +1,26 @@ package userconfirmationpasswordsend -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserConfirmationPasswordSendClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserConfirmationPasswordSendClientWithBaseURI(endpoint string) UserConfirmationPasswordSendClient { - return UserConfirmationPasswordSendClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserConfirmationPasswordSendClientWithBaseURI(api sdkEnv.Api) (*UserConfirmationPasswordSendClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "userconfirmationpasswordsend", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserConfirmationPasswordSendClient: %+v", err) } + + return &UserConfirmationPasswordSendClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/constants.go b/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/constants.go index cc153945e69..c532eea3196 100644 --- a/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/constants.go +++ b/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/constants.go @@ -1,6 +1,10 @@ package userconfirmationpasswordsend -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAppType() []string { } } +func (s *AppType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAppType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAppType(input string) (*AppType, error) { vals := map[string]AppType{ "developerportal": AppTypeDeveloperPortal, diff --git a/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend.go b/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend.go new file mode 100644 index 00000000000..883292fd0c2 --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend.go @@ -0,0 +1,75 @@ +package userconfirmationpasswordsend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserConfirmationPasswordSendOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type UserConfirmationPasswordSendOperationOptions struct { + AppType *AppType +} + +func DefaultUserConfirmationPasswordSendOperationOptions() UserConfirmationPasswordSendOperationOptions { + return UserConfirmationPasswordSendOperationOptions{} +} + +func (o UserConfirmationPasswordSendOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o UserConfirmationPasswordSendOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UserConfirmationPasswordSendOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.AppType != nil { + out.Append("appType", fmt.Sprintf("%v", *o.AppType)) + } + return &out +} + +// UserConfirmationPasswordSend ... +func (c UserConfirmationPasswordSendClient) UserConfirmationPasswordSend(ctx context.Context, id UserId, options UserConfirmationPasswordSendOperationOptions) (result UserConfirmationPasswordSendOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/confirmations/password/send", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend_autorest.go b/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend_autorest.go deleted file mode 100644 index 8a9f0a68633..00000000000 --- a/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package userconfirmationpasswordsend - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserConfirmationPasswordSendOperationResponse struct { - HttpResponse *http.Response -} - -type UserConfirmationPasswordSendOperationOptions struct { - AppType *AppType -} - -func DefaultUserConfirmationPasswordSendOperationOptions() UserConfirmationPasswordSendOperationOptions { - return UserConfirmationPasswordSendOperationOptions{} -} - -func (o UserConfirmationPasswordSendOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o UserConfirmationPasswordSendOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.AppType != nil { - out["appType"] = *o.AppType - } - - return out -} - -// UserConfirmationPasswordSend ... -func (c UserConfirmationPasswordSendClient) UserConfirmationPasswordSend(ctx context.Context, id UserId, options UserConfirmationPasswordSendOperationOptions) (result UserConfirmationPasswordSendOperationResponse, err error) { - req, err := c.preparerForUserConfirmationPasswordSend(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "userconfirmationpasswordsend.UserConfirmationPasswordSendClient", "UserConfirmationPasswordSend", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "userconfirmationpasswordsend.UserConfirmationPasswordSendClient", "UserConfirmationPasswordSend", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserConfirmationPasswordSend(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "userconfirmationpasswordsend.UserConfirmationPasswordSendClient", "UserConfirmationPasswordSend", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserConfirmationPasswordSend prepares the UserConfirmationPasswordSend request. -func (c UserConfirmationPasswordSendClient) preparerForUserConfirmationPasswordSend(ctx context.Context, id UserId, options UserConfirmationPasswordSendOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/confirmations/password/send", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserConfirmationPasswordSend handles the response to the UserConfirmationPasswordSend request. The method always -// closes the http.Response Body. -func (c UserConfirmationPasswordSendClient) responderForUserConfirmationPasswordSend(resp *http.Response) (result UserConfirmationPasswordSendOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/usergroup/client.go b/resource-manager/apimanagement/2021-08-01/usergroup/client.go index d08c65ca35c..e320aaff086 100644 --- a/resource-manager/apimanagement/2021-08-01/usergroup/client.go +++ b/resource-manager/apimanagement/2021-08-01/usergroup/client.go @@ -1,18 +1,26 @@ package usergroup -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserGroupClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserGroupClientWithBaseURI(endpoint string) UserGroupClient { - return UserGroupClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserGroupClientWithBaseURI(api sdkEnv.Api) (*UserGroupClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "usergroup", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserGroupClient: %+v", err) } + + return &UserGroupClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/usergroup/constants.go b/resource-manager/apimanagement/2021-08-01/usergroup/constants.go index ea114107530..8762d75fc71 100644 --- a/resource-manager/apimanagement/2021-08-01/usergroup/constants.go +++ b/resource-manager/apimanagement/2021-08-01/usergroup/constants.go @@ -1,6 +1,10 @@ package usergroup -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForGroupType() []string { } } +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGroupType(input string) (*GroupType, error) { vals := map[string]GroupType{ "custom": GroupTypeCustom, diff --git a/resource-manager/apimanagement/2021-08-01/usergroup/method_list.go b/resource-manager/apimanagement/2021-08-01/usergroup/method_list.go new file mode 100644 index 00000000000..c59680e814a --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/usergroup/method_list.go @@ -0,0 +1,125 @@ +package usergroup + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GroupContract +} + +type ListCompleteResult struct { + Items []GroupContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c UserGroupClient) List(ctx context.Context, id UserId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/groups", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GroupContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c UserGroupClient) ListComplete(ctx context.Context, id UserId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c UserGroupClient) ListCompleteMatchingPredicate(ctx context.Context, id UserId, options ListOperationOptions, predicate GroupContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]GroupContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/usergroup/method_list_autorest.go b/resource-manager/apimanagement/2021-08-01/usergroup/method_list_autorest.go deleted file mode 100644 index 61e0bb9e690..00000000000 --- a/resource-manager/apimanagement/2021-08-01/usergroup/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package usergroup - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]GroupContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []GroupContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c UserGroupClient) List(ctx context.Context, id UserId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c UserGroupClient) preparerForList(ctx context.Context, id UserId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/groups", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c UserGroupClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c UserGroupClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []GroupContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c UserGroupClient) ListComplete(ctx context.Context, id UserId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c UserGroupClient) ListCompleteMatchingPredicate(ctx context.Context, id UserId, options ListOperationOptions, predicate GroupContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]GroupContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/useridentity/client.go b/resource-manager/apimanagement/2021-08-01/useridentity/client.go index 4ae90e35324..8a7497272b8 100644 --- a/resource-manager/apimanagement/2021-08-01/useridentity/client.go +++ b/resource-manager/apimanagement/2021-08-01/useridentity/client.go @@ -1,18 +1,26 @@ package useridentity -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserIdentityClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserIdentityClientWithBaseURI(endpoint string) UserIdentityClient { - return UserIdentityClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserIdentityClientWithBaseURI(api sdkEnv.Api) (*UserIdentityClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "useridentity", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserIdentityClient: %+v", err) } + + return &UserIdentityClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/useridentity/method_useridentitieslist.go b/resource-manager/apimanagement/2021-08-01/useridentity/method_useridentitieslist.go new file mode 100644 index 00000000000..74e3593f0ab --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/useridentity/method_useridentitieslist.go @@ -0,0 +1,89 @@ +package useridentity + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserIdentitiesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]UserIdentityContract +} + +type UserIdentitiesListCompleteResult struct { + Items []UserIdentityContract +} + +// UserIdentitiesList ... +func (c UserIdentityClient) UserIdentitiesList(ctx context.Context, id UserId) (result UserIdentitiesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/identities", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]UserIdentityContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// UserIdentitiesListComplete retrieves all the results into a single object +func (c UserIdentityClient) UserIdentitiesListComplete(ctx context.Context, id UserId) (UserIdentitiesListCompleteResult, error) { + return c.UserIdentitiesListCompleteMatchingPredicate(ctx, id, UserIdentityContractOperationPredicate{}) +} + +// UserIdentitiesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c UserIdentityClient) UserIdentitiesListCompleteMatchingPredicate(ctx context.Context, id UserId, predicate UserIdentityContractOperationPredicate) (result UserIdentitiesListCompleteResult, err error) { + items := make([]UserIdentityContract, 0) + + resp, err := c.UserIdentitiesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = UserIdentitiesListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/useridentity/method_useridentitieslist_autorest.go b/resource-manager/apimanagement/2021-08-01/useridentity/method_useridentitieslist_autorest.go deleted file mode 100644 index 6374338ce31..00000000000 --- a/resource-manager/apimanagement/2021-08-01/useridentity/method_useridentitieslist_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package useridentity - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserIdentitiesListOperationResponse struct { - HttpResponse *http.Response - Model *[]UserIdentityContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (UserIdentitiesListOperationResponse, error) -} - -type UserIdentitiesListCompleteResult struct { - Items []UserIdentityContract -} - -func (r UserIdentitiesListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r UserIdentitiesListOperationResponse) LoadMore(ctx context.Context) (resp UserIdentitiesListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// UserIdentitiesList ... -func (c UserIdentityClient) UserIdentitiesList(ctx context.Context, id UserId) (resp UserIdentitiesListOperationResponse, err error) { - req, err := c.preparerForUserIdentitiesList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForUserIdentitiesList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForUserIdentitiesList prepares the UserIdentitiesList request. -func (c UserIdentityClient) preparerForUserIdentitiesList(ctx context.Context, id UserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/identities", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForUserIdentitiesListWithNextLink prepares the UserIdentitiesList request with the given nextLink token. -func (c UserIdentityClient) preparerForUserIdentitiesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserIdentitiesList handles the response to the UserIdentitiesList request. The method always -// closes the http.Response Body. -func (c UserIdentityClient) responderForUserIdentitiesList(resp *http.Response) (result UserIdentitiesListOperationResponse, err error) { - type page struct { - Values []UserIdentityContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result UserIdentitiesListOperationResponse, err error) { - req, err := c.preparerForUserIdentitiesListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserIdentitiesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// UserIdentitiesListComplete retrieves all of the results into a single object -func (c UserIdentityClient) UserIdentitiesListComplete(ctx context.Context, id UserId) (UserIdentitiesListCompleteResult, error) { - return c.UserIdentitiesListCompleteMatchingPredicate(ctx, id, UserIdentityContractOperationPredicate{}) -} - -// UserIdentitiesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c UserIdentityClient) UserIdentitiesListCompleteMatchingPredicate(ctx context.Context, id UserId, predicate UserIdentityContractOperationPredicate) (resp UserIdentitiesListCompleteResult, err error) { - items := make([]UserIdentityContract, 0) - - page, err := c.UserIdentitiesList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := UserIdentitiesListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/users/client.go b/resource-manager/apimanagement/2021-08-01/users/client.go index eead37dfa09..80c03b18406 100644 --- a/resource-manager/apimanagement/2021-08-01/users/client.go +++ b/resource-manager/apimanagement/2021-08-01/users/client.go @@ -1,18 +1,26 @@ package users -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UsersClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUsersClientWithBaseURI(endpoint string) UsersClient { - return UsersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUsersClientWithBaseURI(api sdkEnv.Api) (*UsersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "users", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UsersClient: %+v", err) } + + return &UsersClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/users/method_usergeneratessourl.go b/resource-manager/apimanagement/2021-08-01/users/method_usergeneratessourl.go new file mode 100644 index 00000000000..9cf69e473cf --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/users/method_usergeneratessourl.go @@ -0,0 +1,52 @@ +package users + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserGenerateSsoUrlOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GenerateSsoUrlResult +} + +// UserGenerateSsoUrl ... +func (c UsersClient) UserGenerateSsoUrl(ctx context.Context, id UserId) (result UserGenerateSsoUrlOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateSsoUrl", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/users/method_usergeneratessourl_autorest.go b/resource-manager/apimanagement/2021-08-01/users/method_usergeneratessourl_autorest.go deleted file mode 100644 index 90bf6c3ad37..00000000000 --- a/resource-manager/apimanagement/2021-08-01/users/method_usergeneratessourl_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package users - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserGenerateSsoUrlOperationResponse struct { - HttpResponse *http.Response - Model *GenerateSsoUrlResult -} - -// UserGenerateSsoUrl ... -func (c UsersClient) UserGenerateSsoUrl(ctx context.Context, id UserId) (result UserGenerateSsoUrlOperationResponse, err error) { - req, err := c.preparerForUserGenerateSsoUrl(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "users.UsersClient", "UserGenerateSsoUrl", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "users.UsersClient", "UserGenerateSsoUrl", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserGenerateSsoUrl(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "users.UsersClient", "UserGenerateSsoUrl", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserGenerateSsoUrl prepares the UserGenerateSsoUrl request. -func (c UsersClient) preparerForUserGenerateSsoUrl(ctx context.Context, id UserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/generateSsoUrl", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserGenerateSsoUrl handles the response to the UserGenerateSsoUrl request. The method always -// closes the http.Response Body. -func (c UsersClient) responderForUserGenerateSsoUrl(resp *http.Response) (result UserGenerateSsoUrlOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2021-08-01/usersubscription/client.go b/resource-manager/apimanagement/2021-08-01/usersubscription/client.go index d3ba8ac4ce8..673507388e9 100644 --- a/resource-manager/apimanagement/2021-08-01/usersubscription/client.go +++ b/resource-manager/apimanagement/2021-08-01/usersubscription/client.go @@ -1,18 +1,26 @@ package usersubscription -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserSubscriptionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserSubscriptionClientWithBaseURI(endpoint string) UserSubscriptionClient { - return UserSubscriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserSubscriptionClientWithBaseURI(api sdkEnv.Api) (*UserSubscriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "usersubscription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserSubscriptionClient: %+v", err) } + + return &UserSubscriptionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/usersubscription/constants.go b/resource-manager/apimanagement/2021-08-01/usersubscription/constants.go index f7ed9ea1ce6..8999ff3cae7 100644 --- a/resource-manager/apimanagement/2021-08-01/usersubscription/constants.go +++ b/resource-manager/apimanagement/2021-08-01/usersubscription/constants.go @@ -1,6 +1,10 @@ package usersubscription -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -27,6 +31,19 @@ func PossibleValuesForSubscriptionState() []string { } } +func (s *SubscriptionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSubscriptionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSubscriptionState(input string) (*SubscriptionState, error) { vals := map[string]SubscriptionState{ "active": SubscriptionStateActive, diff --git a/resource-manager/apimanagement/2021-08-01/usersubscription/method_list.go b/resource-manager/apimanagement/2021-08-01/usersubscription/method_list.go new file mode 100644 index 00000000000..e66d1f8242d --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/usersubscription/method_list.go @@ -0,0 +1,125 @@ +package usersubscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SubscriptionContract +} + +type ListCompleteResult struct { + Items []SubscriptionContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c UserSubscriptionClient) List(ctx context.Context, id UserId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/subscriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SubscriptionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c UserSubscriptionClient) ListComplete(ctx context.Context, id UserId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c UserSubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id UserId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]SubscriptionContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2021-08-01/usersubscription/method_list_autorest.go b/resource-manager/apimanagement/2021-08-01/usersubscription/method_list_autorest.go deleted file mode 100644 index e7fd01255cc..00000000000 --- a/resource-manager/apimanagement/2021-08-01/usersubscription/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package usersubscription - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]SubscriptionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []SubscriptionContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c UserSubscriptionClient) List(ctx context.Context, id UserId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c UserSubscriptionClient) preparerForList(ctx context.Context, id UserId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/subscriptions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c UserSubscriptionClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c UserSubscriptionClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []SubscriptionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c UserSubscriptionClient) ListComplete(ctx context.Context, id UserId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c UserSubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id UserId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]SubscriptionContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2021-08-01/usertoken/client.go b/resource-manager/apimanagement/2021-08-01/usertoken/client.go index ba17707e000..a19e5e1d326 100644 --- a/resource-manager/apimanagement/2021-08-01/usertoken/client.go +++ b/resource-manager/apimanagement/2021-08-01/usertoken/client.go @@ -1,18 +1,26 @@ package usertoken -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserTokenClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserTokenClientWithBaseURI(endpoint string) UserTokenClient { - return UserTokenClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserTokenClientWithBaseURI(api sdkEnv.Api) (*UserTokenClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "usertoken", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserTokenClient: %+v", err) } + + return &UserTokenClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2021-08-01/usertoken/constants.go b/resource-manager/apimanagement/2021-08-01/usertoken/constants.go index 9a1db97e8df..9c811483fc3 100644 --- a/resource-manager/apimanagement/2021-08-01/usertoken/constants.go +++ b/resource-manager/apimanagement/2021-08-01/usertoken/constants.go @@ -1,6 +1,10 @@ package usertoken -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForKeyType() []string { } } +func (s *KeyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKeyType(input string) (*KeyType, error) { vals := map[string]KeyType{ "primary": KeyTypePrimary, diff --git a/resource-manager/apimanagement/2021-08-01/usertoken/method_usergetsharedaccesstoken.go b/resource-manager/apimanagement/2021-08-01/usertoken/method_usergetsharedaccesstoken.go new file mode 100644 index 00000000000..c4fe631328a --- /dev/null +++ b/resource-manager/apimanagement/2021-08-01/usertoken/method_usergetsharedaccesstoken.go @@ -0,0 +1,56 @@ +package usertoken + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserGetSharedAccessTokenOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserTokenResult +} + +// UserGetSharedAccessToken ... +func (c UserTokenClient) UserGetSharedAccessToken(ctx context.Context, id UserId, input UserTokenParameters) (result UserGetSharedAccessTokenOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/token", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2021-08-01/usertoken/method_usergetsharedaccesstoken_autorest.go b/resource-manager/apimanagement/2021-08-01/usertoken/method_usergetsharedaccesstoken_autorest.go deleted file mode 100644 index 75e4e070eb0..00000000000 --- a/resource-manager/apimanagement/2021-08-01/usertoken/method_usergetsharedaccesstoken_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package usertoken - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserGetSharedAccessTokenOperationResponse struct { - HttpResponse *http.Response - Model *UserTokenResult -} - -// UserGetSharedAccessToken ... -func (c UserTokenClient) UserGetSharedAccessToken(ctx context.Context, id UserId, input UserTokenParameters) (result UserGetSharedAccessTokenOperationResponse, err error) { - req, err := c.preparerForUserGetSharedAccessToken(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "usertoken.UserTokenClient", "UserGetSharedAccessToken", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "usertoken.UserTokenClient", "UserGetSharedAccessToken", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserGetSharedAccessToken(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "usertoken.UserTokenClient", "UserGetSharedAccessToken", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserGetSharedAccessToken prepares the UserGetSharedAccessToken request. -func (c UserTokenClient) preparerForUserGetSharedAccessToken(ctx context.Context, id UserId, input UserTokenParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/token", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserGetSharedAccessToken handles the response to the UserGetSharedAccessToken request. The method always -// closes the http.Response Body. -func (c UserTokenClient) responderForUserGetSharedAccessToken(resp *http.Response) (result UserGetSharedAccessTokenOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/api/client.go b/resource-manager/apimanagement/2022-08-01/api/client.go index 6d9c8390b45..9057eaa0d46 100644 --- a/resource-manager/apimanagement/2022-08-01/api/client.go +++ b/resource-manager/apimanagement/2022-08-01/api/client.go @@ -1,18 +1,26 @@ package api -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiClientWithBaseURI(endpoint string) ApiClient { - return ApiClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiClientWithBaseURI(api sdkEnv.Api) (*ApiClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "api", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiClient: %+v", err) } + + return &ApiClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/api/constants.go b/resource-manager/apimanagement/2022-08-01/api/constants.go index 8448cef6b1a..534cfc958a1 100644 --- a/resource-manager/apimanagement/2022-08-01/api/constants.go +++ b/resource-manager/apimanagement/2022-08-01/api/constants.go @@ -1,6 +1,10 @@ package api -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -99,6 +129,19 @@ func PossibleValuesForContentFormat() []string { } } +func (s *ContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseContentFormat(input string) (*ContentFormat, error) { vals := map[string]ContentFormat{ "graphql-link": ContentFormatGraphqlNegativelink, @@ -140,6 +183,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, @@ -174,6 +230,19 @@ func PossibleValuesForSoapApiType() []string { } } +func (s *SoapApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSoapApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSoapApiType(input string) (*SoapApiType, error) { vals := map[string]SoapApiType{ "graphql": SoapApiTypeGraphql, @@ -204,6 +273,19 @@ func PossibleValuesForTranslateRequiredQueryParametersConduct() []string { } } +func (s *TranslateRequiredQueryParametersConduct) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTranslateRequiredQueryParametersConduct(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseTranslateRequiredQueryParametersConduct(input string) (*TranslateRequiredQueryParametersConduct, error) { vals := map[string]TranslateRequiredQueryParametersConduct{ "query": TranslateRequiredQueryParametersConductQuery, @@ -234,6 +316,19 @@ func PossibleValuesForVersioningScheme() []string { } } +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVersioningScheme(input string) (*VersioningScheme, error) { vals := map[string]VersioningScheme{ "header": VersioningSchemeHeader, diff --git a/resource-manager/apimanagement/2022-08-01/api/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/api/method_createorupdate.go new file mode 100644 index 00000000000..6906b67a6ba --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/api/method_createorupdate.go @@ -0,0 +1,103 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiClient) CreateOrUpdate(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ApiClient) CreateOrUpdateThenPoll(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/api/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/api/method_createorupdate_autorest.go deleted file mode 100644 index cf276d9f58f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/api/method_createorupdate_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package api - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiClient) CreateOrUpdate(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ApiClient) CreateOrUpdateThenPoll(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiClient) preparerForCreateOrUpdate(ctx context.Context, id ApiId, input ApiCreateOrUpdateParameter, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c ApiClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/api/method_delete.go b/resource-manager/apimanagement/2022-08-01/api/method_delete.go new file mode 100644 index 00000000000..19f24f35d16 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/api/method_delete.go @@ -0,0 +1,79 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + DeleteRevisions *bool + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.DeleteRevisions != nil { + out.Append("deleteRevisions", fmt.Sprintf("%v", *o.DeleteRevisions)) + } + return &out +} + +// Delete ... +func (c ApiClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/api/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/api/method_delete_autorest.go deleted file mode 100644 index 0971572259e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/api/method_delete_autorest.go +++ /dev/null @@ -1,100 +0,0 @@ -package api - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - DeleteRevisions *bool - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.DeleteRevisions != nil { - out["deleteRevisions"] = *o.DeleteRevisions - } - - return out -} - -// Delete ... -func (c ApiClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiClient) preparerForDelete(ctx context.Context, id ApiId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/api/method_get.go b/resource-manager/apimanagement/2022-08-01/api/method_get.go new file mode 100644 index 00000000000..f750fb8e0ec --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/api/method_get.go @@ -0,0 +1,51 @@ +package api + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +// Get ... +func (c ApiClient) Get(ctx context.Context, id ApiId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/api/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/api/method_get_autorest.go deleted file mode 100644 index cd4943ce66a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/api/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package api - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ApiContract -} - -// Get ... -func (c ApiClient) Get(ctx context.Context, id ApiId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiClient) preparerForGet(ctx context.Context, id ApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/api/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/api/method_getentitytag.go new file mode 100644 index 00000000000..5d65ab7fc88 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/api/method_getentitytag.go @@ -0,0 +1,46 @@ +package api + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/api/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/api/method_getentitytag_autorest.go deleted file mode 100644 index 326d2bb9cdf..00000000000 --- a/resource-manager/apimanagement/2022-08-01/api/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package api - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiClient) preparerForGetEntityTag(ctx context.Context, id ApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/api/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/api/method_listbyservice.go new file mode 100644 index 00000000000..2b6a6ad37f7 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/api/method_listbyservice.go @@ -0,0 +1,133 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiContract +} + +type ListByServiceCompleteResult struct { + Items []ApiContract +} + +type ListByServiceOperationOptions struct { + ExpandApiVersionSet *bool + Filter *string + Skip *int64 + Tags *string + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandApiVersionSet != nil { + out.Append("expandApiVersionSet", fmt.Sprintf("%v", *o.ExpandApiVersionSet)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Tags != nil { + out.Append("tags", fmt.Sprintf("%v", *o.Tags)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apis", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ApiContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/api/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/api/method_listbyservice_autorest.go deleted file mode 100644 index 114e7e5afe3..00000000000 --- a/resource-manager/apimanagement/2022-08-01/api/method_listbyservice_autorest.go +++ /dev/null @@ -1,235 +0,0 @@ -package api - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ApiContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - ExpandApiVersionSet *bool - Filter *string - Skip *int64 - Tags *string - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ExpandApiVersionSet != nil { - out["expandApiVersionSet"] = *o.ExpandApiVersionSet - } - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Tags != nil { - out["tags"] = *o.Tags - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/apis", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ApiContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ApiContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ApiContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/api/method_update.go b/resource-manager/apimanagement/2022-08-01/api/method_update.go new file mode 100644 index 00000000000..8b2e6fa4357 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/api/method_update.go @@ -0,0 +1,84 @@ +package api + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiClient) Update(ctx context.Context, id ApiId, input ApiUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/api/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/api/method_update_autorest.go deleted file mode 100644 index b998809dc0e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/api/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package api - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiClient) Update(ctx context.Context, id ApiId, input ApiUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "api.ApiClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiClient) preparerForUpdate(ctx context.Context, id ApiId, input ApiUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/client.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/client.go index 99e83188cc6..cbca867f180 100644 --- a/resource-manager/apimanagement/2022-08-01/apidiagnostic/client.go +++ b/resource-manager/apimanagement/2022-08-01/apidiagnostic/client.go @@ -1,18 +1,26 @@ package apidiagnostic -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiDiagnosticClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiDiagnosticClientWithBaseURI(endpoint string) ApiDiagnosticClient { - return ApiDiagnosticClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiDiagnosticClientWithBaseURI(api sdkEnv.Api) (*ApiDiagnosticClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apidiagnostic", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiDiagnosticClient: %+v", err) } + + return &ApiDiagnosticClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/constants.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/constants.go index 4d80cb551c7..1afde676ffa 100644 --- a/resource-manager/apimanagement/2022-08-01/apidiagnostic/constants.go +++ b/resource-manager/apimanagement/2022-08-01/apidiagnostic/constants.go @@ -1,6 +1,10 @@ package apidiagnostic -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -17,6 +21,19 @@ func PossibleValuesForAlwaysLog() []string { } } +func (s *AlwaysLog) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAlwaysLog(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAlwaysLog(input string) (*AlwaysLog, error) { vals := map[string]AlwaysLog{ "allerrors": AlwaysLogAllErrors, @@ -44,6 +61,19 @@ func PossibleValuesForDataMaskingMode() []string { } } +func (s *DataMaskingMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDataMaskingMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDataMaskingMode(input string) (*DataMaskingMode, error) { vals := map[string]DataMaskingMode{ "hide": DataMaskingModeHide, @@ -74,6 +104,19 @@ func PossibleValuesForHTTPCorrelationProtocol() []string { } } +func (s *HTTPCorrelationProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHTTPCorrelationProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseHTTPCorrelationProtocol(input string) (*HTTPCorrelationProtocol, error) { vals := map[string]HTTPCorrelationProtocol{ "legacy": HTTPCorrelationProtocolLegacy, @@ -103,6 +146,19 @@ func PossibleValuesForOperationNameFormat() []string { } } +func (s *OperationNameFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperationNameFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOperationNameFormat(input string) (*OperationNameFormat, error) { vals := map[string]OperationNameFormat{ "name": OperationNameFormatName, @@ -129,6 +185,19 @@ func PossibleValuesForSamplingType() []string { } } +func (s *SamplingType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSamplingType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSamplingType(input string) (*SamplingType, error) { vals := map[string]SamplingType{ "fixed": SamplingTypeFixed, @@ -158,6 +227,19 @@ func PossibleValuesForVerbosity() []string { } } +func (s *Verbosity) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVerbosity(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVerbosity(input string) (*Verbosity, error) { vals := map[string]Verbosity{ "error": VerbosityError, diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_createorupdate.go new file mode 100644 index 00000000000..d50634ca8da --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_createorupdate.go @@ -0,0 +1,85 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiDiagnosticClient) CreateOrUpdate(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_createorupdate_autorest.go deleted file mode 100644 index 510d94a82ae..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apidiagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiDiagnosticClient) CreateOrUpdate(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiDiagnosticClient) preparerForCreateOrUpdate(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_delete.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_delete.go new file mode 100644 index 00000000000..0fb3223f00f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_delete.go @@ -0,0 +1,76 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiDiagnosticClient) Delete(ctx context.Context, id ApiDiagnosticId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_delete_autorest.go deleted file mode 100644 index f9098fe95dd..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apidiagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiDiagnosticClient) Delete(ctx context.Context, id ApiDiagnosticId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiDiagnosticClient) preparerForDelete(ctx context.Context, id ApiDiagnosticId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_get.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_get.go new file mode 100644 index 00000000000..26dffc0cd3e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_get.go @@ -0,0 +1,51 @@ +package apidiagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +// Get ... +func (c ApiDiagnosticClient) Get(ctx context.Context, id ApiDiagnosticId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_get_autorest.go deleted file mode 100644 index 5468c122ef0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apidiagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -// Get ... -func (c ApiDiagnosticClient) Get(ctx context.Context, id ApiDiagnosticId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiDiagnosticClient) preparerForGet(ctx context.Context, id ApiDiagnosticId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_getentitytag.go new file mode 100644 index 00000000000..312e0f37414 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_getentitytag.go @@ -0,0 +1,46 @@ +package apidiagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiDiagnosticClient) GetEntityTag(ctx context.Context, id ApiDiagnosticId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_getentitytag_autorest.go deleted file mode 100644 index 4ad28bdb6d5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apidiagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiDiagnosticClient) GetEntityTag(ctx context.Context, id ApiDiagnosticId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiDiagnosticClient) preparerForGetEntityTag(ctx context.Context, id ApiDiagnosticId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_listbyservice.go new file mode 100644 index 00000000000..125ebd65d5f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_listbyservice.go @@ -0,0 +1,125 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DiagnosticContract +} + +type ListByServiceCompleteResult struct { + Items []DiagnosticContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiDiagnosticClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/diagnostics", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DiagnosticContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiDiagnosticClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DiagnosticContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiDiagnosticClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate DiagnosticContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]DiagnosticContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_listbyservice_autorest.go deleted file mode 100644 index c58834cf8bf..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apidiagnostic - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]DiagnosticContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []DiagnosticContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiDiagnosticClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiDiagnosticClient) preparerForListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/diagnostics", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiDiagnosticClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []DiagnosticContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiDiagnosticClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DiagnosticContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiDiagnosticClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate DiagnosticContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]DiagnosticContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_update.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_update.go new file mode 100644 index 00000000000..b5341b3da3e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_update.go @@ -0,0 +1,84 @@ +package apidiagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiDiagnosticClient) Update(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_update_autorest.go deleted file mode 100644 index fa90a3f37f8..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apidiagnostic/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apidiagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiDiagnosticClient) Update(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apidiagnostic.ApiDiagnosticClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiDiagnosticClient) preparerForUpdate(ctx context.Context, id ApiDiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiDiagnosticClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/client.go b/resource-manager/apimanagement/2022-08-01/apiissue/client.go index f63c05725de..2135eaf1043 100644 --- a/resource-manager/apimanagement/2022-08-01/apiissue/client.go +++ b/resource-manager/apimanagement/2022-08-01/apiissue/client.go @@ -1,18 +1,26 @@ package apiissue -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiIssueClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiIssueClientWithBaseURI(endpoint string) ApiIssueClient { - return ApiIssueClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiIssueClientWithBaseURI(api sdkEnv.Api) (*ApiIssueClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiissue", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiIssueClient: %+v", err) } + + return &ApiIssueClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/constants.go b/resource-manager/apimanagement/2022-08-01/apiissue/constants.go index 63548405b43..16888d5e064 100644 --- a/resource-manager/apimanagement/2022-08-01/apiissue/constants.go +++ b/resource-manager/apimanagement/2022-08-01/apiissue/constants.go @@ -1,6 +1,10 @@ package apiissue -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -25,6 +29,19 @@ func PossibleValuesForState() []string { } } +func (s *State) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseState(input string) (*State, error) { vals := map[string]State{ "closed": StateClosed, diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_createorupdate.go new file mode 100644 index 00000000000..10a6a5bca91 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissue/method_createorupdate.go @@ -0,0 +1,85 @@ +package apiissue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiIssueClient) CreateOrUpdate(ctx context.Context, id ApiIssueId, input IssueContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_createorupdate_autorest.go deleted file mode 100644 index 74810fa4260..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissue/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiissue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *IssueContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiIssueClient) CreateOrUpdate(ctx context.Context, id ApiIssueId, input IssueContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiIssueClient) preparerForCreateOrUpdate(ctx context.Context, id ApiIssueId, input IssueContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_delete.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_delete.go new file mode 100644 index 00000000000..822eaefefe3 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissue/method_delete.go @@ -0,0 +1,76 @@ +package apiissue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiIssueClient) Delete(ctx context.Context, id ApiIssueId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_delete_autorest.go deleted file mode 100644 index 77956335e4c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissue/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apiissue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiIssueClient) Delete(ctx context.Context, id ApiIssueId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiIssueClient) preparerForDelete(ctx context.Context, id ApiIssueId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_get.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_get.go new file mode 100644 index 00000000000..437b0420930 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissue/method_get.go @@ -0,0 +1,80 @@ +package apiissue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueContract +} + +type GetOperationOptions struct { + ExpandCommentsAttachments *bool +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandCommentsAttachments != nil { + out.Append("expandCommentsAttachments", fmt.Sprintf("%v", *o.ExpandCommentsAttachments)) + } + return &out +} + +// Get ... +func (c ApiIssueClient) Get(ctx context.Context, id ApiIssueId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_get_autorest.go deleted file mode 100644 index 0821e733063..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissue/method_get_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package apiissue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *IssueContract -} - -type GetOperationOptions struct { - ExpandCommentsAttachments *bool -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ExpandCommentsAttachments != nil { - out["expandCommentsAttachments"] = *o.ExpandCommentsAttachments - } - - return out -} - -// Get ... -func (c ApiIssueClient) Get(ctx context.Context, id ApiIssueId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiIssueClient) preparerForGet(ctx context.Context, id ApiIssueId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_getentitytag.go new file mode 100644 index 00000000000..fa22e539b24 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissue/method_getentitytag.go @@ -0,0 +1,46 @@ +package apiissue + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiIssueClient) GetEntityTag(ctx context.Context, id ApiIssueId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_getentitytag_autorest.go deleted file mode 100644 index 589dff977e0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissue/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apiissue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiIssueClient) GetEntityTag(ctx context.Context, id ApiIssueId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiIssueClient) preparerForGetEntityTag(ctx context.Context, id ApiIssueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_listbyservice.go new file mode 100644 index 00000000000..faa0de569c6 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissue/method_listbyservice.go @@ -0,0 +1,129 @@ +package apiissue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]IssueContract +} + +type ListByServiceCompleteResult struct { + Items []IssueContract +} + +type ListByServiceOperationOptions struct { + ExpandCommentsAttachments *bool + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandCommentsAttachments != nil { + out.Append("expandCommentsAttachments", fmt.Sprintf("%v", *o.ExpandCommentsAttachments)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiIssueClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/issues", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]IssueContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiIssueClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiIssueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate IssueContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]IssueContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_listbyservice_autorest.go deleted file mode 100644 index 48b3a2c6d18..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissue/method_listbyservice_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package apiissue - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]IssueContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []IssueContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - ExpandCommentsAttachments *bool - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ExpandCommentsAttachments != nil { - out["expandCommentsAttachments"] = *o.ExpandCommentsAttachments - } - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiIssueClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiIssueClient) preparerForListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/issues", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiIssueClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []IssueContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiIssueClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiIssueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate IssueContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]IssueContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_update.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_update.go new file mode 100644 index 00000000000..584e3d7d164 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissue/method_update.go @@ -0,0 +1,84 @@ +package apiissue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiIssueClient) Update(ctx context.Context, id ApiIssueId, input IssueUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissue/method_update_autorest.go deleted file mode 100644 index f2e65e33867..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissue/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiissue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *IssueContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiIssueClient) Update(ctx context.Context, id ApiIssueId, input IssueUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissue.ApiIssueClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiIssueClient) preparerForUpdate(ctx context.Context, id ApiIssueId, input IssueUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiIssueClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/client.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/client.go index 603bab63d7c..9c73e8cfca8 100644 --- a/resource-manager/apimanagement/2022-08-01/apiissueattachment/client.go +++ b/resource-manager/apimanagement/2022-08-01/apiissueattachment/client.go @@ -1,18 +1,26 @@ package apiissueattachment -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiIssueAttachmentClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiIssueAttachmentClientWithBaseURI(endpoint string) ApiIssueAttachmentClient { - return ApiIssueAttachmentClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiIssueAttachmentClientWithBaseURI(api sdkEnv.Api) (*ApiIssueAttachmentClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiissueattachment", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiIssueAttachmentClient: %+v", err) } + + return &ApiIssueAttachmentClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_createorupdate.go new file mode 100644 index 00000000000..9b38974fd6c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_createorupdate.go @@ -0,0 +1,85 @@ +package apiissueattachment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueAttachmentContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiIssueAttachmentClient) CreateOrUpdate(ctx context.Context, id AttachmentId, input IssueAttachmentContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_createorupdate_autorest.go deleted file mode 100644 index 0d3c8faed1f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiissueattachment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *IssueAttachmentContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiIssueAttachmentClient) CreateOrUpdate(ctx context.Context, id AttachmentId, input IssueAttachmentContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiIssueAttachmentClient) preparerForCreateOrUpdate(ctx context.Context, id AttachmentId, input IssueAttachmentContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiIssueAttachmentClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_delete.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_delete.go new file mode 100644 index 00000000000..e2c80a156a2 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_delete.go @@ -0,0 +1,76 @@ +package apiissueattachment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiIssueAttachmentClient) Delete(ctx context.Context, id AttachmentId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_delete_autorest.go deleted file mode 100644 index 0c1c547304e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apiissueattachment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiIssueAttachmentClient) Delete(ctx context.Context, id AttachmentId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiIssueAttachmentClient) preparerForDelete(ctx context.Context, id AttachmentId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiIssueAttachmentClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_get.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_get.go new file mode 100644 index 00000000000..3e35f0e3c03 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_get.go @@ -0,0 +1,51 @@ +package apiissueattachment + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueAttachmentContract +} + +// Get ... +func (c ApiIssueAttachmentClient) Get(ctx context.Context, id AttachmentId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_get_autorest.go deleted file mode 100644 index cf5a5442e8f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apiissueattachment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *IssueAttachmentContract -} - -// Get ... -func (c ApiIssueAttachmentClient) Get(ctx context.Context, id AttachmentId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiIssueAttachmentClient) preparerForGet(ctx context.Context, id AttachmentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiIssueAttachmentClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_getentitytag.go new file mode 100644 index 00000000000..417b3e0b9bd --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_getentitytag.go @@ -0,0 +1,46 @@ +package apiissueattachment + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiIssueAttachmentClient) GetEntityTag(ctx context.Context, id AttachmentId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_getentitytag_autorest.go deleted file mode 100644 index 24756f5be27..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apiissueattachment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiIssueAttachmentClient) GetEntityTag(ctx context.Context, id AttachmentId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiIssueAttachmentClient) preparerForGetEntityTag(ctx context.Context, id AttachmentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiIssueAttachmentClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_listbyservice.go new file mode 100644 index 00000000000..bda7001b3ab --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_listbyservice.go @@ -0,0 +1,125 @@ +package apiissueattachment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]IssueAttachmentContract +} + +type ListByServiceCompleteResult struct { + Items []IssueAttachmentContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiIssueAttachmentClient) ListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/attachments", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]IssueAttachmentContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiIssueAttachmentClient) ListByServiceComplete(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueAttachmentContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiIssueAttachmentClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions, predicate IssueAttachmentContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]IssueAttachmentContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_listbyservice_autorest.go deleted file mode 100644 index 8decbc696ea..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissueattachment/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apiissueattachment - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]IssueAttachmentContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []IssueAttachmentContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiIssueAttachmentClient) ListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiIssueAttachmentClient) preparerForListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/attachments", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiIssueAttachmentClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiIssueAttachmentClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []IssueAttachmentContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissueattachment.ApiIssueAttachmentClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiIssueAttachmentClient) ListByServiceComplete(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueAttachmentContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiIssueAttachmentClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions, predicate IssueAttachmentContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]IssueAttachmentContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/client.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/client.go index c2d875d616a..475bacaea06 100644 --- a/resource-manager/apimanagement/2022-08-01/apiissuecomment/client.go +++ b/resource-manager/apimanagement/2022-08-01/apiissuecomment/client.go @@ -1,18 +1,26 @@ package apiissuecomment -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiIssueCommentClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiIssueCommentClientWithBaseURI(endpoint string) ApiIssueCommentClient { - return ApiIssueCommentClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiIssueCommentClientWithBaseURI(api sdkEnv.Api) (*ApiIssueCommentClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiissuecomment", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiIssueCommentClient: %+v", err) } + + return &ApiIssueCommentClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_createorupdate.go new file mode 100644 index 00000000000..4151626f6b6 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_createorupdate.go @@ -0,0 +1,85 @@ +package apiissuecomment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueCommentContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiIssueCommentClient) CreateOrUpdate(ctx context.Context, id CommentId, input IssueCommentContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_createorupdate_autorest.go deleted file mode 100644 index 4b1b3d4e955..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiissuecomment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *IssueCommentContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiIssueCommentClient) CreateOrUpdate(ctx context.Context, id CommentId, input IssueCommentContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiIssueCommentClient) preparerForCreateOrUpdate(ctx context.Context, id CommentId, input IssueCommentContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiIssueCommentClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_delete.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_delete.go new file mode 100644 index 00000000000..b6cb1c7f69b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_delete.go @@ -0,0 +1,76 @@ +package apiissuecomment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiIssueCommentClient) Delete(ctx context.Context, id CommentId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_delete_autorest.go deleted file mode 100644 index ae7d6a12be4..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apiissuecomment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiIssueCommentClient) Delete(ctx context.Context, id CommentId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiIssueCommentClient) preparerForDelete(ctx context.Context, id CommentId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiIssueCommentClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_get.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_get.go new file mode 100644 index 00000000000..df6ff41fb18 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_get.go @@ -0,0 +1,51 @@ +package apiissuecomment + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueCommentContract +} + +// Get ... +func (c ApiIssueCommentClient) Get(ctx context.Context, id CommentId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_get_autorest.go deleted file mode 100644 index 97cae9d1ac1..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apiissuecomment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *IssueCommentContract -} - -// Get ... -func (c ApiIssueCommentClient) Get(ctx context.Context, id CommentId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiIssueCommentClient) preparerForGet(ctx context.Context, id CommentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiIssueCommentClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_getentitytag.go new file mode 100644 index 00000000000..a5ce802f723 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_getentitytag.go @@ -0,0 +1,46 @@ +package apiissuecomment + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiIssueCommentClient) GetEntityTag(ctx context.Context, id CommentId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_getentitytag_autorest.go deleted file mode 100644 index 7793e44727b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apiissuecomment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiIssueCommentClient) GetEntityTag(ctx context.Context, id CommentId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiIssueCommentClient) preparerForGetEntityTag(ctx context.Context, id CommentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiIssueCommentClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_listbyservice.go new file mode 100644 index 00000000000..3240d518d9c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_listbyservice.go @@ -0,0 +1,125 @@ +package apiissuecomment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]IssueCommentContract +} + +type ListByServiceCompleteResult struct { + Items []IssueCommentContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiIssueCommentClient) ListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/comments", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]IssueCommentContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiIssueCommentClient) ListByServiceComplete(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueCommentContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiIssueCommentClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions, predicate IssueCommentContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]IssueCommentContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_listbyservice_autorest.go deleted file mode 100644 index 3057cba0d58..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiissuecomment/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apiissuecomment - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]IssueCommentContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []IssueCommentContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiIssueCommentClient) ListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiIssueCommentClient) preparerForListByService(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/comments", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiIssueCommentClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiIssueCommentClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []IssueCommentContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiissuecomment.ApiIssueCommentClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiIssueCommentClient) ListByServiceComplete(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueCommentContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiIssueCommentClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiIssueId, options ListByServiceOperationOptions, predicate IssueCommentContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]IssueCommentContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/client.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/client.go index b6859cfd757..830fe9c9333 100644 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/client.go +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/client.go @@ -1,18 +1,26 @@ package apimanagementservice -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiManagementServiceClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiManagementServiceClientWithBaseURI(endpoint string) ApiManagementServiceClient { - return ApiManagementServiceClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiManagementServiceClientWithBaseURI(api sdkEnv.Api) (*ApiManagementServiceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apimanagementservice", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiManagementServiceClient: %+v", err) } + + return &ApiManagementServiceClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/constants.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/constants.go index 5eb7eeb6ae4..d9fbce72ae6 100644 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/constants.go +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/constants.go @@ -1,6 +1,10 @@ package apimanagementservice -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForAccessType() []string { } } +func (s *AccessType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAccessType(input string) (*AccessType, error) { vals := map[string]AccessType{ "accesskey": AccessTypeAccessKey, @@ -54,6 +71,19 @@ func PossibleValuesForCertificateSource() []string { } } +func (s *CertificateSource) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCertificateSource(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCertificateSource(input string) (*CertificateSource, error) { vals := map[string]CertificateSource{ "builtin": CertificateSourceBuiltIn, @@ -86,6 +116,19 @@ func PossibleValuesForCertificateStatus() []string { } } +func (s *CertificateStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCertificateStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCertificateStatus(input string) (*CertificateStatus, error) { vals := map[string]CertificateStatus{ "completed": CertificateStatusCompleted, @@ -121,6 +164,19 @@ func PossibleValuesForHostnameType() []string { } } +func (s *HostnameType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHostnameType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseHostnameType(input string) (*HostnameType, error) { vals := map[string]HostnameType{ "developerportal": HostnameTypeDeveloperPortal, @@ -154,6 +210,19 @@ func PossibleValuesForNameAvailabilityReason() []string { } } +func (s *NameAvailabilityReason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNameAvailabilityReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNameAvailabilityReason(input string) (*NameAvailabilityReason, error) { vals := map[string]NameAvailabilityReason{ "alreadyexists": NameAvailabilityReasonAlreadyExists, @@ -183,6 +252,19 @@ func PossibleValuesForNatGatewayState() []string { } } +func (s *NatGatewayState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNatGatewayState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNatGatewayState(input string) (*NatGatewayState, error) { vals := map[string]NatGatewayState{ "disabled": NatGatewayStateDisabled, @@ -215,6 +297,19 @@ func PossibleValuesForPlatformVersion() []string { } } +func (s *PlatformVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePlatformVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePlatformVersion(input string) (*PlatformVersion, error) { vals := map[string]PlatformVersion{ "mtv1": PlatformVersionMtvOne, @@ -247,6 +342,19 @@ func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { } } +func (s *PrivateEndpointServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { vals := map[string]PrivateEndpointServiceConnectionStatus{ "approved": PrivateEndpointServiceConnectionStatusApproved, @@ -276,6 +384,19 @@ func PossibleValuesForPublicNetworkAccess() []string { } } +func (s *PublicNetworkAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { vals := map[string]PublicNetworkAccess{ "disabled": PublicNetworkAccessDisabled, @@ -312,6 +433,19 @@ func PossibleValuesForSkuType() []string { } } +func (s *SkuType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSkuType(input string) (*SkuType, error) { vals := map[string]SkuType{ "basic": SkuTypeBasic, @@ -344,6 +478,19 @@ func PossibleValuesForStoreName() []string { } } +func (s *StoreName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStoreName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseStoreName(input string) (*StoreName, error) { vals := map[string]StoreName{ "certificateauthority": StoreNameCertificateAuthority, @@ -374,6 +521,19 @@ func PossibleValuesForVirtualNetworkType() []string { } } +func (s *VirtualNetworkType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualNetworkType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVirtualNetworkType(input string) (*VirtualNetworkType, error) { vals := map[string]VirtualNetworkType{ "external": VirtualNetworkTypeExternal, diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_applynetworkconfigurationupdates.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_applynetworkconfigurationupdates.go new file mode 100644 index 00000000000..47666690d41 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_applynetworkconfigurationupdates.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplyNetworkConfigurationUpdatesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApplyNetworkConfigurationUpdates ... +func (c ApiManagementServiceClient) ApplyNetworkConfigurationUpdates(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) (result ApplyNetworkConfigurationUpdatesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/applynetworkconfigurationupdates", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ApplyNetworkConfigurationUpdatesThenPoll performs ApplyNetworkConfigurationUpdates then polls until it's completed +func (c ApiManagementServiceClient) ApplyNetworkConfigurationUpdatesThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) error { + result, err := c.ApplyNetworkConfigurationUpdates(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ApplyNetworkConfigurationUpdates: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApplyNetworkConfigurationUpdates: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_applynetworkconfigurationupdates_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_applynetworkconfigurationupdates_autorest.go deleted file mode 100644 index 7a1a5edef4d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_applynetworkconfigurationupdates_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ApplyNetworkConfigurationUpdatesOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// ApplyNetworkConfigurationUpdates ... -func (c ApiManagementServiceClient) ApplyNetworkConfigurationUpdates(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) (result ApplyNetworkConfigurationUpdatesOperationResponse, err error) { - req, err := c.preparerForApplyNetworkConfigurationUpdates(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ApplyNetworkConfigurationUpdates", nil, "Failure preparing request") - return - } - - result, err = c.senderForApplyNetworkConfigurationUpdates(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ApplyNetworkConfigurationUpdates", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ApplyNetworkConfigurationUpdatesThenPoll performs ApplyNetworkConfigurationUpdates then polls until it's completed -func (c ApiManagementServiceClient) ApplyNetworkConfigurationUpdatesThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) error { - result, err := c.ApplyNetworkConfigurationUpdates(ctx, id, input) - if err != nil { - return fmt.Errorf("performing ApplyNetworkConfigurationUpdates: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after ApplyNetworkConfigurationUpdates: %+v", err) - } - - return nil -} - -// preparerForApplyNetworkConfigurationUpdates prepares the ApplyNetworkConfigurationUpdates request. -func (c ApiManagementServiceClient) preparerForApplyNetworkConfigurationUpdates(ctx context.Context, id ServiceId, input ApiManagementServiceApplyNetworkConfigurationParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/applynetworkconfigurationupdates", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForApplyNetworkConfigurationUpdates sends the ApplyNetworkConfigurationUpdates request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForApplyNetworkConfigurationUpdates(ctx context.Context, req *http.Request) (future ApplyNetworkConfigurationUpdatesOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_backup.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_backup.go new file mode 100644 index 00000000000..2d68d0ef05f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_backup.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Backup ... +func (c ApiManagementServiceClient) Backup(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (result BackupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/backup", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BackupThenPoll performs Backup then polls until it's completed +func (c ApiManagementServiceClient) BackupThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) error { + result, err := c.Backup(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Backup: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Backup: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_backup_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_backup_autorest.go deleted file mode 100644 index 425460d47a1..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_backup_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BackupOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Backup ... -func (c ApiManagementServiceClient) Backup(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (result BackupOperationResponse, err error) { - req, err := c.preparerForBackup(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Backup", nil, "Failure preparing request") - return - } - - result, err = c.senderForBackup(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Backup", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// BackupThenPoll performs Backup then polls until it's completed -func (c ApiManagementServiceClient) BackupThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) error { - result, err := c.Backup(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Backup: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Backup: %+v", err) - } - - return nil -} - -// preparerForBackup prepares the Backup request. -func (c ApiManagementServiceClient) preparerForBackup(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/backup", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForBackup sends the Backup request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForBackup(ctx context.Context, req *http.Request) (future BackupOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_checknameavailability.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_checknameavailability.go new file mode 100644 index 00000000000..69c30c85560 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_checknameavailability.go @@ -0,0 +1,57 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceNameAvailabilityResult +} + +// CheckNameAvailability ... +func (c ApiManagementServiceClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input ApiManagementServiceCheckNameAvailabilityParameters) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/checkNameAvailability", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_checknameavailability_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_checknameavailability_autorest.go deleted file mode 100644 index cd62edeb4a2..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_checknameavailability_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *ApiManagementServiceNameAvailabilityResult -} - -// CheckNameAvailability ... -func (c ApiManagementServiceClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input ApiManagementServiceCheckNameAvailabilityParameters) (result CheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c ApiManagementServiceClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input ApiManagementServiceCheckNameAvailabilityParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_createorupdate.go new file mode 100644 index 00000000000..6ad0b1f3c65 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_createorupdate.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c ApiManagementServiceClient) CreateOrUpdate(ctx context.Context, id ServiceId, input ApiManagementServiceResource) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ApiManagementServiceClient) CreateOrUpdateThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceResource) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_createorupdate_autorest.go deleted file mode 100644 index b374287e28f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c ApiManagementServiceClient) CreateOrUpdate(ctx context.Context, id ServiceId, input ApiManagementServiceResource) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ApiManagementServiceClient) CreateOrUpdateThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceResource) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiManagementServiceClient) preparerForCreateOrUpdate(ctx context.Context, id ServiceId, input ApiManagementServiceResource) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_delete.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_delete.go new file mode 100644 index 00000000000..e40cd93940a --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_delete.go @@ -0,0 +1,71 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ApiManagementServiceClient) Delete(ctx context.Context, id ServiceId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ApiManagementServiceClient) DeleteThenPoll(ctx context.Context, id ServiceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_delete_autorest.go deleted file mode 100644 index c8aa7ccb600..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c ApiManagementServiceClient) Delete(ctx context.Context, id ServiceId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ApiManagementServiceClient) DeleteThenPoll(ctx context.Context, id ServiceId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c ApiManagementServiceClient) preparerForDelete(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_get.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_get.go new file mode 100644 index 00000000000..a12ef17aed4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_get.go @@ -0,0 +1,51 @@ +package apimanagementservice + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceResource +} + +// Get ... +func (c ApiManagementServiceClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_get_autorest.go deleted file mode 100644 index 83af95cf755..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apimanagementservice - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ApiManagementServiceResource -} - -// Get ... -func (c ApiManagementServiceClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiManagementServiceClient) preparerForGet(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getdomainownershipidentifier.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getdomainownershipidentifier.go new file mode 100644 index 00000000000..de103cd5209 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getdomainownershipidentifier.go @@ -0,0 +1,53 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDomainOwnershipIdentifierOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceGetDomainOwnershipIdentifierResult +} + +// GetDomainOwnershipIdentifier ... +func (c ApiManagementServiceClient) GetDomainOwnershipIdentifier(ctx context.Context, id commonids.SubscriptionId) (result GetDomainOwnershipIdentifierOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getdomainownershipidentifier_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getdomainownershipidentifier_autorest.go deleted file mode 100644 index 3ee44e20f2e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getdomainownershipidentifier_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetDomainOwnershipIdentifierOperationResponse struct { - HttpResponse *http.Response - Model *ApiManagementServiceGetDomainOwnershipIdentifierResult -} - -// GetDomainOwnershipIdentifier ... -func (c ApiManagementServiceClient) GetDomainOwnershipIdentifier(ctx context.Context, id commonids.SubscriptionId) (result GetDomainOwnershipIdentifierOperationResponse, err error) { - req, err := c.preparerForGetDomainOwnershipIdentifier(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetDomainOwnershipIdentifier", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetDomainOwnershipIdentifier", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetDomainOwnershipIdentifier(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetDomainOwnershipIdentifier", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetDomainOwnershipIdentifier prepares the GetDomainOwnershipIdentifier request. -func (c ApiManagementServiceClient) preparerForGetDomainOwnershipIdentifier(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetDomainOwnershipIdentifier handles the response to the GetDomainOwnershipIdentifier request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForGetDomainOwnershipIdentifier(resp *http.Response) (result GetDomainOwnershipIdentifierOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getssotoken.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getssotoken.go new file mode 100644 index 00000000000..2831bca105b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getssotoken.go @@ -0,0 +1,52 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetSsoTokenOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiManagementServiceGetSsoTokenResult +} + +// GetSsoToken ... +func (c ApiManagementServiceClient) GetSsoToken(ctx context.Context, id ServiceId) (result GetSsoTokenOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/getssotoken", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getssotoken_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getssotoken_autorest.go deleted file mode 100644 index e66d5a4b465..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_getssotoken_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetSsoTokenOperationResponse struct { - HttpResponse *http.Response - Model *ApiManagementServiceGetSsoTokenResult -} - -// GetSsoToken ... -func (c ApiManagementServiceClient) GetSsoToken(ctx context.Context, id ServiceId) (result GetSsoTokenOperationResponse, err error) { - req, err := c.preparerForGetSsoToken(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetSsoToken", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetSsoToken", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetSsoToken(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "GetSsoToken", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetSsoToken prepares the GetSsoToken request. -func (c ApiManagementServiceClient) preparerForGetSsoToken(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/getssotoken", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetSsoToken handles the response to the GetSsoToken request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForGetSsoToken(resp *http.Response) (result GetSsoTokenOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_list.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_list.go new file mode 100644 index 00000000000..2f75508ba8a --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_list.go @@ -0,0 +1,90 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiManagementServiceResource +} + +type ListCompleteResult struct { + Items []ApiManagementServiceResource +} + +// List ... +func (c ApiManagementServiceClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/service", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiManagementServiceResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ApiManagementServiceClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ApiManagementServiceResourceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiManagementServiceClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApiManagementServiceResourceOperationPredicate) (result ListCompleteResult, err error) { + items := make([]ApiManagementServiceResource, 0) + + resp, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_list_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_list_autorest.go deleted file mode 100644 index bc98fce7338..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_list_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiManagementServiceResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []ApiManagementServiceResource -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c ApiManagementServiceClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ApiManagementServiceClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/service", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ApiManagementServiceClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []ApiManagementServiceResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ApiManagementServiceClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ApiManagementServiceResourceOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiManagementServiceClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApiManagementServiceResourceOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]ApiManagementServiceResource, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_listbyresourcegroup.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_listbyresourcegroup.go new file mode 100644 index 00000000000..46aadae6bda --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiManagementServiceResource +} + +type ListByResourceGroupCompleteResult struct { + Items []ApiManagementServiceResource +} + +// ListByResourceGroup ... +func (c ApiManagementServiceClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/service", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiManagementServiceResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ApiManagementServiceClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ApiManagementServiceResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiManagementServiceClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ApiManagementServiceResourceOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ApiManagementServiceResource, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_listbyresourcegroup_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_listbyresourcegroup_autorest.go deleted file mode 100644 index f7776316529..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiManagementServiceResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []ApiManagementServiceResource -} - -func (r ListByResourceGroupOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c ApiManagementServiceClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ApiManagementServiceClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/service", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c ApiManagementServiceClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []ApiManagementServiceResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c ApiManagementServiceClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ApiManagementServiceResourceOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiManagementServiceClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ApiManagementServiceResourceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]ApiManagementServiceResource, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_migratetostv2.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_migratetostv2.go new file mode 100644 index 00000000000..97feacb5423 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_migratetostv2.go @@ -0,0 +1,70 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrateToStv2OperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// MigrateToStv2 ... +func (c ApiManagementServiceClient) MigrateToStv2(ctx context.Context, id ServiceId) (result MigrateToStv2OperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/migrateToStv2", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// MigrateToStv2ThenPoll performs MigrateToStv2 then polls until it's completed +func (c ApiManagementServiceClient) MigrateToStv2ThenPoll(ctx context.Context, id ServiceId) error { + result, err := c.MigrateToStv2(ctx, id) + if err != nil { + return fmt.Errorf("performing MigrateToStv2: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after MigrateToStv2: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_migratetostv2_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_migratetostv2_autorest.go deleted file mode 100644 index cd18295a0b2..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_migratetostv2_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MigrateToStv2OperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// MigrateToStv2 ... -func (c ApiManagementServiceClient) MigrateToStv2(ctx context.Context, id ServiceId) (result MigrateToStv2OperationResponse, err error) { - req, err := c.preparerForMigrateToStv2(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "MigrateToStv2", nil, "Failure preparing request") - return - } - - result, err = c.senderForMigrateToStv2(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "MigrateToStv2", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// MigrateToStv2ThenPoll performs MigrateToStv2 then polls until it's completed -func (c ApiManagementServiceClient) MigrateToStv2ThenPoll(ctx context.Context, id ServiceId) error { - result, err := c.MigrateToStv2(ctx, id) - if err != nil { - return fmt.Errorf("performing MigrateToStv2: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after MigrateToStv2: %+v", err) - } - - return nil -} - -// preparerForMigrateToStv2 prepares the MigrateToStv2 request. -func (c ApiManagementServiceClient) preparerForMigrateToStv2(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/migrateToStv2", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForMigrateToStv2 sends the MigrateToStv2 request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForMigrateToStv2(ctx context.Context, req *http.Request) (future MigrateToStv2OperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_restore.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_restore.go new file mode 100644 index 00000000000..5ea017b5905 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_restore.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestoreOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restore ... +func (c ApiManagementServiceClient) Restore(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (result RestoreOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restore", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RestoreThenPoll performs Restore then polls until it's completed +func (c ApiManagementServiceClient) RestoreThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) error { + result, err := c.Restore(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Restore: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restore: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_restore_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_restore_autorest.go deleted file mode 100644 index bb762b61349..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_restore_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RestoreOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Restore ... -func (c ApiManagementServiceClient) Restore(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (result RestoreOperationResponse, err error) { - req, err := c.preparerForRestore(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Restore", nil, "Failure preparing request") - return - } - - result, err = c.senderForRestore(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Restore", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RestoreThenPoll performs Restore then polls until it's completed -func (c ApiManagementServiceClient) RestoreThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) error { - result, err := c.Restore(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Restore: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Restore: %+v", err) - } - - return nil -} - -// preparerForRestore prepares the Restore request. -func (c ApiManagementServiceClient) preparerForRestore(ctx context.Context, id ServiceId, input ApiManagementServiceBackupRestoreParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/restore", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRestore sends the Restore request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForRestore(ctx context.Context, req *http.Request) (future RestoreOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_update.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_update.go new file mode 100644 index 00000000000..9a2e8907c9b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_update.go @@ -0,0 +1,74 @@ +package apimanagementservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c ApiManagementServiceClient) Update(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ApiManagementServiceClient) UpdateThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_update_autorest.go deleted file mode 100644 index c4047579231..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/method_update_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package apimanagementservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c ApiManagementServiceClient) Update(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementservice.ApiManagementServiceClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c ApiManagementServiceClient) UpdateThenPoll(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c ApiManagementServiceClient) preparerForUpdate(ctx context.Context, id ServiceId, input ApiManagementServiceUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c ApiManagementServiceClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/client.go b/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/client.go index eb6747c1e12..8940dc53edb 100644 --- a/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/client.go +++ b/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/client.go @@ -1,18 +1,26 @@ package apimanagementserviceskus -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiManagementServiceSkusClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiManagementServiceSkusClientWithBaseURI(endpoint string) ApiManagementServiceSkusClient { - return ApiManagementServiceSkusClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiManagementServiceSkusClientWithBaseURI(api sdkEnv.Api) (*ApiManagementServiceSkusClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apimanagementserviceskus", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiManagementServiceSkusClient: %+v", err) } + + return &ApiManagementServiceSkusClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/constants.go b/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/constants.go index d5d2b9ea3eb..d9e2bd19e1c 100644 --- a/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/constants.go +++ b/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/constants.go @@ -1,6 +1,10 @@ package apimanagementserviceskus -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForResourceSkuCapacityScaleType() []string { } } +func (s *ResourceSkuCapacityScaleType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceSkuCapacityScaleType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseResourceSkuCapacityScaleType(input string) (*ResourceSkuCapacityScaleType, error) { vals := map[string]ResourceSkuCapacityScaleType{ "automatic": ResourceSkuCapacityScaleTypeAutomatic, @@ -58,6 +75,19 @@ func PossibleValuesForSkuType() []string { } } +func (s *SkuType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSkuType(input string) (*SkuType, error) { vals := map[string]SkuType{ "basic": SkuTypeBasic, diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/method_listavailableserviceskus.go b/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/method_listavailableserviceskus.go new file mode 100644 index 00000000000..afe8ea5af07 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/method_listavailableserviceskus.go @@ -0,0 +1,89 @@ +package apimanagementserviceskus + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAvailableServiceSkusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ResourceSkuResult +} + +type ListAvailableServiceSkusCompleteResult struct { + Items []ResourceSkuResult +} + +// ListAvailableServiceSkus ... +func (c ApiManagementServiceSkusClient) ListAvailableServiceSkus(ctx context.Context, id ServiceId) (result ListAvailableServiceSkusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/skus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ResourceSkuResult `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAvailableServiceSkusComplete retrieves all the results into a single object +func (c ApiManagementServiceSkusClient) ListAvailableServiceSkusComplete(ctx context.Context, id ServiceId) (ListAvailableServiceSkusCompleteResult, error) { + return c.ListAvailableServiceSkusCompleteMatchingPredicate(ctx, id, ResourceSkuResultOperationPredicate{}) +} + +// ListAvailableServiceSkusCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiManagementServiceSkusClient) ListAvailableServiceSkusCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate ResourceSkuResultOperationPredicate) (result ListAvailableServiceSkusCompleteResult, err error) { + items := make([]ResourceSkuResult, 0) + + resp, err := c.ListAvailableServiceSkus(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListAvailableServiceSkusCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/method_listavailableserviceskus_autorest.go b/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/method_listavailableserviceskus_autorest.go deleted file mode 100644 index f5aa634c623..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/method_listavailableserviceskus_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package apimanagementserviceskus - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListAvailableServiceSkusOperationResponse struct { - HttpResponse *http.Response - Model *[]ResourceSkuResult - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListAvailableServiceSkusOperationResponse, error) -} - -type ListAvailableServiceSkusCompleteResult struct { - Items []ResourceSkuResult -} - -func (r ListAvailableServiceSkusOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListAvailableServiceSkusOperationResponse) LoadMore(ctx context.Context) (resp ListAvailableServiceSkusOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListAvailableServiceSkus ... -func (c ApiManagementServiceSkusClient) ListAvailableServiceSkus(ctx context.Context, id ServiceId) (resp ListAvailableServiceSkusOperationResponse, err error) { - req, err := c.preparerForListAvailableServiceSkus(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListAvailableServiceSkus(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListAvailableServiceSkus prepares the ListAvailableServiceSkus request. -func (c ApiManagementServiceSkusClient) preparerForListAvailableServiceSkus(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/skus", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListAvailableServiceSkusWithNextLink prepares the ListAvailableServiceSkus request with the given nextLink token. -func (c ApiManagementServiceSkusClient) preparerForListAvailableServiceSkusWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListAvailableServiceSkus handles the response to the ListAvailableServiceSkus request. The method always -// closes the http.Response Body. -func (c ApiManagementServiceSkusClient) responderForListAvailableServiceSkus(resp *http.Response) (result ListAvailableServiceSkusOperationResponse, err error) { - type page struct { - Values []ResourceSkuResult `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAvailableServiceSkusOperationResponse, err error) { - req, err := c.preparerForListAvailableServiceSkusWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListAvailableServiceSkus(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagementserviceskus.ApiManagementServiceSkusClient", "ListAvailableServiceSkus", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListAvailableServiceSkusComplete retrieves all of the results into a single object -func (c ApiManagementServiceSkusClient) ListAvailableServiceSkusComplete(ctx context.Context, id ServiceId) (ListAvailableServiceSkusCompleteResult, error) { - return c.ListAvailableServiceSkusCompleteMatchingPredicate(ctx, id, ResourceSkuResultOperationPredicate{}) -} - -// ListAvailableServiceSkusCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiManagementServiceSkusClient) ListAvailableServiceSkusCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate ResourceSkuResultOperationPredicate) (resp ListAvailableServiceSkusCompleteResult, err error) { - items := make([]ResourceSkuResult, 0) - - page, err := c.ListAvailableServiceSkus(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListAvailableServiceSkusCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/client.go b/resource-manager/apimanagement/2022-08-01/apioperation/client.go index f4e640e1356..68d147befcb 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperation/client.go +++ b/resource-manager/apimanagement/2022-08-01/apioperation/client.go @@ -1,18 +1,26 @@ package apioperation -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiOperationClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiOperationClientWithBaseURI(endpoint string) ApiOperationClient { - return ApiOperationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiOperationClientWithBaseURI(api sdkEnv.Api) (*ApiOperationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apioperation", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiOperationClient: %+v", err) } + + return &ApiOperationClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_createorupdate.go new file mode 100644 index 00000000000..6dc046e355f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperation/method_createorupdate.go @@ -0,0 +1,85 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OperationContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiOperationClient) CreateOrUpdate(ctx context.Context, id OperationId, input OperationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_createorupdate_autorest.go deleted file mode 100644 index 248feffbbb9..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperation/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apioperation - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *OperationContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiOperationClient) CreateOrUpdate(ctx context.Context, id OperationId, input OperationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiOperationClient) preparerForCreateOrUpdate(ctx context.Context, id OperationId, input OperationContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_delete.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_delete.go new file mode 100644 index 00000000000..0693a0a284f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperation/method_delete.go @@ -0,0 +1,76 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiOperationClient) Delete(ctx context.Context, id OperationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_delete_autorest.go deleted file mode 100644 index 6a968ca42c0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperation/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apioperation - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiOperationClient) Delete(ctx context.Context, id OperationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiOperationClient) preparerForDelete(ctx context.Context, id OperationId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_get.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_get.go new file mode 100644 index 00000000000..d5786d5ae91 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperation/method_get.go @@ -0,0 +1,51 @@ +package apioperation + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OperationContract +} + +// Get ... +func (c ApiOperationClient) Get(ctx context.Context, id OperationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_get_autorest.go deleted file mode 100644 index 71209f67ea1..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperation/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apioperation - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *OperationContract -} - -// Get ... -func (c ApiOperationClient) Get(ctx context.Context, id OperationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiOperationClient) preparerForGet(ctx context.Context, id OperationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_getentitytag.go new file mode 100644 index 00000000000..520a7b92e36 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperation/method_getentitytag.go @@ -0,0 +1,46 @@ +package apioperation + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiOperationClient) GetEntityTag(ctx context.Context, id OperationId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_getentitytag_autorest.go deleted file mode 100644 index fbf38551a9a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperation/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apioperation - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiOperationClient) GetEntityTag(ctx context.Context, id OperationId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiOperationClient) preparerForGetEntityTag(ctx context.Context, id OperationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_listbyapi.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_listbyapi.go new file mode 100644 index 00000000000..5620f8b7c3e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperation/method_listbyapi.go @@ -0,0 +1,129 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OperationContract +} + +type ListByApiCompleteResult struct { + Items []OperationContract +} + +type ListByApiOperationOptions struct { + Filter *string + Skip *int64 + Tags *string + Top *int64 +} + +func DefaultListByApiOperationOptions() ListByApiOperationOptions { + return ListByApiOperationOptions{} +} + +func (o ListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Tags != nil { + out.Append("tags", fmt.Sprintf("%v", *o.Tags)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByApi ... +func (c ApiOperationClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/operations", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]OperationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByApiComplete retrieves all the results into a single object +func (c ApiOperationClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { + return c.ListByApiCompleteMatchingPredicate(ctx, id, options, OperationContractOperationPredicate{}) +} + +// ListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiOperationClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate OperationContractOperationPredicate) (result ListByApiCompleteResult, err error) { + items := make([]OperationContract, 0) + + resp, err := c.ListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_listbyapi_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_listbyapi_autorest.go deleted file mode 100644 index 081748611d8..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperation/method_listbyapi_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package apioperation - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByApiOperationResponse struct { - HttpResponse *http.Response - Model *[]OperationContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByApiOperationResponse, error) -} - -type ListByApiCompleteResult struct { - Items []OperationContract -} - -func (r ListByApiOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByApiOperationResponse) LoadMore(ctx context.Context) (resp ListByApiOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByApiOperationOptions struct { - Filter *string - Skip *int64 - Tags *string - Top *int64 -} - -func DefaultListByApiOperationOptions() ListByApiOperationOptions { - return ListByApiOperationOptions{} -} - -func (o ListByApiOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByApiOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Tags != nil { - out["tags"] = *o.Tags - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByApi ... -func (c ApiOperationClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (resp ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApi(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByApi(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByApi prepares the ListByApi request. -func (c ApiOperationClient) preparerForListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/operations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByApiWithNextLink prepares the ListByApi request with the given nextLink token. -func (c ApiOperationClient) preparerForListByApiWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByApi handles the response to the ListByApi request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForListByApi(resp *http.Response) (result ListByApiOperationResponse, err error) { - type page struct { - Values []OperationContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApiWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "ListByApi", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByApiComplete retrieves all of the results into a single object -func (c ApiOperationClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { - return c.ListByApiCompleteMatchingPredicate(ctx, id, options, OperationContractOperationPredicate{}) -} - -// ListByApiCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiOperationClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate OperationContractOperationPredicate) (resp ListByApiCompleteResult, err error) { - items := make([]OperationContract, 0) - - page, err := c.ListByApi(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByApiCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_update.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_update.go new file mode 100644 index 00000000000..9b215cf692d --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperation/method_update.go @@ -0,0 +1,84 @@ +package apioperation + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OperationContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiOperationClient) Update(ctx context.Context, id OperationId, input OperationUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperation/method_update_autorest.go deleted file mode 100644 index 753e7e9c090..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperation/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apioperation - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *OperationContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiOperationClient) Update(ctx context.Context, id OperationId, input OperationUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperation.ApiOperationClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiOperationClient) preparerForUpdate(ctx context.Context, id OperationId, input OperationUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiOperationClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/client.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/client.go index 263cb368c90..ae379c3ce4b 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/client.go +++ b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/client.go @@ -1,18 +1,26 @@ package apioperationpolicy -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiOperationPolicyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiOperationPolicyClientWithBaseURI(endpoint string) ApiOperationPolicyClient { - return ApiOperationPolicyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiOperationPolicyClientWithBaseURI(api sdkEnv.Api) (*ApiOperationPolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apioperationpolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiOperationPolicyClient: %+v", err) } + + return &ApiOperationPolicyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/constants.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/constants.go index c8bec979994..5a4b902d0cf 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/constants.go +++ b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/constants.go @@ -1,6 +1,10 @@ package apioperationpolicy -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPolicyContentFormat() []string { } } +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { vals := map[string]PolicyContentFormat{ "rawxml": PolicyContentFormatRawxml, @@ -53,6 +70,19 @@ func PossibleValuesForPolicyExportFormat() []string { } } +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { vals := map[string]PolicyExportFormat{ "rawxml": PolicyExportFormatRawxml, diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_createorupdate.go new file mode 100644 index 00000000000..a25fdb2042e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_createorupdate.go @@ -0,0 +1,85 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiOperationPolicyClient) CreateOrUpdate(ctx context.Context, id OperationId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_createorupdate_autorest.go deleted file mode 100644 index ab93439da2b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package apioperationpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiOperationPolicyClient) CreateOrUpdate(ctx context.Context, id OperationId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiOperationPolicyClient) preparerForCreateOrUpdate(ctx context.Context, id OperationId, input PolicyContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiOperationPolicyClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_delete.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_delete.go new file mode 100644 index 00000000000..f30d7d3e932 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_delete.go @@ -0,0 +1,76 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiOperationPolicyClient) Delete(ctx context.Context, id OperationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_delete_autorest.go deleted file mode 100644 index cb4dd35c12f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_delete_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package apioperationpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiOperationPolicyClient) Delete(ctx context.Context, id OperationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiOperationPolicyClient) preparerForDelete(ctx context.Context, id OperationId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiOperationPolicyClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_get.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_get.go new file mode 100644 index 00000000000..62c2e626268 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_get.go @@ -0,0 +1,80 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c ApiOperationPolicyClient) Get(ctx context.Context, id OperationId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_get_autorest.go deleted file mode 100644 index 8016e93dbbe..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_get_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apioperationpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type GetOperationOptions struct { - Format *PolicyExportFormat -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - return out -} - -// Get ... -func (c ApiOperationPolicyClient) Get(ctx context.Context, id OperationId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiOperationPolicyClient) preparerForGet(ctx context.Context, id OperationId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiOperationPolicyClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_getentitytag.go new file mode 100644 index 00000000000..88da95a1537 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_getentitytag.go @@ -0,0 +1,47 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiOperationPolicyClient) GetEntityTag(ctx context.Context, id OperationId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_getentitytag_autorest.go deleted file mode 100644 index 694655ef4b7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package apioperationpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiOperationPolicyClient) GetEntityTag(ctx context.Context, id OperationId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiOperationPolicyClient) preparerForGetEntityTag(ctx context.Context, id OperationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiOperationPolicyClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_listbyoperation.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_listbyoperation.go new file mode 100644 index 00000000000..0f79c48d5fe --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_listbyoperation.go @@ -0,0 +1,52 @@ +package apioperationpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByOperation ... +func (c ApiOperationPolicyClient) ListByOperation(ctx context.Context, id OperationId) (result ListByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_listbyoperation_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_listbyoperation_autorest.go deleted file mode 100644 index 65975e5077b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/method_listbyoperation_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package apioperationpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByOperationOperationResponse struct { - HttpResponse *http.Response - Model *PolicyCollection -} - -// ListByOperation ... -func (c ApiOperationPolicyClient) ListByOperation(ctx context.Context, id OperationId) (result ListByOperationOperationResponse, err error) { - req, err := c.preparerForListByOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "ListByOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "ListByOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationpolicy.ApiOperationPolicyClient", "ListByOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByOperation prepares the ListByOperation request. -func (c ApiOperationPolicyClient) preparerForListByOperation(ctx context.Context, id OperationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByOperation handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationPolicyClient) responderForListByOperation(resp *http.Response) (result ListByOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationsbytag/client.go b/resource-manager/apimanagement/2022-08-01/apioperationsbytag/client.go index 48716e67800..77b4aa9b323 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperationsbytag/client.go +++ b/resource-manager/apimanagement/2022-08-01/apioperationsbytag/client.go @@ -1,18 +1,26 @@ package apioperationsbytag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiOperationsByTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiOperationsByTagClientWithBaseURI(endpoint string) ApiOperationsByTagClient { - return ApiOperationsByTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiOperationsByTagClientWithBaseURI(api sdkEnv.Api) (*ApiOperationsByTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apioperationsbytag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiOperationsByTagClient: %+v", err) } + + return &ApiOperationsByTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apioperationsbytag/constants.go b/resource-manager/apimanagement/2022-08-01/apioperationsbytag/constants.go index 7a4b9772ad9..c0f30b87134 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperationsbytag/constants.go +++ b/resource-manager/apimanagement/2022-08-01/apioperationsbytag/constants.go @@ -1,6 +1,10 @@ package apioperationsbytag -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -81,6 +111,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, @@ -113,6 +156,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, diff --git a/resource-manager/apimanagement/2022-08-01/apioperationsbytag/method_operationlistbytags.go b/resource-manager/apimanagement/2022-08-01/apioperationsbytag/method_operationlistbytags.go new file mode 100644 index 00000000000..2e348997053 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperationsbytag/method_operationlistbytags.go @@ -0,0 +1,129 @@ +package apioperationsbytag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationListByTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagResourceContract +} + +type OperationListByTagsCompleteResult struct { + Items []TagResourceContract +} + +type OperationListByTagsOperationOptions struct { + Filter *string + IncludeNotTaggedOperations *bool + Skip *int64 + Top *int64 +} + +func DefaultOperationListByTagsOperationOptions() OperationListByTagsOperationOptions { + return OperationListByTagsOperationOptions{} +} + +func (o OperationListByTagsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o OperationListByTagsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o OperationListByTagsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IncludeNotTaggedOperations != nil { + out.Append("includeNotTaggedOperations", fmt.Sprintf("%v", *o.IncludeNotTaggedOperations)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// OperationListByTags ... +func (c ApiOperationsByTagClient) OperationListByTags(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions) (result OperationListByTagsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/operationsByTags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagResourceContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// OperationListByTagsComplete retrieves all the results into a single object +func (c ApiOperationsByTagClient) OperationListByTagsComplete(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions) (OperationListByTagsCompleteResult, error) { + return c.OperationListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) +} + +// OperationListByTagsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiOperationsByTagClient) OperationListByTagsCompleteMatchingPredicate(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (result OperationListByTagsCompleteResult, err error) { + items := make([]TagResourceContract, 0) + + resp, err := c.OperationListByTags(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = OperationListByTagsCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationsbytag/method_operationlistbytags_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperationsbytag/method_operationlistbytags_autorest.go deleted file mode 100644 index 0c8ab093faf..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperationsbytag/method_operationlistbytags_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package apioperationsbytag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type OperationListByTagsOperationResponse struct { - HttpResponse *http.Response - Model *[]TagResourceContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (OperationListByTagsOperationResponse, error) -} - -type OperationListByTagsCompleteResult struct { - Items []TagResourceContract -} - -func (r OperationListByTagsOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r OperationListByTagsOperationResponse) LoadMore(ctx context.Context) (resp OperationListByTagsOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type OperationListByTagsOperationOptions struct { - Filter *string - IncludeNotTaggedOperations *bool - Skip *int64 - Top *int64 -} - -func DefaultOperationListByTagsOperationOptions() OperationListByTagsOperationOptions { - return OperationListByTagsOperationOptions{} -} - -func (o OperationListByTagsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o OperationListByTagsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.IncludeNotTaggedOperations != nil { - out["includeNotTaggedOperations"] = *o.IncludeNotTaggedOperations - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// OperationListByTags ... -func (c ApiOperationsByTagClient) OperationListByTags(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions) (resp OperationListByTagsOperationResponse, err error) { - req, err := c.preparerForOperationListByTags(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForOperationListByTags(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForOperationListByTags prepares the OperationListByTags request. -func (c ApiOperationsByTagClient) preparerForOperationListByTags(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/operationsByTags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForOperationListByTagsWithNextLink prepares the OperationListByTags request with the given nextLink token. -func (c ApiOperationsByTagClient) preparerForOperationListByTagsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForOperationListByTags handles the response to the OperationListByTags request. The method always -// closes the http.Response Body. -func (c ApiOperationsByTagClient) responderForOperationListByTags(resp *http.Response) (result OperationListByTagsOperationResponse, err error) { - type page struct { - Values []TagResourceContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result OperationListByTagsOperationResponse, err error) { - req, err := c.preparerForOperationListByTagsWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForOperationListByTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationsbytag.ApiOperationsByTagClient", "OperationListByTags", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// OperationListByTagsComplete retrieves all of the results into a single object -func (c ApiOperationsByTagClient) OperationListByTagsComplete(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions) (OperationListByTagsCompleteResult, error) { - return c.OperationListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) -} - -// OperationListByTagsCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiOperationsByTagClient) OperationListByTagsCompleteMatchingPredicate(ctx context.Context, id ApiId, options OperationListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (resp OperationListByTagsCompleteResult, err error) { - items := make([]TagResourceContract, 0) - - page, err := c.OperationListByTags(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := OperationListByTagsCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/client.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/client.go index 3bfc477ea28..bafff15be00 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperationtag/client.go +++ b/resource-manager/apimanagement/2022-08-01/apioperationtag/client.go @@ -1,18 +1,26 @@ package apioperationtag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiOperationTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiOperationTagClientWithBaseURI(endpoint string) ApiOperationTagClient { - return ApiOperationTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiOperationTagClientWithBaseURI(api sdkEnv.Api) (*ApiOperationTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apioperationtag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiOperationTagClient: %+v", err) } + + return &ApiOperationTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagassigntooperation.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagassigntooperation.go new file mode 100644 index 00000000000..2c431fe03fa --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagassigntooperation.go @@ -0,0 +1,52 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagAssignToOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagAssignToOperation ... +func (c ApiOperationTagClient) TagAssignToOperation(ctx context.Context, id OperationTagId) (result TagAssignToOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagassigntooperation_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagassigntooperation_autorest.go deleted file mode 100644 index 9d8aa0afd9a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagassigntooperation_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apioperationtag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagAssignToOperationOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagAssignToOperation ... -func (c ApiOperationTagClient) TagAssignToOperation(ctx context.Context, id OperationTagId) (result TagAssignToOperationOperationResponse, err error) { - req, err := c.preparerForTagAssignToOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagAssignToOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagAssignToOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagAssignToOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagAssignToOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagAssignToOperation prepares the TagAssignToOperation request. -func (c ApiOperationTagClient) preparerForTagAssignToOperation(ctx context.Context, id OperationTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagAssignToOperation handles the response to the TagAssignToOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationTagClient) responderForTagAssignToOperation(resp *http.Response) (result TagAssignToOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagdetachfromoperation.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagdetachfromoperation.go new file mode 100644 index 00000000000..b49f13cabd9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagdetachfromoperation.go @@ -0,0 +1,47 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDetachFromOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagDetachFromOperation ... +func (c ApiOperationTagClient) TagDetachFromOperation(ctx context.Context, id OperationTagId) (result TagDetachFromOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagdetachfromoperation_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagdetachfromoperation_autorest.go deleted file mode 100644 index b7845a36364..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_tagdetachfromoperation_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apioperationtag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagDetachFromOperationOperationResponse struct { - HttpResponse *http.Response -} - -// TagDetachFromOperation ... -func (c ApiOperationTagClient) TagDetachFromOperation(ctx context.Context, id OperationTagId) (result TagDetachFromOperationOperationResponse, err error) { - req, err := c.preparerForTagDetachFromOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagDetachFromOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagDetachFromOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagDetachFromOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagDetachFromOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagDetachFromOperation prepares the TagDetachFromOperation request. -func (c ApiOperationTagClient) preparerForTagDetachFromOperation(ctx context.Context, id OperationTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagDetachFromOperation handles the response to the TagDetachFromOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationTagClient) responderForTagDetachFromOperation(resp *http.Response) (result TagDetachFromOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetbyoperation.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetbyoperation.go new file mode 100644 index 00000000000..a56dc05b28f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetbyoperation.go @@ -0,0 +1,51 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagGetByOperation ... +func (c ApiOperationTagClient) TagGetByOperation(ctx context.Context, id OperationTagId) (result TagGetByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetbyoperation_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetbyoperation_autorest.go deleted file mode 100644 index 8e6507984f5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetbyoperation_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apioperationtag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetByOperationOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagGetByOperation ... -func (c ApiOperationTagClient) TagGetByOperation(ctx context.Context, id OperationTagId) (result TagGetByOperationOperationResponse, err error) { - req, err := c.preparerForTagGetByOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetByOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetByOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetByOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetByOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetByOperation prepares the TagGetByOperation request. -func (c ApiOperationTagClient) preparerForTagGetByOperation(ctx context.Context, id OperationTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetByOperation handles the response to the TagGetByOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationTagClient) responderForTagGetByOperation(resp *http.Response) (result TagGetByOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetentitystatebyoperation.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetentitystatebyoperation.go new file mode 100644 index 00000000000..066af82b190 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetentitystatebyoperation.go @@ -0,0 +1,46 @@ +package apioperationtag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetEntityStateByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagGetEntityStateByOperation ... +func (c ApiOperationTagClient) TagGetEntityStateByOperation(ctx context.Context, id OperationTagId) (result TagGetEntityStateByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetentitystatebyoperation_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetentitystatebyoperation_autorest.go deleted file mode 100644 index beaef9dc15a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taggetentitystatebyoperation_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apioperationtag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetEntityStateByOperationOperationResponse struct { - HttpResponse *http.Response -} - -// TagGetEntityStateByOperation ... -func (c ApiOperationTagClient) TagGetEntityStateByOperation(ctx context.Context, id OperationTagId) (result TagGetEntityStateByOperationOperationResponse, err error) { - req, err := c.preparerForTagGetEntityStateByOperation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetEntityStateByOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetEntityStateByOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetEntityStateByOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagGetEntityStateByOperation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetEntityStateByOperation prepares the TagGetEntityStateByOperation request. -func (c ApiOperationTagClient) preparerForTagGetEntityStateByOperation(ctx context.Context, id OperationTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetEntityStateByOperation handles the response to the TagGetEntityStateByOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationTagClient) responderForTagGetEntityStateByOperation(resp *http.Response) (result TagGetEntityStateByOperationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taglistbyoperation.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taglistbyoperation.go new file mode 100644 index 00000000000..b857e4ac190 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taglistbyoperation.go @@ -0,0 +1,125 @@ +package apioperationtag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagListByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type TagListByOperationCompleteResult struct { + Items []TagContract +} + +type TagListByOperationOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultTagListByOperationOperationOptions() TagListByOperationOperationOptions { + return TagListByOperationOperationOptions{} +} + +func (o TagListByOperationOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o TagListByOperationOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o TagListByOperationOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// TagListByOperation ... +func (c ApiOperationTagClient) TagListByOperation(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (result TagListByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// TagListByOperationComplete retrieves all the results into a single object +func (c ApiOperationTagClient) TagListByOperationComplete(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (TagListByOperationCompleteResult, error) { + return c.TagListByOperationCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// TagListByOperationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiOperationTagClient) TagListByOperationCompleteMatchingPredicate(ctx context.Context, id OperationId, options TagListByOperationOperationOptions, predicate TagContractOperationPredicate) (result TagListByOperationCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.TagListByOperation(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = TagListByOperationCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taglistbyoperation_autorest.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taglistbyoperation_autorest.go deleted file mode 100644 index 5bc7a969362..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apioperationtag/method_taglistbyoperation_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apioperationtag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagListByOperationOperationResponse struct { - HttpResponse *http.Response - Model *[]TagContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (TagListByOperationOperationResponse, error) -} - -type TagListByOperationCompleteResult struct { - Items []TagContract -} - -func (r TagListByOperationOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r TagListByOperationOperationResponse) LoadMore(ctx context.Context) (resp TagListByOperationOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type TagListByOperationOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultTagListByOperationOperationOptions() TagListByOperationOperationOptions { - return TagListByOperationOperationOptions{} -} - -func (o TagListByOperationOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o TagListByOperationOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// TagListByOperation ... -func (c ApiOperationTagClient) TagListByOperation(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (resp TagListByOperationOperationResponse, err error) { - req, err := c.preparerForTagListByOperation(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForTagListByOperation(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForTagListByOperation prepares the TagListByOperation request. -func (c ApiOperationTagClient) preparerForTagListByOperation(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForTagListByOperationWithNextLink prepares the TagListByOperation request with the given nextLink token. -func (c ApiOperationTagClient) preparerForTagListByOperationWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagListByOperation handles the response to the TagListByOperation request. The method always -// closes the http.Response Body. -func (c ApiOperationTagClient) responderForTagListByOperation(resp *http.Response) (result TagListByOperationOperationResponse, err error) { - type page struct { - Values []TagContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result TagListByOperationOperationResponse, err error) { - req, err := c.preparerForTagListByOperationWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagListByOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apioperationtag.ApiOperationTagClient", "TagListByOperation", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// TagListByOperationComplete retrieves all of the results into a single object -func (c ApiOperationTagClient) TagListByOperationComplete(ctx context.Context, id OperationId, options TagListByOperationOperationOptions) (TagListByOperationCompleteResult, error) { - return c.TagListByOperationCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) -} - -// TagListByOperationCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiOperationTagClient) TagListByOperationCompleteMatchingPredicate(ctx context.Context, id OperationId, options TagListByOperationOperationOptions, predicate TagContractOperationPredicate) (resp TagListByOperationCompleteResult, err error) { - items := make([]TagContract, 0) - - page, err := c.TagListByOperation(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := TagListByOperationCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/client.go b/resource-manager/apimanagement/2022-08-01/apipolicy/client.go index 849c529fef4..0c9d45a5bac 100644 --- a/resource-manager/apimanagement/2022-08-01/apipolicy/client.go +++ b/resource-manager/apimanagement/2022-08-01/apipolicy/client.go @@ -1,18 +1,26 @@ package apipolicy -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiPolicyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiPolicyClientWithBaseURI(endpoint string) ApiPolicyClient { - return ApiPolicyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiPolicyClientWithBaseURI(api sdkEnv.Api) (*ApiPolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apipolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiPolicyClient: %+v", err) } + + return &ApiPolicyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/constants.go b/resource-manager/apimanagement/2022-08-01/apipolicy/constants.go index 0622a9d8ec5..3a402942dd8 100644 --- a/resource-manager/apimanagement/2022-08-01/apipolicy/constants.go +++ b/resource-manager/apimanagement/2022-08-01/apipolicy/constants.go @@ -1,6 +1,10 @@ package apipolicy -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPolicyContentFormat() []string { } } +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { vals := map[string]PolicyContentFormat{ "rawxml": PolicyContentFormatRawxml, @@ -53,6 +70,19 @@ func PossibleValuesForPolicyExportFormat() []string { } } +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { vals := map[string]PolicyExportFormat{ "rawxml": PolicyExportFormatRawxml, diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apipolicy/method_createorupdate.go new file mode 100644 index 00000000000..34932d9e40b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apipolicy/method_createorupdate.go @@ -0,0 +1,85 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiPolicyClient) CreateOrUpdate(ctx context.Context, id ApiId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apipolicy/method_createorupdate_autorest.go deleted file mode 100644 index 1d3e07d089c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apipolicy/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package apipolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiPolicyClient) CreateOrUpdate(ctx context.Context, id ApiId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiPolicyClient) preparerForCreateOrUpdate(ctx context.Context, id ApiId, input PolicyContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiPolicyClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/method_delete.go b/resource-manager/apimanagement/2022-08-01/apipolicy/method_delete.go new file mode 100644 index 00000000000..10b8c3c63c0 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apipolicy/method_delete.go @@ -0,0 +1,76 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiPolicyClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apipolicy/method_delete_autorest.go deleted file mode 100644 index 010fbd8de58..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apipolicy/method_delete_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package apipolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiPolicyClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiPolicyClient) preparerForDelete(ctx context.Context, id ApiId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiPolicyClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/method_get.go b/resource-manager/apimanagement/2022-08-01/apipolicy/method_get.go new file mode 100644 index 00000000000..aaa7b1d2c78 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apipolicy/method_get.go @@ -0,0 +1,80 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c ApiPolicyClient) Get(ctx context.Context, id ApiId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apipolicy/method_get_autorest.go deleted file mode 100644 index 4003515afa2..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apipolicy/method_get_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apipolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type GetOperationOptions struct { - Format *PolicyExportFormat -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - return out -} - -// Get ... -func (c ApiPolicyClient) Get(ctx context.Context, id ApiId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiPolicyClient) preparerForGet(ctx context.Context, id ApiId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiPolicyClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apipolicy/method_getentitytag.go new file mode 100644 index 00000000000..5ab255150b8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apipolicy/method_getentitytag.go @@ -0,0 +1,47 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiPolicyClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apipolicy/method_getentitytag_autorest.go deleted file mode 100644 index 522426b034b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apipolicy/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package apipolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiPolicyClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiPolicyClient) preparerForGetEntityTag(ctx context.Context, id ApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiPolicyClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/method_listbyapi.go b/resource-manager/apimanagement/2022-08-01/apipolicy/method_listbyapi.go new file mode 100644 index 00000000000..5afb8149c87 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apipolicy/method_listbyapi.go @@ -0,0 +1,52 @@ +package apipolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByApi ... +func (c ApiPolicyClient) ListByApi(ctx context.Context, id ApiId) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/method_listbyapi_autorest.go b/resource-manager/apimanagement/2022-08-01/apipolicy/method_listbyapi_autorest.go deleted file mode 100644 index 3c5cfc6d95f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apipolicy/method_listbyapi_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package apipolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByApiOperationResponse struct { - HttpResponse *http.Response - Model *PolicyCollection -} - -// ListByApi ... -func (c ApiPolicyClient) ListByApi(ctx context.Context, id ApiId) (result ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApi(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "ListByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "ListByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apipolicy.ApiPolicyClient", "ListByApi", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByApi prepares the ListByApi request. -func (c ApiPolicyClient) preparerForListByApi(ctx context.Context, id ApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByApi handles the response to the ListByApi request. The method always -// closes the http.Response Body. -func (c ApiPolicyClient) responderForListByApi(resp *http.Response) (result ListByApiOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiproduct/client.go b/resource-manager/apimanagement/2022-08-01/apiproduct/client.go index 4c35dacbaa3..d310375dc14 100644 --- a/resource-manager/apimanagement/2022-08-01/apiproduct/client.go +++ b/resource-manager/apimanagement/2022-08-01/apiproduct/client.go @@ -1,18 +1,26 @@ package apiproduct -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiProductClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiProductClientWithBaseURI(endpoint string) ApiProductClient { - return ApiProductClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiProductClientWithBaseURI(api sdkEnv.Api) (*ApiProductClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiproduct", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiProductClient: %+v", err) } + + return &ApiProductClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apiproduct/constants.go b/resource-manager/apimanagement/2022-08-01/apiproduct/constants.go index f0fb051f3c2..12fdc8dd3d6 100644 --- a/resource-manager/apimanagement/2022-08-01/apiproduct/constants.go +++ b/resource-manager/apimanagement/2022-08-01/apiproduct/constants.go @@ -1,6 +1,10 @@ package apiproduct -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, diff --git a/resource-manager/apimanagement/2022-08-01/apiproduct/method_listbyapis.go b/resource-manager/apimanagement/2022-08-01/apiproduct/method_listbyapis.go new file mode 100644 index 00000000000..2acd3899dfb --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiproduct/method_listbyapis.go @@ -0,0 +1,125 @@ +package apiproduct + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApisOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ProductContract +} + +type ListByApisCompleteResult struct { + Items []ProductContract +} + +type ListByApisOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByApisOperationOptions() ListByApisOperationOptions { + return ListByApisOperationOptions{} +} + +func (o ListByApisOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByApisOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByApisOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByApis ... +func (c ApiProductClient) ListByApis(ctx context.Context, id ApiId, options ListByApisOperationOptions) (result ListByApisOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/products", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ProductContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByApisComplete retrieves all the results into a single object +func (c ApiProductClient) ListByApisComplete(ctx context.Context, id ApiId, options ListByApisOperationOptions) (ListByApisCompleteResult, error) { + return c.ListByApisCompleteMatchingPredicate(ctx, id, options, ProductContractOperationPredicate{}) +} + +// ListByApisCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiProductClient) ListByApisCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApisOperationOptions, predicate ProductContractOperationPredicate) (result ListByApisCompleteResult, err error) { + items := make([]ProductContract, 0) + + resp, err := c.ListByApis(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByApisCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiproduct/method_listbyapis_autorest.go b/resource-manager/apimanagement/2022-08-01/apiproduct/method_listbyapis_autorest.go deleted file mode 100644 index 3ef1fe2b276..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiproduct/method_listbyapis_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apiproduct - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByApisOperationResponse struct { - HttpResponse *http.Response - Model *[]ProductContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByApisOperationResponse, error) -} - -type ListByApisCompleteResult struct { - Items []ProductContract -} - -func (r ListByApisOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByApisOperationResponse) LoadMore(ctx context.Context) (resp ListByApisOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByApisOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByApisOperationOptions() ListByApisOperationOptions { - return ListByApisOperationOptions{} -} - -func (o ListByApisOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByApisOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByApis ... -func (c ApiProductClient) ListByApis(ctx context.Context, id ApiId, options ListByApisOperationOptions) (resp ListByApisOperationResponse, err error) { - req, err := c.preparerForListByApis(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByApis(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByApis prepares the ListByApis request. -func (c ApiProductClient) preparerForListByApis(ctx context.Context, id ApiId, options ListByApisOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/products", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByApisWithNextLink prepares the ListByApis request with the given nextLink token. -func (c ApiProductClient) preparerForListByApisWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByApis handles the response to the ListByApis request. The method always -// closes the http.Response Body. -func (c ApiProductClient) responderForListByApis(resp *http.Response) (result ListByApisOperationResponse, err error) { - type page struct { - Values []ProductContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByApisOperationResponse, err error) { - req, err := c.preparerForListByApisWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByApis(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiproduct.ApiProductClient", "ListByApis", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByApisComplete retrieves all of the results into a single object -func (c ApiProductClient) ListByApisComplete(ctx context.Context, id ApiId, options ListByApisOperationOptions) (ListByApisCompleteResult, error) { - return c.ListByApisCompleteMatchingPredicate(ctx, id, options, ProductContractOperationPredicate{}) -} - -// ListByApisCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiProductClient) ListByApisCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApisOperationOptions, predicate ProductContractOperationPredicate) (resp ListByApisCompleteResult, err error) { - items := make([]ProductContract, 0) - - page, err := c.ListByApis(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByApisCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/client.go b/resource-manager/apimanagement/2022-08-01/apirelease/client.go index 7daeaa5351d..0668c7977a7 100644 --- a/resource-manager/apimanagement/2022-08-01/apirelease/client.go +++ b/resource-manager/apimanagement/2022-08-01/apirelease/client.go @@ -1,18 +1,26 @@ package apirelease -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiReleaseClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiReleaseClientWithBaseURI(endpoint string) ApiReleaseClient { - return ApiReleaseClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiReleaseClientWithBaseURI(api sdkEnv.Api) (*ApiReleaseClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apirelease", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiReleaseClient: %+v", err) } + + return &ApiReleaseClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_createorupdate.go new file mode 100644 index 00000000000..406976fb2f8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apirelease/method_createorupdate.go @@ -0,0 +1,85 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiReleaseContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiReleaseClient) CreateOrUpdate(ctx context.Context, id ReleaseId, input ApiReleaseContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_createorupdate_autorest.go deleted file mode 100644 index a9bb0d861fe..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apirelease/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apirelease - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiReleaseContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiReleaseClient) CreateOrUpdate(ctx context.Context, id ReleaseId, input ApiReleaseContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiReleaseClient) preparerForCreateOrUpdate(ctx context.Context, id ReleaseId, input ApiReleaseContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_delete.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_delete.go new file mode 100644 index 00000000000..cdfaf120b2b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apirelease/method_delete.go @@ -0,0 +1,76 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiReleaseClient) Delete(ctx context.Context, id ReleaseId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_delete_autorest.go deleted file mode 100644 index d5290cd9c81..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apirelease/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apirelease - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiReleaseClient) Delete(ctx context.Context, id ReleaseId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiReleaseClient) preparerForDelete(ctx context.Context, id ReleaseId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_get.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_get.go new file mode 100644 index 00000000000..afe7107ae45 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apirelease/method_get.go @@ -0,0 +1,51 @@ +package apirelease + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiReleaseContract +} + +// Get ... +func (c ApiReleaseClient) Get(ctx context.Context, id ReleaseId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_get_autorest.go deleted file mode 100644 index 6b5b8bbd11a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apirelease/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apirelease - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ApiReleaseContract -} - -// Get ... -func (c ApiReleaseClient) Get(ctx context.Context, id ReleaseId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiReleaseClient) preparerForGet(ctx context.Context, id ReleaseId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_getentitytag.go new file mode 100644 index 00000000000..97a2ff54ef1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apirelease/method_getentitytag.go @@ -0,0 +1,46 @@ +package apirelease + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiReleaseClient) GetEntityTag(ctx context.Context, id ReleaseId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_getentitytag_autorest.go deleted file mode 100644 index 67f795accdb..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apirelease/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apirelease - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiReleaseClient) GetEntityTag(ctx context.Context, id ReleaseId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiReleaseClient) preparerForGetEntityTag(ctx context.Context, id ReleaseId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_listbyservice.go new file mode 100644 index 00000000000..ffb1a5e65b4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apirelease/method_listbyservice.go @@ -0,0 +1,125 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiReleaseContract +} + +type ListByServiceCompleteResult struct { + Items []ApiReleaseContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiReleaseClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/releases", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiReleaseContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiReleaseClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiReleaseContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiReleaseClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate ApiReleaseContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiReleaseContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_listbyservice_autorest.go deleted file mode 100644 index a503853e31a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apirelease/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apirelease - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiReleaseContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ApiReleaseContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiReleaseClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiReleaseClient) preparerForListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/releases", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiReleaseClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ApiReleaseContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiReleaseClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiReleaseContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiReleaseClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate ApiReleaseContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ApiReleaseContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_update.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_update.go new file mode 100644 index 00000000000..23af82628f6 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apirelease/method_update.go @@ -0,0 +1,84 @@ +package apirelease + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiReleaseContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiReleaseClient) Update(ctx context.Context, id ReleaseId, input ApiReleaseContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/apirelease/method_update_autorest.go deleted file mode 100644 index b94e10e254e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apirelease/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apirelease - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiReleaseContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiReleaseClient) Update(ctx context.Context, id ReleaseId, input ApiReleaseContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirelease.ApiReleaseClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiReleaseClient) preparerForUpdate(ctx context.Context, id ReleaseId, input ApiReleaseContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiReleaseClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apirevision/client.go b/resource-manager/apimanagement/2022-08-01/apirevision/client.go index 4f27298efa9..05dd34cbd51 100644 --- a/resource-manager/apimanagement/2022-08-01/apirevision/client.go +++ b/resource-manager/apimanagement/2022-08-01/apirevision/client.go @@ -1,18 +1,26 @@ package apirevision -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiRevisionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiRevisionClientWithBaseURI(endpoint string) ApiRevisionClient { - return ApiRevisionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiRevisionClientWithBaseURI(api sdkEnv.Api) (*ApiRevisionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apirevision", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiRevisionClient: %+v", err) } + + return &ApiRevisionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apirevision/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/apirevision/method_listbyservice.go new file mode 100644 index 00000000000..ddc821890de --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apirevision/method_listbyservice.go @@ -0,0 +1,125 @@ +package apirevision + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiRevisionContract +} + +type ListByServiceCompleteResult struct { + Items []ApiRevisionContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiRevisionClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/revisions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiRevisionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiRevisionClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiRevisionContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiRevisionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate ApiRevisionContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiRevisionContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apirevision/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/apirevision/method_listbyservice_autorest.go deleted file mode 100644 index 02f5fa345c9..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apirevision/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apirevision - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiRevisionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ApiRevisionContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiRevisionClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiRevisionClient) preparerForListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/revisions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiRevisionClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiRevisionClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ApiRevisionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apirevision.ApiRevisionClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiRevisionClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiRevisionContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiRevisionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate ApiRevisionContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ApiRevisionContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apisbytag/client.go b/resource-manager/apimanagement/2022-08-01/apisbytag/client.go index 300fac77149..2d2e8ef8c92 100644 --- a/resource-manager/apimanagement/2022-08-01/apisbytag/client.go +++ b/resource-manager/apimanagement/2022-08-01/apisbytag/client.go @@ -1,18 +1,26 @@ package apisbytag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApisByTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApisByTagClientWithBaseURI(endpoint string) ApisByTagClient { - return ApisByTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApisByTagClientWithBaseURI(api sdkEnv.Api) (*ApisByTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apisbytag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApisByTagClient: %+v", err) } + + return &ApisByTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apisbytag/constants.go b/resource-manager/apimanagement/2022-08-01/apisbytag/constants.go index 6f6b4ccc0c1..66e070901d4 100644 --- a/resource-manager/apimanagement/2022-08-01/apisbytag/constants.go +++ b/resource-manager/apimanagement/2022-08-01/apisbytag/constants.go @@ -1,6 +1,10 @@ package apisbytag -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -81,6 +111,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, @@ -113,6 +156,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, diff --git a/resource-manager/apimanagement/2022-08-01/apisbytag/method_apilistbytags.go b/resource-manager/apimanagement/2022-08-01/apisbytag/method_apilistbytags.go new file mode 100644 index 00000000000..80debd8f476 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apisbytag/method_apilistbytags.go @@ -0,0 +1,129 @@ +package apisbytag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiListByTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagResourceContract +} + +type ApiListByTagsCompleteResult struct { + Items []TagResourceContract +} + +type ApiListByTagsOperationOptions struct { + Filter *string + IncludeNotTaggedApis *bool + Skip *int64 + Top *int64 +} + +func DefaultApiListByTagsOperationOptions() ApiListByTagsOperationOptions { + return ApiListByTagsOperationOptions{} +} + +func (o ApiListByTagsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ApiListByTagsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ApiListByTagsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IncludeNotTaggedApis != nil { + out.Append("includeNotTaggedApis", fmt.Sprintf("%v", *o.IncludeNotTaggedApis)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ApiListByTags ... +func (c ApisByTagClient) ApiListByTags(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions) (result ApiListByTagsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apisByTags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagResourceContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ApiListByTagsComplete retrieves all the results into a single object +func (c ApisByTagClient) ApiListByTagsComplete(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions) (ApiListByTagsCompleteResult, error) { + return c.ApiListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) +} + +// ApiListByTagsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApisByTagClient) ApiListByTagsCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (result ApiListByTagsCompleteResult, err error) { + items := make([]TagResourceContract, 0) + + resp, err := c.ApiListByTags(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ApiListByTagsCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apisbytag/method_apilistbytags_autorest.go b/resource-manager/apimanagement/2022-08-01/apisbytag/method_apilistbytags_autorest.go deleted file mode 100644 index 5cb4c9a2e49..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apisbytag/method_apilistbytags_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package apisbytag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ApiListByTagsOperationResponse struct { - HttpResponse *http.Response - Model *[]TagResourceContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ApiListByTagsOperationResponse, error) -} - -type ApiListByTagsCompleteResult struct { - Items []TagResourceContract -} - -func (r ApiListByTagsOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ApiListByTagsOperationResponse) LoadMore(ctx context.Context) (resp ApiListByTagsOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ApiListByTagsOperationOptions struct { - Filter *string - IncludeNotTaggedApis *bool - Skip *int64 - Top *int64 -} - -func DefaultApiListByTagsOperationOptions() ApiListByTagsOperationOptions { - return ApiListByTagsOperationOptions{} -} - -func (o ApiListByTagsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ApiListByTagsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.IncludeNotTaggedApis != nil { - out["includeNotTaggedApis"] = *o.IncludeNotTaggedApis - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ApiListByTags ... -func (c ApisByTagClient) ApiListByTags(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions) (resp ApiListByTagsOperationResponse, err error) { - req, err := c.preparerForApiListByTags(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForApiListByTags(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForApiListByTags prepares the ApiListByTags request. -func (c ApisByTagClient) preparerForApiListByTags(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/apisByTags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForApiListByTagsWithNextLink prepares the ApiListByTags request with the given nextLink token. -func (c ApisByTagClient) preparerForApiListByTagsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForApiListByTags handles the response to the ApiListByTags request. The method always -// closes the http.Response Body. -func (c ApisByTagClient) responderForApiListByTags(resp *http.Response) (result ApiListByTagsOperationResponse, err error) { - type page struct { - Values []TagResourceContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ApiListByTagsOperationResponse, err error) { - req, err := c.preparerForApiListByTagsWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForApiListByTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apisbytag.ApisByTagClient", "ApiListByTags", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ApiListByTagsComplete retrieves all of the results into a single object -func (c ApisByTagClient) ApiListByTagsComplete(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions) (ApiListByTagsCompleteResult, error) { - return c.ApiListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) -} - -// ApiListByTagsCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApisByTagClient) ApiListByTagsCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ApiListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (resp ApiListByTagsCompleteResult, err error) { - items := make([]TagResourceContract, 0) - - page, err := c.ApiListByTags(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ApiListByTagsCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apischema/client.go b/resource-manager/apimanagement/2022-08-01/apischema/client.go index 1b7ddf09061..52fd9830109 100644 --- a/resource-manager/apimanagement/2022-08-01/apischema/client.go +++ b/resource-manager/apimanagement/2022-08-01/apischema/client.go @@ -1,18 +1,26 @@ package apischema -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiSchemaClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiSchemaClientWithBaseURI(endpoint string) ApiSchemaClient { - return ApiSchemaClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiSchemaClientWithBaseURI(api sdkEnv.Api) (*ApiSchemaClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apischema", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiSchemaClient: %+v", err) } + + return &ApiSchemaClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apischema/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apischema/method_createorupdate.go new file mode 100644 index 00000000000..ee50a77ff43 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apischema/method_createorupdate.go @@ -0,0 +1,103 @@ +package apischema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiSchemaClient) CreateOrUpdate(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ApiSchemaClient) CreateOrUpdateThenPoll(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/apischema/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apischema/method_createorupdate_autorest.go deleted file mode 100644 index b66a431a79b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apischema/method_createorupdate_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package apischema - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiSchemaClient) CreateOrUpdate(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ApiSchemaClient) CreateOrUpdateThenPoll(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiSchemaClient) preparerForCreateOrUpdate(ctx context.Context, id ApiSchemaId, input SchemaContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c ApiSchemaClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apischema/method_delete.go b/resource-manager/apimanagement/2022-08-01/apischema/method_delete.go new file mode 100644 index 00000000000..6fab6914573 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apischema/method_delete.go @@ -0,0 +1,79 @@ +package apischema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + Force *bool + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c ApiSchemaClient) Delete(ctx context.Context, id ApiSchemaId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apischema/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apischema/method_delete_autorest.go deleted file mode 100644 index 861123ba5f1..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apischema/method_delete_autorest.go +++ /dev/null @@ -1,100 +0,0 @@ -package apischema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - Force *bool - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Force != nil { - out["force"] = *o.Force - } - - return out -} - -// Delete ... -func (c ApiSchemaClient) Delete(ctx context.Context, id ApiSchemaId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiSchemaClient) preparerForDelete(ctx context.Context, id ApiSchemaId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiSchemaClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apischema/method_get.go b/resource-manager/apimanagement/2022-08-01/apischema/method_get.go new file mode 100644 index 00000000000..544b5401b16 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apischema/method_get.go @@ -0,0 +1,51 @@ +package apischema + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SchemaContract +} + +// Get ... +func (c ApiSchemaClient) Get(ctx context.Context, id ApiSchemaId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apischema/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apischema/method_get_autorest.go deleted file mode 100644 index a2f6ed627d0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apischema/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apischema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *SchemaContract -} - -// Get ... -func (c ApiSchemaClient) Get(ctx context.Context, id ApiSchemaId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiSchemaClient) preparerForGet(ctx context.Context, id ApiSchemaId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiSchemaClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apischema/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apischema/method_getentitytag.go new file mode 100644 index 00000000000..06aa5ede3ba --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apischema/method_getentitytag.go @@ -0,0 +1,46 @@ +package apischema + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiSchemaClient) GetEntityTag(ctx context.Context, id ApiSchemaId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apischema/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apischema/method_getentitytag_autorest.go deleted file mode 100644 index fc901aa3419..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apischema/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apischema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiSchemaClient) GetEntityTag(ctx context.Context, id ApiSchemaId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiSchemaClient) preparerForGetEntityTag(ctx context.Context, id ApiSchemaId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiSchemaClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apischema/method_listbyapi.go b/resource-manager/apimanagement/2022-08-01/apischema/method_listbyapi.go new file mode 100644 index 00000000000..8486736bbe2 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apischema/method_listbyapi.go @@ -0,0 +1,125 @@ +package apischema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SchemaContract +} + +type ListByApiCompleteResult struct { + Items []SchemaContract +} + +type ListByApiOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByApiOperationOptions() ListByApiOperationOptions { + return ListByApiOperationOptions{} +} + +func (o ListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByApi ... +func (c ApiSchemaClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/schemas", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SchemaContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByApiComplete retrieves all the results into a single object +func (c ApiSchemaClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { + return c.ListByApiCompleteMatchingPredicate(ctx, id, options, SchemaContractOperationPredicate{}) +} + +// ListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiSchemaClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate SchemaContractOperationPredicate) (result ListByApiCompleteResult, err error) { + items := make([]SchemaContract, 0) + + resp, err := c.ListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apischema/method_listbyapi_autorest.go b/resource-manager/apimanagement/2022-08-01/apischema/method_listbyapi_autorest.go deleted file mode 100644 index c29a0ea33a5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apischema/method_listbyapi_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apischema - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByApiOperationResponse struct { - HttpResponse *http.Response - Model *[]SchemaContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByApiOperationResponse, error) -} - -type ListByApiCompleteResult struct { - Items []SchemaContract -} - -func (r ListByApiOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByApiOperationResponse) LoadMore(ctx context.Context) (resp ListByApiOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByApiOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByApiOperationOptions() ListByApiOperationOptions { - return ListByApiOperationOptions{} -} - -func (o ListByApiOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByApiOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByApi ... -func (c ApiSchemaClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (resp ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApi(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByApi(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByApi prepares the ListByApi request. -func (c ApiSchemaClient) preparerForListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/schemas", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByApiWithNextLink prepares the ListByApi request with the given nextLink token. -func (c ApiSchemaClient) preparerForListByApiWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByApi handles the response to the ListByApi request. The method always -// closes the http.Response Body. -func (c ApiSchemaClient) responderForListByApi(resp *http.Response) (result ListByApiOperationResponse, err error) { - type page struct { - Values []SchemaContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApiWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apischema.ApiSchemaClient", "ListByApi", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByApiComplete retrieves all of the results into a single object -func (c ApiSchemaClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { - return c.ListByApiCompleteMatchingPredicate(ctx, id, options, SchemaContractOperationPredicate{}) -} - -// ListByApiCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiSchemaClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate SchemaContractOperationPredicate) (resp ListByApiCompleteResult, err error) { - items := make([]SchemaContract, 0) - - page, err := c.ListByApi(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByApiCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apitag/client.go b/resource-manager/apimanagement/2022-08-01/apitag/client.go index 6224a081278..1eeb741c8a0 100644 --- a/resource-manager/apimanagement/2022-08-01/apitag/client.go +++ b/resource-manager/apimanagement/2022-08-01/apitag/client.go @@ -1,18 +1,26 @@ package apitag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiTagClientWithBaseURI(endpoint string) ApiTagClient { - return ApiTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiTagClientWithBaseURI(api sdkEnv.Api) (*ApiTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apitag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiTagClient: %+v", err) } + + return &ApiTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apitag/method_tagassigntoapi.go b/resource-manager/apimanagement/2022-08-01/apitag/method_tagassigntoapi.go new file mode 100644 index 00000000000..96c964a74bd --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apitag/method_tagassigntoapi.go @@ -0,0 +1,52 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagAssignToApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagAssignToApi ... +func (c ApiTagClient) TagAssignToApi(ctx context.Context, id ApiTagId) (result TagAssignToApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apitag/method_tagassigntoapi_autorest.go b/resource-manager/apimanagement/2022-08-01/apitag/method_tagassigntoapi_autorest.go deleted file mode 100644 index e08a016a227..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apitag/method_tagassigntoapi_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apitag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagAssignToApiOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagAssignToApi ... -func (c ApiTagClient) TagAssignToApi(ctx context.Context, id ApiTagId) (result TagAssignToApiOperationResponse, err error) { - req, err := c.preparerForTagAssignToApi(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagAssignToApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagAssignToApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagAssignToApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagAssignToApi", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagAssignToApi prepares the TagAssignToApi request. -func (c ApiTagClient) preparerForTagAssignToApi(ctx context.Context, id ApiTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagAssignToApi handles the response to the TagAssignToApi request. The method always -// closes the http.Response Body. -func (c ApiTagClient) responderForTagAssignToApi(resp *http.Response) (result TagAssignToApiOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apitag/method_tagdetachfromapi.go b/resource-manager/apimanagement/2022-08-01/apitag/method_tagdetachfromapi.go new file mode 100644 index 00000000000..ad546cf7c3c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apitag/method_tagdetachfromapi.go @@ -0,0 +1,47 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDetachFromApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagDetachFromApi ... +func (c ApiTagClient) TagDetachFromApi(ctx context.Context, id ApiTagId) (result TagDetachFromApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apitag/method_tagdetachfromapi_autorest.go b/resource-manager/apimanagement/2022-08-01/apitag/method_tagdetachfromapi_autorest.go deleted file mode 100644 index e7ecb70287d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apitag/method_tagdetachfromapi_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apitag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagDetachFromApiOperationResponse struct { - HttpResponse *http.Response -} - -// TagDetachFromApi ... -func (c ApiTagClient) TagDetachFromApi(ctx context.Context, id ApiTagId) (result TagDetachFromApiOperationResponse, err error) { - req, err := c.preparerForTagDetachFromApi(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagDetachFromApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagDetachFromApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagDetachFromApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagDetachFromApi", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagDetachFromApi prepares the TagDetachFromApi request. -func (c ApiTagClient) preparerForTagDetachFromApi(ctx context.Context, id ApiTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagDetachFromApi handles the response to the TagDetachFromApi request. The method always -// closes the http.Response Body. -func (c ApiTagClient) responderForTagDetachFromApi(resp *http.Response) (result TagDetachFromApiOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apitag/method_taggetbyapi.go b/resource-manager/apimanagement/2022-08-01/apitag/method_taggetbyapi.go new file mode 100644 index 00000000000..97876d1178c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apitag/method_taggetbyapi.go @@ -0,0 +1,51 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagGetByApi ... +func (c ApiTagClient) TagGetByApi(ctx context.Context, id ApiTagId) (result TagGetByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apitag/method_taggetbyapi_autorest.go b/resource-manager/apimanagement/2022-08-01/apitag/method_taggetbyapi_autorest.go deleted file mode 100644 index cdc7b57c932..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apitag/method_taggetbyapi_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apitag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetByApiOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagGetByApi ... -func (c ApiTagClient) TagGetByApi(ctx context.Context, id ApiTagId) (result TagGetByApiOperationResponse, err error) { - req, err := c.preparerForTagGetByApi(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetByApi", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetByApi prepares the TagGetByApi request. -func (c ApiTagClient) preparerForTagGetByApi(ctx context.Context, id ApiTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetByApi handles the response to the TagGetByApi request. The method always -// closes the http.Response Body. -func (c ApiTagClient) responderForTagGetByApi(resp *http.Response) (result TagGetByApiOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apitag/method_taggetentitystatebyapi.go b/resource-manager/apimanagement/2022-08-01/apitag/method_taggetentitystatebyapi.go new file mode 100644 index 00000000000..eb833e96b2a --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apitag/method_taggetentitystatebyapi.go @@ -0,0 +1,46 @@ +package apitag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetEntityStateByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagGetEntityStateByApi ... +func (c ApiTagClient) TagGetEntityStateByApi(ctx context.Context, id ApiTagId) (result TagGetEntityStateByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apitag/method_taggetentitystatebyapi_autorest.go b/resource-manager/apimanagement/2022-08-01/apitag/method_taggetentitystatebyapi_autorest.go deleted file mode 100644 index f0c60a63c86..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apitag/method_taggetentitystatebyapi_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apitag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetEntityStateByApiOperationResponse struct { - HttpResponse *http.Response -} - -// TagGetEntityStateByApi ... -func (c ApiTagClient) TagGetEntityStateByApi(ctx context.Context, id ApiTagId) (result TagGetEntityStateByApiOperationResponse, err error) { - req, err := c.preparerForTagGetEntityStateByApi(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetEntityStateByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetEntityStateByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetEntityStateByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagGetEntityStateByApi", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetEntityStateByApi prepares the TagGetEntityStateByApi request. -func (c ApiTagClient) preparerForTagGetEntityStateByApi(ctx context.Context, id ApiTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetEntityStateByApi handles the response to the TagGetEntityStateByApi request. The method always -// closes the http.Response Body. -func (c ApiTagClient) responderForTagGetEntityStateByApi(resp *http.Response) (result TagGetEntityStateByApiOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apitag/method_taglistbyapi.go b/resource-manager/apimanagement/2022-08-01/apitag/method_taglistbyapi.go new file mode 100644 index 00000000000..9ab4d2bb22c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apitag/method_taglistbyapi.go @@ -0,0 +1,125 @@ +package apitag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type TagListByApiCompleteResult struct { + Items []TagContract +} + +type TagListByApiOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultTagListByApiOperationOptions() TagListByApiOperationOptions { + return TagListByApiOperationOptions{} +} + +func (o TagListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o TagListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o TagListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// TagListByApi ... +func (c ApiTagClient) TagListByApi(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (result TagListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// TagListByApiComplete retrieves all the results into a single object +func (c ApiTagClient) TagListByApiComplete(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (TagListByApiCompleteResult, error) { + return c.TagListByApiCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// TagListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiTagClient) TagListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options TagListByApiOperationOptions, predicate TagContractOperationPredicate) (result TagListByApiCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.TagListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = TagListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apitag/method_taglistbyapi_autorest.go b/resource-manager/apimanagement/2022-08-01/apitag/method_taglistbyapi_autorest.go deleted file mode 100644 index 750fb144087..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apitag/method_taglistbyapi_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apitag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagListByApiOperationResponse struct { - HttpResponse *http.Response - Model *[]TagContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (TagListByApiOperationResponse, error) -} - -type TagListByApiCompleteResult struct { - Items []TagContract -} - -func (r TagListByApiOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r TagListByApiOperationResponse) LoadMore(ctx context.Context) (resp TagListByApiOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type TagListByApiOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultTagListByApiOperationOptions() TagListByApiOperationOptions { - return TagListByApiOperationOptions{} -} - -func (o TagListByApiOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o TagListByApiOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// TagListByApi ... -func (c ApiTagClient) TagListByApi(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (resp TagListByApiOperationResponse, err error) { - req, err := c.preparerForTagListByApi(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForTagListByApi(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForTagListByApi prepares the TagListByApi request. -func (c ApiTagClient) preparerForTagListByApi(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForTagListByApiWithNextLink prepares the TagListByApi request with the given nextLink token. -func (c ApiTagClient) preparerForTagListByApiWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagListByApi handles the response to the TagListByApi request. The method always -// closes the http.Response Body. -func (c ApiTagClient) responderForTagListByApi(resp *http.Response) (result TagListByApiOperationResponse, err error) { - type page struct { - Values []TagContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result TagListByApiOperationResponse, err error) { - req, err := c.preparerForTagListByApiWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagListByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitag.ApiTagClient", "TagListByApi", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// TagListByApiComplete retrieves all of the results into a single object -func (c ApiTagClient) TagListByApiComplete(ctx context.Context, id ApiId, options TagListByApiOperationOptions) (TagListByApiCompleteResult, error) { - return c.TagListByApiCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) -} - -// TagListByApiCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiTagClient) TagListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options TagListByApiOperationOptions, predicate TagContractOperationPredicate) (resp TagListByApiCompleteResult, err error) { - items := make([]TagContract, 0) - - page, err := c.TagListByApi(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := TagListByApiCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/client.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/client.go index e11c12678bb..d56da7fd44f 100644 --- a/resource-manager/apimanagement/2022-08-01/apitagdescription/client.go +++ b/resource-manager/apimanagement/2022-08-01/apitagdescription/client.go @@ -1,18 +1,26 @@ package apitagdescription -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiTagDescriptionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiTagDescriptionClientWithBaseURI(endpoint string) ApiTagDescriptionClient { - return ApiTagDescriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiTagDescriptionClientWithBaseURI(api sdkEnv.Api) (*ApiTagDescriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apitagdescription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiTagDescriptionClient: %+v", err) } + + return &ApiTagDescriptionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_createorupdate.go new file mode 100644 index 00000000000..08f839f5fe5 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_createorupdate.go @@ -0,0 +1,85 @@ +package apitagdescription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagDescriptionContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiTagDescriptionClient) CreateOrUpdate(ctx context.Context, id TagDescriptionId, input TagDescriptionCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_createorupdate_autorest.go deleted file mode 100644 index 876ae7520b3..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apitagdescription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *TagDescriptionContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiTagDescriptionClient) CreateOrUpdate(ctx context.Context, id TagDescriptionId, input TagDescriptionCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiTagDescriptionClient) preparerForCreateOrUpdate(ctx context.Context, id TagDescriptionId, input TagDescriptionCreateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiTagDescriptionClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_delete.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_delete.go new file mode 100644 index 00000000000..bc50e1495af --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_delete.go @@ -0,0 +1,76 @@ +package apitagdescription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiTagDescriptionClient) Delete(ctx context.Context, id TagDescriptionId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_delete_autorest.go deleted file mode 100644 index a383875ca12..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apitagdescription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiTagDescriptionClient) Delete(ctx context.Context, id TagDescriptionId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiTagDescriptionClient) preparerForDelete(ctx context.Context, id TagDescriptionId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiTagDescriptionClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_get.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_get.go new file mode 100644 index 00000000000..b4eb50d639b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_get.go @@ -0,0 +1,51 @@ +package apitagdescription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagDescriptionContract +} + +// Get ... +func (c ApiTagDescriptionClient) Get(ctx context.Context, id TagDescriptionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_get_autorest.go deleted file mode 100644 index 062aee3683f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apitagdescription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *TagDescriptionContract -} - -// Get ... -func (c ApiTagDescriptionClient) Get(ctx context.Context, id TagDescriptionId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiTagDescriptionClient) preparerForGet(ctx context.Context, id TagDescriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiTagDescriptionClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_getentitytag.go new file mode 100644 index 00000000000..1db8e6e13d4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_getentitytag.go @@ -0,0 +1,46 @@ +package apitagdescription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiTagDescriptionClient) GetEntityTag(ctx context.Context, id TagDescriptionId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_getentitytag_autorest.go deleted file mode 100644 index f75e60f2cdd..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apitagdescription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiTagDescriptionClient) GetEntityTag(ctx context.Context, id TagDescriptionId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiTagDescriptionClient) preparerForGetEntityTag(ctx context.Context, id TagDescriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiTagDescriptionClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_listbyservice.go new file mode 100644 index 00000000000..ccc6ebbef03 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_listbyservice.go @@ -0,0 +1,125 @@ +package apitagdescription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagDescriptionContract +} + +type ListByServiceCompleteResult struct { + Items []TagDescriptionContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiTagDescriptionClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tagDescriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagDescriptionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiTagDescriptionClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagDescriptionContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiTagDescriptionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate TagDescriptionContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]TagDescriptionContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/method_listbyservice_autorest.go deleted file mode 100644 index d6970e826db..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apitagdescription/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apitagdescription - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]TagDescriptionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []TagDescriptionContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiTagDescriptionClient) ListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiTagDescriptionClient) preparerForListByService(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tagDescriptions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiTagDescriptionClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiTagDescriptionClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []TagDescriptionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apitagdescription.ApiTagDescriptionClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiTagDescriptionClient) ListByServiceComplete(ctx context.Context, id ApiId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagDescriptionContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiTagDescriptionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByServiceOperationOptions, predicate TagDescriptionContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]TagDescriptionContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/client.go b/resource-manager/apimanagement/2022-08-01/apiversionset/client.go index 7fbe4fc8a0f..0fa53af399e 100644 --- a/resource-manager/apimanagement/2022-08-01/apiversionset/client.go +++ b/resource-manager/apimanagement/2022-08-01/apiversionset/client.go @@ -1,18 +1,26 @@ package apiversionset -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiVersionSetClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiVersionSetClientWithBaseURI(endpoint string) ApiVersionSetClient { - return ApiVersionSetClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiVersionSetClientWithBaseURI(api sdkEnv.Api) (*ApiVersionSetClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiversionset", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiVersionSetClient: %+v", err) } + + return &ApiVersionSetClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/constants.go b/resource-manager/apimanagement/2022-08-01/apiversionset/constants.go index c13d5055144..4fb4d169fff 100644 --- a/resource-manager/apimanagement/2022-08-01/apiversionset/constants.go +++ b/resource-manager/apimanagement/2022-08-01/apiversionset/constants.go @@ -1,6 +1,10 @@ package apiversionset -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForVersioningScheme() []string { } } +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVersioningScheme(input string) (*VersioningScheme, error) { vals := map[string]VersioningScheme{ "header": VersioningSchemeHeader, diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apiversionset/method_createorupdate.go new file mode 100644 index 00000000000..69f9d46f502 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiversionset/method_createorupdate.go @@ -0,0 +1,85 @@ +package apiversionset + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiVersionSetContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiVersionSetClient) CreateOrUpdate(ctx context.Context, id ApiVersionSetId, input ApiVersionSetContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apiversionset/method_createorupdate_autorest.go deleted file mode 100644 index 5ec307cada5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiversionset/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiversionset - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiVersionSetContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiVersionSetClient) CreateOrUpdate(ctx context.Context, id ApiVersionSetId, input ApiVersionSetContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiVersionSetClient) preparerForCreateOrUpdate(ctx context.Context, id ApiVersionSetId, input ApiVersionSetContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiVersionSetClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/method_get.go b/resource-manager/apimanagement/2022-08-01/apiversionset/method_get.go new file mode 100644 index 00000000000..910c5a90631 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiversionset/method_get.go @@ -0,0 +1,51 @@ +package apiversionset + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiVersionSetContract +} + +// Get ... +func (c ApiVersionSetClient) Get(ctx context.Context, id ApiVersionSetId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apiversionset/method_get_autorest.go deleted file mode 100644 index 51f2f6edc1b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiversionset/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package apiversionset - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ApiVersionSetContract -} - -// Get ... -func (c ApiVersionSetClient) Get(ctx context.Context, id ApiVersionSetId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiVersionSetClient) preparerForGet(ctx context.Context, id ApiVersionSetId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiVersionSetClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apiversionset/method_getentitytag.go new file mode 100644 index 00000000000..9f95f1e557c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiversionset/method_getentitytag.go @@ -0,0 +1,46 @@ +package apiversionset + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiVersionSetClient) GetEntityTag(ctx context.Context, id ApiVersionSetId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apiversionset/method_getentitytag_autorest.go deleted file mode 100644 index a0997df5dc8..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiversionset/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package apiversionset - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiVersionSetClient) GetEntityTag(ctx context.Context, id ApiVersionSetId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiVersionSetClient) preparerForGetEntityTag(ctx context.Context, id ApiVersionSetId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiVersionSetClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/apiversionset/method_listbyservice.go new file mode 100644 index 00000000000..c850c773f5e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiversionset/method_listbyservice.go @@ -0,0 +1,125 @@ +package apiversionset + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiVersionSetContract +} + +type ListByServiceCompleteResult struct { + Items []ApiVersionSetContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ApiVersionSetClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apiVersionSets", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiVersionSetContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ApiVersionSetClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiVersionSetContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiVersionSetClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ApiVersionSetContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiVersionSetContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/apiversionset/method_listbyservice_autorest.go deleted file mode 100644 index a724e716e3a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiversionset/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apiversionset - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiVersionSetContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ApiVersionSetContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ApiVersionSetClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ApiVersionSetClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/apiVersionSets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ApiVersionSetClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ApiVersionSetClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ApiVersionSetContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ApiVersionSetClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiVersionSetContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiVersionSetClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ApiVersionSetContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ApiVersionSetContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/method_update.go b/resource-manager/apimanagement/2022-08-01/apiversionset/method_update.go new file mode 100644 index 00000000000..a894808f20a --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiversionset/method_update.go @@ -0,0 +1,84 @@ +package apiversionset + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiVersionSetContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiVersionSetClient) Update(ctx context.Context, id ApiVersionSetId, input ApiVersionSetUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/apiversionset/method_update_autorest.go deleted file mode 100644 index c839759e328..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiversionset/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package apiversionset - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiVersionSetContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiVersionSetClient) Update(ctx context.Context, id ApiVersionSetId, input ApiVersionSetUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionset.ApiVersionSetClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiVersionSetClient) preparerForUpdate(ctx context.Context, id ApiVersionSetId, input ApiVersionSetUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiVersionSetClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionsets/client.go b/resource-manager/apimanagement/2022-08-01/apiversionsets/client.go index d927796792e..c12c1f59a72 100644 --- a/resource-manager/apimanagement/2022-08-01/apiversionsets/client.go +++ b/resource-manager/apimanagement/2022-08-01/apiversionsets/client.go @@ -1,18 +1,26 @@ package apiversionsets -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiVersionSetsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiVersionSetsClientWithBaseURI(endpoint string) ApiVersionSetsClient { - return ApiVersionSetsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiVersionSetsClientWithBaseURI(api sdkEnv.Api) (*ApiVersionSetsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiversionsets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiVersionSetsClient: %+v", err) } + + return &ApiVersionSetsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apiversionsets/method_apiversionsetdelete.go b/resource-manager/apimanagement/2022-08-01/apiversionsets/method_apiversionsetdelete.go new file mode 100644 index 00000000000..f50800347d8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiversionsets/method_apiversionsetdelete.go @@ -0,0 +1,76 @@ +package apiversionsets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiVersionSetDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type ApiVersionSetDeleteOperationOptions struct { + IfMatch *string +} + +func DefaultApiVersionSetDeleteOperationOptions() ApiVersionSetDeleteOperationOptions { + return ApiVersionSetDeleteOperationOptions{} +} + +func (o ApiVersionSetDeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o ApiVersionSetDeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ApiVersionSetDeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// ApiVersionSetDelete ... +func (c ApiVersionSetsClient) ApiVersionSetDelete(ctx context.Context, id ApiVersionSetId, options ApiVersionSetDeleteOperationOptions) (result ApiVersionSetDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiversionsets/method_apiversionsetdelete_autorest.go b/resource-manager/apimanagement/2022-08-01/apiversionsets/method_apiversionsetdelete_autorest.go deleted file mode 100644 index 72a19648666..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiversionsets/method_apiversionsetdelete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package apiversionsets - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ApiVersionSetDeleteOperationResponse struct { - HttpResponse *http.Response -} - -type ApiVersionSetDeleteOperationOptions struct { - IfMatch *string -} - -func DefaultApiVersionSetDeleteOperationOptions() ApiVersionSetDeleteOperationOptions { - return ApiVersionSetDeleteOperationOptions{} -} - -func (o ApiVersionSetDeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o ApiVersionSetDeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// ApiVersionSetDelete ... -func (c ApiVersionSetsClient) ApiVersionSetDelete(ctx context.Context, id ApiVersionSetId, options ApiVersionSetDeleteOperationOptions) (result ApiVersionSetDeleteOperationResponse, err error) { - req, err := c.preparerForApiVersionSetDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionsets.ApiVersionSetsClient", "ApiVersionSetDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionsets.ApiVersionSetsClient", "ApiVersionSetDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForApiVersionSetDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiversionsets.ApiVersionSetsClient", "ApiVersionSetDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForApiVersionSetDelete prepares the ApiVersionSetDelete request. -func (c ApiVersionSetsClient) preparerForApiVersionSetDelete(ctx context.Context, id ApiVersionSetId, options ApiVersionSetDeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForApiVersionSetDelete handles the response to the ApiVersionSetDelete request. The method always -// closes the http.Response Body. -func (c ApiVersionSetsClient) responderForApiVersionSetDelete(resp *http.Response) (result ApiVersionSetDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/client.go b/resource-manager/apimanagement/2022-08-01/apiwiki/client.go index a2693fc245c..4788cb1ff72 100644 --- a/resource-manager/apimanagement/2022-08-01/apiwiki/client.go +++ b/resource-manager/apimanagement/2022-08-01/apiwiki/client.go @@ -1,18 +1,26 @@ package apiwiki -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ApiWikiClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewApiWikiClientWithBaseURI(endpoint string) ApiWikiClient { - return ApiWikiClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewApiWikiClientWithBaseURI(api sdkEnv.Api) (*ApiWikiClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "apiwiki", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ApiWikiClient: %+v", err) } + + return &ApiWikiClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_createorupdate.go new file mode 100644 index 00000000000..12a18615207 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiwiki/method_createorupdate.go @@ -0,0 +1,85 @@ +package apiwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *WikiContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ApiWikiClient) CreateOrUpdate(ctx context.Context, id ApiId, input WikiContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/wikis/default", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_createorupdate_autorest.go deleted file mode 100644 index 48fbed22b62..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiwiki/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package apiwiki - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *WikiContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ApiWikiClient) CreateOrUpdate(ctx context.Context, id ApiId, input WikiContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ApiWikiClient) preparerForCreateOrUpdate(ctx context.Context, id ApiId, input WikiContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/wikis/default", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ApiWikiClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_delete.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_delete.go new file mode 100644 index 00000000000..74d9f29868e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiwiki/method_delete.go @@ -0,0 +1,76 @@ +package apiwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ApiWikiClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/wikis/default", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_delete_autorest.go deleted file mode 100644 index 1da35240d25..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiwiki/method_delete_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package apiwiki - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ApiWikiClient) Delete(ctx context.Context, id ApiId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ApiWikiClient) preparerForDelete(ctx context.Context, id ApiId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/wikis/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ApiWikiClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_get.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_get.go new file mode 100644 index 00000000000..555c95fc6d5 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiwiki/method_get.go @@ -0,0 +1,52 @@ +package apiwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *WikiContract +} + +// Get ... +func (c ApiWikiClient) Get(ctx context.Context, id ApiId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/wikis/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_get_autorest.go deleted file mode 100644 index 0510f3eab68..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiwiki/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package apiwiki - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *WikiContract -} - -// Get ... -func (c ApiWikiClient) Get(ctx context.Context, id ApiId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ApiWikiClient) preparerForGet(ctx context.Context, id ApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/wikis/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ApiWikiClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_getentitytag.go new file mode 100644 index 00000000000..08294e831ff --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiwiki/method_getentitytag.go @@ -0,0 +1,47 @@ +package apiwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ApiWikiClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/wikis/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_getentitytag_autorest.go deleted file mode 100644 index cbab473a14a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiwiki/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package apiwiki - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ApiWikiClient) GetEntityTag(ctx context.Context, id ApiId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ApiWikiClient) preparerForGetEntityTag(ctx context.Context, id ApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/wikis/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ApiWikiClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_list.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_list.go new file mode 100644 index 00000000000..b0302cf5d7e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiwiki/method_list.go @@ -0,0 +1,125 @@ +package apiwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]WikiContract +} + +type ListCompleteResult struct { + Items []WikiContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c ApiWikiClient) List(ctx context.Context, id ApiId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/wikis", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]WikiContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ApiWikiClient) ListComplete(ctx context.Context, id ApiId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, WikiContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ApiWikiClient) ListCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListOperationOptions, predicate WikiContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]WikiContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_list_autorest.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_list_autorest.go deleted file mode 100644 index ca20cecdb65..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiwiki/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package apiwiki - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]WikiContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []WikiContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c ApiWikiClient) List(ctx context.Context, id ApiId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ApiWikiClient) preparerForList(ctx context.Context, id ApiId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/wikis", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ApiWikiClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ApiWikiClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []WikiContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ApiWikiClient) ListComplete(ctx context.Context, id ApiId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, WikiContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ApiWikiClient) ListCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListOperationOptions, predicate WikiContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]WikiContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_update.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_update.go new file mode 100644 index 00000000000..523376050f6 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/apiwiki/method_update.go @@ -0,0 +1,84 @@ +package apiwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *WikiContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ApiWikiClient) Update(ctx context.Context, id ApiId, input WikiUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/wikis/default", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/apiwiki/method_update_autorest.go deleted file mode 100644 index 970a06ebc89..00000000000 --- a/resource-manager/apimanagement/2022-08-01/apiwiki/method_update_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package apiwiki - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *WikiContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ApiWikiClient) Update(ctx context.Context, id ApiId, input WikiUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "apiwiki.ApiWikiClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ApiWikiClient) preparerForUpdate(ctx context.Context, id ApiId, input WikiUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/wikis/default", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ApiWikiClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorization/client.go b/resource-manager/apimanagement/2022-08-01/authorization/client.go index b1a04f4e58a..0e63b24cfc0 100644 --- a/resource-manager/apimanagement/2022-08-01/authorization/client.go +++ b/resource-manager/apimanagement/2022-08-01/authorization/client.go @@ -1,18 +1,26 @@ package authorization -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type AuthorizationClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAuthorizationClientWithBaseURI(endpoint string) AuthorizationClient { - return AuthorizationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAuthorizationClientWithBaseURI(api sdkEnv.Api) (*AuthorizationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "authorization", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AuthorizationClient: %+v", err) } + + return &AuthorizationClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/authorization/constants.go b/resource-manager/apimanagement/2022-08-01/authorization/constants.go index a6468636464..a28406af2a0 100644 --- a/resource-manager/apimanagement/2022-08-01/authorization/constants.go +++ b/resource-manager/apimanagement/2022-08-01/authorization/constants.go @@ -1,6 +1,10 @@ package authorization -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -17,6 +21,19 @@ func PossibleValuesForAuthorizationType() []string { } } +func (s *AuthorizationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAuthorizationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAuthorizationType(input string) (*AuthorizationType, error) { vals := map[string]AuthorizationType{ "oauth2": AuthorizationTypeOAuthTwo, @@ -44,6 +61,19 @@ func PossibleValuesForOAuth2GrantType() []string { } } +func (s *OAuth2GrantType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOAuth2GrantType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOAuth2GrantType(input string) (*OAuth2GrantType, error) { vals := map[string]OAuth2GrantType{ "authorizationcode": OAuth2GrantTypeAuthorizationCode, diff --git a/resource-manager/apimanagement/2022-08-01/authorization/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/authorization/method_createorupdate.go new file mode 100644 index 00000000000..9e86fac93c8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorization/method_createorupdate.go @@ -0,0 +1,85 @@ +package authorization + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c AuthorizationClient) CreateOrUpdate(ctx context.Context, id AuthorizationId, input AuthorizationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorization/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/authorization/method_createorupdate_autorest.go deleted file mode 100644 index b8663aec7ef..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorization/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package authorization - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c AuthorizationClient) CreateOrUpdate(ctx context.Context, id AuthorizationId, input AuthorizationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.AuthorizationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.AuthorizationClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.AuthorizationClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c AuthorizationClient) preparerForCreateOrUpdate(ctx context.Context, id AuthorizationId, input AuthorizationContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c AuthorizationClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorization/method_delete.go b/resource-manager/apimanagement/2022-08-01/authorization/method_delete.go new file mode 100644 index 00000000000..4e593e93d69 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorization/method_delete.go @@ -0,0 +1,76 @@ +package authorization + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c AuthorizationClient) Delete(ctx context.Context, id AuthorizationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorization/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/authorization/method_delete_autorest.go deleted file mode 100644 index 1e653a427e5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorization/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package authorization - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c AuthorizationClient) Delete(ctx context.Context, id AuthorizationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.AuthorizationClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.AuthorizationClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.AuthorizationClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c AuthorizationClient) preparerForDelete(ctx context.Context, id AuthorizationId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c AuthorizationClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorization/method_get.go b/resource-manager/apimanagement/2022-08-01/authorization/method_get.go new file mode 100644 index 00000000000..23fe8ece2c5 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorization/method_get.go @@ -0,0 +1,51 @@ +package authorization + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationContract +} + +// Get ... +func (c AuthorizationClient) Get(ctx context.Context, id AuthorizationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorization/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/authorization/method_get_autorest.go deleted file mode 100644 index f286797ed33..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorization/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package authorization - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationContract -} - -// Get ... -func (c AuthorizationClient) Get(ctx context.Context, id AuthorizationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.AuthorizationClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.AuthorizationClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.AuthorizationClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AuthorizationClient) preparerForGet(ctx context.Context, id AuthorizationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c AuthorizationClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/client.go b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/client.go index 85ee086ae68..19b08a66d32 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/client.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/client.go @@ -1,18 +1,26 @@ package authorizationaccesspolicy -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type AuthorizationAccessPolicyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAuthorizationAccessPolicyClientWithBaseURI(endpoint string) AuthorizationAccessPolicyClient { - return AuthorizationAccessPolicyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAuthorizationAccessPolicyClientWithBaseURI(api sdkEnv.Api) (*AuthorizationAccessPolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "authorizationaccesspolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AuthorizationAccessPolicyClient: %+v", err) } + + return &AuthorizationAccessPolicyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_createorupdate.go new file mode 100644 index 00000000000..4a28c30dc4e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_createorupdate.go @@ -0,0 +1,85 @@ +package authorizationaccesspolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationAccessPolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c AuthorizationAccessPolicyClient) CreateOrUpdate(ctx context.Context, id AccessPolicyId, input AuthorizationAccessPolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_createorupdate_autorest.go deleted file mode 100644 index f249234bb7e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package authorizationaccesspolicy - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationAccessPolicyContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c AuthorizationAccessPolicyClient) CreateOrUpdate(ctx context.Context, id AccessPolicyId, input AuthorizationAccessPolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c AuthorizationAccessPolicyClient) preparerForCreateOrUpdate(ctx context.Context, id AccessPolicyId, input AuthorizationAccessPolicyContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c AuthorizationAccessPolicyClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_delete.go b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_delete.go new file mode 100644 index 00000000000..59c5782e01d --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_delete.go @@ -0,0 +1,76 @@ +package authorizationaccesspolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c AuthorizationAccessPolicyClient) Delete(ctx context.Context, id AccessPolicyId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_delete_autorest.go deleted file mode 100644 index 28713cc763b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package authorizationaccesspolicy - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c AuthorizationAccessPolicyClient) Delete(ctx context.Context, id AccessPolicyId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c AuthorizationAccessPolicyClient) preparerForDelete(ctx context.Context, id AccessPolicyId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c AuthorizationAccessPolicyClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_get.go b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_get.go new file mode 100644 index 00000000000..c4688e592e7 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_get.go @@ -0,0 +1,51 @@ +package authorizationaccesspolicy + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationAccessPolicyContract +} + +// Get ... +func (c AuthorizationAccessPolicyClient) Get(ctx context.Context, id AccessPolicyId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_get_autorest.go deleted file mode 100644 index af3bfad6c16..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package authorizationaccesspolicy - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationAccessPolicyContract -} - -// Get ... -func (c AuthorizationAccessPolicyClient) Get(ctx context.Context, id AccessPolicyId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AuthorizationAccessPolicyClient) preparerForGet(ctx context.Context, id AccessPolicyId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c AuthorizationAccessPolicyClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_listbyauthorization.go b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_listbyauthorization.go new file mode 100644 index 00000000000..de07ed50f81 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_listbyauthorization.go @@ -0,0 +1,125 @@ +package authorizationaccesspolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByAuthorizationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AuthorizationAccessPolicyContract +} + +type ListByAuthorizationCompleteResult struct { + Items []AuthorizationAccessPolicyContract +} + +type ListByAuthorizationOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByAuthorizationOperationOptions() ListByAuthorizationOperationOptions { + return ListByAuthorizationOperationOptions{} +} + +func (o ListByAuthorizationOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByAuthorizationOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByAuthorizationOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByAuthorization ... +func (c AuthorizationAccessPolicyClient) ListByAuthorization(ctx context.Context, id AuthorizationId, options ListByAuthorizationOperationOptions) (result ListByAuthorizationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/accessPolicies", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AuthorizationAccessPolicyContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByAuthorizationComplete retrieves all the results into a single object +func (c AuthorizationAccessPolicyClient) ListByAuthorizationComplete(ctx context.Context, id AuthorizationId, options ListByAuthorizationOperationOptions) (ListByAuthorizationCompleteResult, error) { + return c.ListByAuthorizationCompleteMatchingPredicate(ctx, id, options, AuthorizationAccessPolicyContractOperationPredicate{}) +} + +// ListByAuthorizationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AuthorizationAccessPolicyClient) ListByAuthorizationCompleteMatchingPredicate(ctx context.Context, id AuthorizationId, options ListByAuthorizationOperationOptions, predicate AuthorizationAccessPolicyContractOperationPredicate) (result ListByAuthorizationCompleteResult, err error) { + items := make([]AuthorizationAccessPolicyContract, 0) + + resp, err := c.ListByAuthorization(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByAuthorizationCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_listbyauthorization_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_listbyauthorization_autorest.go deleted file mode 100644 index 5ff2aaacc88..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/method_listbyauthorization_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package authorizationaccesspolicy - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByAuthorizationOperationResponse struct { - HttpResponse *http.Response - Model *[]AuthorizationAccessPolicyContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByAuthorizationOperationResponse, error) -} - -type ListByAuthorizationCompleteResult struct { - Items []AuthorizationAccessPolicyContract -} - -func (r ListByAuthorizationOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByAuthorizationOperationResponse) LoadMore(ctx context.Context) (resp ListByAuthorizationOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByAuthorizationOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByAuthorizationOperationOptions() ListByAuthorizationOperationOptions { - return ListByAuthorizationOperationOptions{} -} - -func (o ListByAuthorizationOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByAuthorizationOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByAuthorization ... -func (c AuthorizationAccessPolicyClient) ListByAuthorization(ctx context.Context, id AuthorizationId, options ListByAuthorizationOperationOptions) (resp ListByAuthorizationOperationResponse, err error) { - req, err := c.preparerForListByAuthorization(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "ListByAuthorization", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "ListByAuthorization", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByAuthorization(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "ListByAuthorization", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByAuthorization prepares the ListByAuthorization request. -func (c AuthorizationAccessPolicyClient) preparerForListByAuthorization(ctx context.Context, id AuthorizationId, options ListByAuthorizationOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/accessPolicies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByAuthorizationWithNextLink prepares the ListByAuthorization request with the given nextLink token. -func (c AuthorizationAccessPolicyClient) preparerForListByAuthorizationWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByAuthorization handles the response to the ListByAuthorization request. The method always -// closes the http.Response Body. -func (c AuthorizationAccessPolicyClient) responderForListByAuthorization(resp *http.Response) (result ListByAuthorizationOperationResponse, err error) { - type page struct { - Values []AuthorizationAccessPolicyContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByAuthorizationOperationResponse, err error) { - req, err := c.preparerForListByAuthorizationWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "ListByAuthorization", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "ListByAuthorization", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByAuthorization(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationaccesspolicy.AuthorizationAccessPolicyClient", "ListByAuthorization", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByAuthorizationComplete retrieves all of the results into a single object -func (c AuthorizationAccessPolicyClient) ListByAuthorizationComplete(ctx context.Context, id AuthorizationId, options ListByAuthorizationOperationOptions) (ListByAuthorizationCompleteResult, error) { - return c.ListByAuthorizationCompleteMatchingPredicate(ctx, id, options, AuthorizationAccessPolicyContractOperationPredicate{}) -} - -// ListByAuthorizationCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AuthorizationAccessPolicyClient) ListByAuthorizationCompleteMatchingPredicate(ctx context.Context, id AuthorizationId, options ListByAuthorizationOperationOptions, predicate AuthorizationAccessPolicyContractOperationPredicate) (resp ListByAuthorizationCompleteResult, err error) { - items := make([]AuthorizationAccessPolicyContract, 0) - - page, err := c.ListByAuthorization(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByAuthorizationCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/client.go b/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/client.go index 83719e6c00f..a159e653140 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/client.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/client.go @@ -1,18 +1,26 @@ package authorizationconfirmconsentcode -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type AuthorizationConfirmConsentCodeClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAuthorizationConfirmConsentCodeClientWithBaseURI(endpoint string) AuthorizationConfirmConsentCodeClient { - return AuthorizationConfirmConsentCodeClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAuthorizationConfirmConsentCodeClientWithBaseURI(api sdkEnv.Api) (*AuthorizationConfirmConsentCodeClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "authorizationconfirmconsentcode", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AuthorizationConfirmConsentCodeClient: %+v", err) } + + return &AuthorizationConfirmConsentCodeClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/method_authorizationconfirmconsentcode.go b/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/method_authorizationconfirmconsentcode.go new file mode 100644 index 00000000000..ae681f6debd --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/method_authorizationconfirmconsentcode.go @@ -0,0 +1,51 @@ +package authorizationconfirmconsentcode + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationConfirmConsentCodeOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// AuthorizationConfirmConsentCode ... +func (c AuthorizationConfirmConsentCodeClient) AuthorizationConfirmConsentCode(ctx context.Context, id AuthorizationId, input AuthorizationConfirmConsentCodeRequestContract) (result AuthorizationConfirmConsentCodeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/confirmConsentCode", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/method_authorizationconfirmconsentcode_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/method_authorizationconfirmconsentcode_autorest.go deleted file mode 100644 index d4913b9cb7f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/method_authorizationconfirmconsentcode_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package authorizationconfirmconsentcode - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AuthorizationConfirmConsentCodeOperationResponse struct { - HttpResponse *http.Response -} - -// AuthorizationConfirmConsentCode ... -func (c AuthorizationConfirmConsentCodeClient) AuthorizationConfirmConsentCode(ctx context.Context, id AuthorizationId, input AuthorizationConfirmConsentCodeRequestContract) (result AuthorizationConfirmConsentCodeOperationResponse, err error) { - req, err := c.preparerForAuthorizationConfirmConsentCode(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationconfirmconsentcode.AuthorizationConfirmConsentCodeClient", "AuthorizationConfirmConsentCode", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationconfirmconsentcode.AuthorizationConfirmConsentCodeClient", "AuthorizationConfirmConsentCode", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAuthorizationConfirmConsentCode(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationconfirmconsentcode.AuthorizationConfirmConsentCodeClient", "AuthorizationConfirmConsentCode", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAuthorizationConfirmConsentCode prepares the AuthorizationConfirmConsentCode request. -func (c AuthorizationConfirmConsentCodeClient) preparerForAuthorizationConfirmConsentCode(ctx context.Context, id AuthorizationId, input AuthorizationConfirmConsentCodeRequestContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/confirmConsentCode", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAuthorizationConfirmConsentCode handles the response to the AuthorizationConfirmConsentCode request. The method always -// closes the http.Response Body. -func (c AuthorizationConfirmConsentCodeClient) responderForAuthorizationConfirmConsentCode(resp *http.Response) (result AuthorizationConfirmConsentCodeOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/client.go b/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/client.go index 5a583bf36e8..1dc31248aba 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/client.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/client.go @@ -1,18 +1,26 @@ package authorizationloginlinks -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type AuthorizationLoginLinksClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAuthorizationLoginLinksClientWithBaseURI(endpoint string) AuthorizationLoginLinksClient { - return AuthorizationLoginLinksClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAuthorizationLoginLinksClientWithBaseURI(api sdkEnv.Api) (*AuthorizationLoginLinksClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "authorizationloginlinks", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AuthorizationLoginLinksClient: %+v", err) } + + return &AuthorizationLoginLinksClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/method_post.go b/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/method_post.go new file mode 100644 index 00000000000..720ce277db0 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/method_post.go @@ -0,0 +1,56 @@ +package authorizationloginlinks + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PostOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationLoginResponseContract +} + +// Post ... +func (c AuthorizationLoginLinksClient) Post(ctx context.Context, id AuthorizationId, input AuthorizationLoginRequestContract) (result PostOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/getLoginLinks", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/method_post_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/method_post_autorest.go deleted file mode 100644 index a5159de4711..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/method_post_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package authorizationloginlinks - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PostOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationLoginResponseContract -} - -// Post ... -func (c AuthorizationLoginLinksClient) Post(ctx context.Context, id AuthorizationId, input AuthorizationLoginRequestContract) (result PostOperationResponse, err error) { - req, err := c.preparerForPost(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationloginlinks.AuthorizationLoginLinksClient", "Post", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationloginlinks.AuthorizationLoginLinksClient", "Post", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPost(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationloginlinks.AuthorizationLoginLinksClient", "Post", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPost prepares the Post request. -func (c AuthorizationLoginLinksClient) preparerForPost(ctx context.Context, id AuthorizationId, input AuthorizationLoginRequestContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/getLoginLinks", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPost handles the response to the Post request. The method always -// closes the http.Response Body. -func (c AuthorizationLoginLinksClient) responderForPost(resp *http.Response) (result PostOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationprovider/client.go b/resource-manager/apimanagement/2022-08-01/authorizationprovider/client.go index 5b0b63f58a1..946c06640db 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationprovider/client.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationprovider/client.go @@ -1,18 +1,26 @@ package authorizationprovider -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type AuthorizationProviderClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAuthorizationProviderClientWithBaseURI(endpoint string) AuthorizationProviderClient { - return AuthorizationProviderClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAuthorizationProviderClientWithBaseURI(api sdkEnv.Api) (*AuthorizationProviderClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "authorizationprovider", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AuthorizationProviderClient: %+v", err) } + + return &AuthorizationProviderClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_createorupdate.go new file mode 100644 index 00000000000..ad20802b2c8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_createorupdate.go @@ -0,0 +1,85 @@ +package authorizationprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationProviderContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c AuthorizationProviderClient) CreateOrUpdate(ctx context.Context, id AuthorizationProviderId, input AuthorizationProviderContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_createorupdate_autorest.go deleted file mode 100644 index 5100240bc06..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package authorizationprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationProviderContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c AuthorizationProviderClient) CreateOrUpdate(ctx context.Context, id AuthorizationProviderId, input AuthorizationProviderContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c AuthorizationProviderClient) preparerForCreateOrUpdate(ctx context.Context, id AuthorizationProviderId, input AuthorizationProviderContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c AuthorizationProviderClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_delete.go b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_delete.go new file mode 100644 index 00000000000..29ff97189f8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_delete.go @@ -0,0 +1,76 @@ +package authorizationprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c AuthorizationProviderClient) Delete(ctx context.Context, id AuthorizationProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_delete_autorest.go deleted file mode 100644 index 28c7fb69f5b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package authorizationprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c AuthorizationProviderClient) Delete(ctx context.Context, id AuthorizationProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c AuthorizationProviderClient) preparerForDelete(ctx context.Context, id AuthorizationProviderId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c AuthorizationProviderClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_get.go b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_get.go new file mode 100644 index 00000000000..36245d9d14b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_get.go @@ -0,0 +1,51 @@ +package authorizationprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationProviderContract +} + +// Get ... +func (c AuthorizationProviderClient) Get(ctx context.Context, id AuthorizationProviderId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_get_autorest.go deleted file mode 100644 index a69df7dc9b0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package authorizationprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationProviderContract -} - -// Get ... -func (c AuthorizationProviderClient) Get(ctx context.Context, id AuthorizationProviderId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AuthorizationProviderClient) preparerForGet(ctx context.Context, id AuthorizationProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c AuthorizationProviderClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_listbyservice.go new file mode 100644 index 00000000000..f0982bf9950 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_listbyservice.go @@ -0,0 +1,125 @@ +package authorizationprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AuthorizationProviderContract +} + +type ListByServiceCompleteResult struct { + Items []AuthorizationProviderContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c AuthorizationProviderClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/authorizationProviders", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AuthorizationProviderContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c AuthorizationProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AuthorizationProviderContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AuthorizationProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AuthorizationProviderContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]AuthorizationProviderContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_listbyservice_autorest.go deleted file mode 100644 index 1c01d2af2fe..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationprovider/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package authorizationprovider - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]AuthorizationProviderContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []AuthorizationProviderContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c AuthorizationProviderClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c AuthorizationProviderClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/authorizationProviders", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c AuthorizationProviderClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c AuthorizationProviderClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []AuthorizationProviderContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationprovider.AuthorizationProviderClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c AuthorizationProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AuthorizationProviderContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AuthorizationProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AuthorizationProviderContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]AuthorizationProviderContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizations/client.go b/resource-manager/apimanagement/2022-08-01/authorizations/client.go index b7da5521b01..09a531c90aa 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizations/client.go +++ b/resource-manager/apimanagement/2022-08-01/authorizations/client.go @@ -1,18 +1,26 @@ package authorizations -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type AuthorizationsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAuthorizationsClientWithBaseURI(endpoint string) AuthorizationsClient { - return AuthorizationsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAuthorizationsClientWithBaseURI(api sdkEnv.Api) (*AuthorizationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "authorizations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AuthorizationsClient: %+v", err) } + + return &AuthorizationsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/authorizations/constants.go b/resource-manager/apimanagement/2022-08-01/authorizations/constants.go index e5a273d4574..9e2147e81f9 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizations/constants.go +++ b/resource-manager/apimanagement/2022-08-01/authorizations/constants.go @@ -1,6 +1,10 @@ package authorizations -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -17,6 +21,19 @@ func PossibleValuesForAuthorizationType() []string { } } +func (s *AuthorizationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAuthorizationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAuthorizationType(input string) (*AuthorizationType, error) { vals := map[string]AuthorizationType{ "oauth2": AuthorizationTypeOAuthTwo, @@ -44,6 +61,19 @@ func PossibleValuesForOAuth2GrantType() []string { } } +func (s *OAuth2GrantType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOAuth2GrantType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOAuth2GrantType(input string) (*OAuth2GrantType, error) { vals := map[string]OAuth2GrantType{ "authorizationcode": OAuth2GrantTypeAuthorizationCode, diff --git a/resource-manager/apimanagement/2022-08-01/authorizations/method_authorizationlistbyauthorizationprovider.go b/resource-manager/apimanagement/2022-08-01/authorizations/method_authorizationlistbyauthorizationprovider.go new file mode 100644 index 00000000000..bf4ad8f66d7 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizations/method_authorizationlistbyauthorizationprovider.go @@ -0,0 +1,125 @@ +package authorizations + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationListByAuthorizationProviderOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AuthorizationContract +} + +type AuthorizationListByAuthorizationProviderCompleteResult struct { + Items []AuthorizationContract +} + +type AuthorizationListByAuthorizationProviderOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultAuthorizationListByAuthorizationProviderOperationOptions() AuthorizationListByAuthorizationProviderOperationOptions { + return AuthorizationListByAuthorizationProviderOperationOptions{} +} + +func (o AuthorizationListByAuthorizationProviderOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o AuthorizationListByAuthorizationProviderOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o AuthorizationListByAuthorizationProviderOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// AuthorizationListByAuthorizationProvider ... +func (c AuthorizationsClient) AuthorizationListByAuthorizationProvider(ctx context.Context, id AuthorizationProviderId, options AuthorizationListByAuthorizationProviderOperationOptions) (result AuthorizationListByAuthorizationProviderOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/authorizations", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AuthorizationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// AuthorizationListByAuthorizationProviderComplete retrieves all the results into a single object +func (c AuthorizationsClient) AuthorizationListByAuthorizationProviderComplete(ctx context.Context, id AuthorizationProviderId, options AuthorizationListByAuthorizationProviderOperationOptions) (AuthorizationListByAuthorizationProviderCompleteResult, error) { + return c.AuthorizationListByAuthorizationProviderCompleteMatchingPredicate(ctx, id, options, AuthorizationContractOperationPredicate{}) +} + +// AuthorizationListByAuthorizationProviderCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AuthorizationsClient) AuthorizationListByAuthorizationProviderCompleteMatchingPredicate(ctx context.Context, id AuthorizationProviderId, options AuthorizationListByAuthorizationProviderOperationOptions, predicate AuthorizationContractOperationPredicate) (result AuthorizationListByAuthorizationProviderCompleteResult, err error) { + items := make([]AuthorizationContract, 0) + + resp, err := c.AuthorizationListByAuthorizationProvider(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = AuthorizationListByAuthorizationProviderCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizations/method_authorizationlistbyauthorizationprovider_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizations/method_authorizationlistbyauthorizationprovider_autorest.go deleted file mode 100644 index cbb34bd8d01..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizations/method_authorizationlistbyauthorizationprovider_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package authorizations - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AuthorizationListByAuthorizationProviderOperationResponse struct { - HttpResponse *http.Response - Model *[]AuthorizationContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (AuthorizationListByAuthorizationProviderOperationResponse, error) -} - -type AuthorizationListByAuthorizationProviderCompleteResult struct { - Items []AuthorizationContract -} - -func (r AuthorizationListByAuthorizationProviderOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r AuthorizationListByAuthorizationProviderOperationResponse) LoadMore(ctx context.Context) (resp AuthorizationListByAuthorizationProviderOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type AuthorizationListByAuthorizationProviderOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultAuthorizationListByAuthorizationProviderOperationOptions() AuthorizationListByAuthorizationProviderOperationOptions { - return AuthorizationListByAuthorizationProviderOperationOptions{} -} - -func (o AuthorizationListByAuthorizationProviderOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o AuthorizationListByAuthorizationProviderOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// AuthorizationListByAuthorizationProvider ... -func (c AuthorizationsClient) AuthorizationListByAuthorizationProvider(ctx context.Context, id AuthorizationProviderId, options AuthorizationListByAuthorizationProviderOperationOptions) (resp AuthorizationListByAuthorizationProviderOperationResponse, err error) { - req, err := c.preparerForAuthorizationListByAuthorizationProvider(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "AuthorizationListByAuthorizationProvider", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "AuthorizationListByAuthorizationProvider", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForAuthorizationListByAuthorizationProvider(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "AuthorizationListByAuthorizationProvider", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForAuthorizationListByAuthorizationProvider prepares the AuthorizationListByAuthorizationProvider request. -func (c AuthorizationsClient) preparerForAuthorizationListByAuthorizationProvider(ctx context.Context, id AuthorizationProviderId, options AuthorizationListByAuthorizationProviderOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/authorizations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForAuthorizationListByAuthorizationProviderWithNextLink prepares the AuthorizationListByAuthorizationProvider request with the given nextLink token. -func (c AuthorizationsClient) preparerForAuthorizationListByAuthorizationProviderWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAuthorizationListByAuthorizationProvider handles the response to the AuthorizationListByAuthorizationProvider request. The method always -// closes the http.Response Body. -func (c AuthorizationsClient) responderForAuthorizationListByAuthorizationProvider(resp *http.Response) (result AuthorizationListByAuthorizationProviderOperationResponse, err error) { - type page struct { - Values []AuthorizationContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result AuthorizationListByAuthorizationProviderOperationResponse, err error) { - req, err := c.preparerForAuthorizationListByAuthorizationProviderWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "AuthorizationListByAuthorizationProvider", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "AuthorizationListByAuthorizationProvider", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAuthorizationListByAuthorizationProvider(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "AuthorizationListByAuthorizationProvider", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// AuthorizationListByAuthorizationProviderComplete retrieves all of the results into a single object -func (c AuthorizationsClient) AuthorizationListByAuthorizationProviderComplete(ctx context.Context, id AuthorizationProviderId, options AuthorizationListByAuthorizationProviderOperationOptions) (AuthorizationListByAuthorizationProviderCompleteResult, error) { - return c.AuthorizationListByAuthorizationProviderCompleteMatchingPredicate(ctx, id, options, AuthorizationContractOperationPredicate{}) -} - -// AuthorizationListByAuthorizationProviderCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AuthorizationsClient) AuthorizationListByAuthorizationProviderCompleteMatchingPredicate(ctx context.Context, id AuthorizationProviderId, options AuthorizationListByAuthorizationProviderOperationOptions, predicate AuthorizationContractOperationPredicate) (resp AuthorizationListByAuthorizationProviderCompleteResult, err error) { - items := make([]AuthorizationContract, 0) - - page, err := c.AuthorizationListByAuthorizationProvider(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := AuthorizationListByAuthorizationProviderCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/client.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/client.go index a0b4979583f..7ce712f4744 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationserver/client.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationserver/client.go @@ -1,18 +1,26 @@ package authorizationserver -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type AuthorizationServerClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAuthorizationServerClientWithBaseURI(endpoint string) AuthorizationServerClient { - return AuthorizationServerClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAuthorizationServerClientWithBaseURI(api sdkEnv.Api) (*AuthorizationServerClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "authorizationserver", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AuthorizationServerClient: %+v", err) } + + return &AuthorizationServerClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/constants.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/constants.go index e04f6ee15bd..135527703de 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationserver/constants.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationserver/constants.go @@ -1,6 +1,10 @@ package authorizationserver -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -31,6 +35,19 @@ func PossibleValuesForAuthorizationMethod() []string { } } +func (s *AuthorizationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAuthorizationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAuthorizationMethod(input string) (*AuthorizationMethod, error) { vals := map[string]AuthorizationMethod{ "delete": AuthorizationMethodDELETE, @@ -65,6 +82,19 @@ func PossibleValuesForBearerTokenSendingMethod() []string { } } +func (s *BearerTokenSendingMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethod(input string) (*BearerTokenSendingMethod, error) { vals := map[string]BearerTokenSendingMethod{ "authorizationheader": BearerTokenSendingMethodAuthorizationHeader, @@ -93,6 +123,19 @@ func PossibleValuesForClientAuthenticationMethod() []string { } } +func (s *ClientAuthenticationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClientAuthenticationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseClientAuthenticationMethod(input string) (*ClientAuthenticationMethod, error) { vals := map[string]ClientAuthenticationMethod{ "basic": ClientAuthenticationMethodBasic, @@ -125,6 +168,19 @@ func PossibleValuesForGrantType() []string { } } +func (s *GrantType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGrantType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGrantType(input string) (*GrantType, error) { vals := map[string]GrantType{ "authorizationcode": GrantTypeAuthorizationCode, diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_createorupdate.go new file mode 100644 index 00000000000..9c56c38cce1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_createorupdate.go @@ -0,0 +1,85 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c AuthorizationServerClient) CreateOrUpdate(ctx context.Context, id AuthorizationServerId, input AuthorizationServerContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_createorupdate_autorest.go deleted file mode 100644 index 60a97c7646d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package authorizationserver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationServerContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c AuthorizationServerClient) CreateOrUpdate(ctx context.Context, id AuthorizationServerId, input AuthorizationServerContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c AuthorizationServerClient) preparerForCreateOrUpdate(ctx context.Context, id AuthorizationServerId, input AuthorizationServerContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_delete.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_delete.go new file mode 100644 index 00000000000..ad1674315f1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_delete.go @@ -0,0 +1,76 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c AuthorizationServerClient) Delete(ctx context.Context, id AuthorizationServerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_delete_autorest.go deleted file mode 100644 index d7cc9dff660..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package authorizationserver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c AuthorizationServerClient) Delete(ctx context.Context, id AuthorizationServerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c AuthorizationServerClient) preparerForDelete(ctx context.Context, id AuthorizationServerId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_get.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_get.go new file mode 100644 index 00000000000..35bc15341b9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_get.go @@ -0,0 +1,51 @@ +package authorizationserver + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerContract +} + +// Get ... +func (c AuthorizationServerClient) Get(ctx context.Context, id AuthorizationServerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_get_autorest.go deleted file mode 100644 index 4f6ec3d9ba4..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package authorizationserver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationServerContract -} - -// Get ... -func (c AuthorizationServerClient) Get(ctx context.Context, id AuthorizationServerId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AuthorizationServerClient) preparerForGet(ctx context.Context, id AuthorizationServerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_getentitytag.go new file mode 100644 index 00000000000..4eb7f0abe34 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_getentitytag.go @@ -0,0 +1,46 @@ +package authorizationserver + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c AuthorizationServerClient) GetEntityTag(ctx context.Context, id AuthorizationServerId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_getentitytag_autorest.go deleted file mode 100644 index 6ca77e2c3d7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package authorizationserver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c AuthorizationServerClient) GetEntityTag(ctx context.Context, id AuthorizationServerId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c AuthorizationServerClient) preparerForGetEntityTag(ctx context.Context, id AuthorizationServerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listbyservice.go new file mode 100644 index 00000000000..17a21580a93 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listbyservice.go @@ -0,0 +1,125 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AuthorizationServerContract +} + +type ListByServiceCompleteResult struct { + Items []AuthorizationServerContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c AuthorizationServerClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/authorizationServers", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AuthorizationServerContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c AuthorizationServerClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AuthorizationServerContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AuthorizationServerClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AuthorizationServerContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]AuthorizationServerContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listbyservice_autorest.go deleted file mode 100644 index 7d3c48d2ad9..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package authorizationserver - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]AuthorizationServerContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []AuthorizationServerContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c AuthorizationServerClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c AuthorizationServerClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/authorizationServers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c AuthorizationServerClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []AuthorizationServerContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c AuthorizationServerClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AuthorizationServerContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AuthorizationServerClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AuthorizationServerContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]AuthorizationServerContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listsecrets.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listsecrets.go new file mode 100644 index 00000000000..e65f9582795 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listsecrets.go @@ -0,0 +1,52 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerSecretsContract +} + +// ListSecrets ... +func (c AuthorizationServerClient) ListSecrets(ctx context.Context, id AuthorizationServerId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listsecrets_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listsecrets_autorest.go deleted file mode 100644 index 246b21f3eb2..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package authorizationserver - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationServerSecretsContract -} - -// ListSecrets ... -func (c AuthorizationServerClient) ListSecrets(ctx context.Context, id AuthorizationServerId) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c AuthorizationServerClient) preparerForListSecrets(ctx context.Context, id AuthorizationServerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_update.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_update.go new file mode 100644 index 00000000000..d92ea160b6f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_update.go @@ -0,0 +1,84 @@ +package authorizationserver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AuthorizationServerContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c AuthorizationServerClient) Update(ctx context.Context, id AuthorizationServerId, input AuthorizationServerUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/method_update_autorest.go deleted file mode 100644 index 7bb82b54e5f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/authorizationserver/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package authorizationserver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *AuthorizationServerContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c AuthorizationServerClient) Update(ctx context.Context, id AuthorizationServerId, input AuthorizationServerUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationserver.AuthorizationServerClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c AuthorizationServerClient) preparerForUpdate(ctx context.Context, id AuthorizationServerId, input AuthorizationServerUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c AuthorizationServerClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/backend/client.go b/resource-manager/apimanagement/2022-08-01/backend/client.go index 6bfb57d9510..28f6670b70d 100644 --- a/resource-manager/apimanagement/2022-08-01/backend/client.go +++ b/resource-manager/apimanagement/2022-08-01/backend/client.go @@ -1,18 +1,26 @@ package backend -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type BackendClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewBackendClientWithBaseURI(endpoint string) BackendClient { - return BackendClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewBackendClientWithBaseURI(api sdkEnv.Api) (*BackendClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "backend", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating BackendClient: %+v", err) } + + return &BackendClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/backend/constants.go b/resource-manager/apimanagement/2022-08-01/backend/constants.go index ea964ece6fb..fe71e64cb91 100644 --- a/resource-manager/apimanagement/2022-08-01/backend/constants.go +++ b/resource-manager/apimanagement/2022-08-01/backend/constants.go @@ -1,6 +1,10 @@ package backend -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForBackendProtocol() []string { } } +func (s *BackendProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBackendProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBackendProtocol(input string) (*BackendProtocol, error) { vals := map[string]BackendProtocol{ "http": BackendProtocolHTTP, diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/backend/method_createorupdate.go new file mode 100644 index 00000000000..c999d10c186 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/backend/method_createorupdate.go @@ -0,0 +1,85 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackendContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c BackendClient) CreateOrUpdate(ctx context.Context, id BackendId, input BackendContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/backend/method_createorupdate_autorest.go deleted file mode 100644 index 75dec17d56d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/backend/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package backend - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *BackendContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c BackendClient) CreateOrUpdate(ctx context.Context, id BackendId, input BackendContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c BackendClient) preparerForCreateOrUpdate(ctx context.Context, id BackendId, input BackendContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_delete.go b/resource-manager/apimanagement/2022-08-01/backend/method_delete.go new file mode 100644 index 00000000000..a8e6a5ab37b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/backend/method_delete.go @@ -0,0 +1,76 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c BackendClient) Delete(ctx context.Context, id BackendId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/backend/method_delete_autorest.go deleted file mode 100644 index c1c6dc95ec7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/backend/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package backend - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c BackendClient) Delete(ctx context.Context, id BackendId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c BackendClient) preparerForDelete(ctx context.Context, id BackendId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_get.go b/resource-manager/apimanagement/2022-08-01/backend/method_get.go new file mode 100644 index 00000000000..2af01eaec6f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/backend/method_get.go @@ -0,0 +1,51 @@ +package backend + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackendContract +} + +// Get ... +func (c BackendClient) Get(ctx context.Context, id BackendId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/backend/method_get_autorest.go deleted file mode 100644 index ad57ec2ac1f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/backend/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package backend - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *BackendContract -} - -// Get ... -func (c BackendClient) Get(ctx context.Context, id BackendId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c BackendClient) preparerForGet(ctx context.Context, id BackendId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/backend/method_getentitytag.go new file mode 100644 index 00000000000..6bff18fa57d --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/backend/method_getentitytag.go @@ -0,0 +1,46 @@ +package backend + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c BackendClient) GetEntityTag(ctx context.Context, id BackendId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/backend/method_getentitytag_autorest.go deleted file mode 100644 index 9d500b6b320..00000000000 --- a/resource-manager/apimanagement/2022-08-01/backend/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package backend - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c BackendClient) GetEntityTag(ctx context.Context, id BackendId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c BackendClient) preparerForGetEntityTag(ctx context.Context, id BackendId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/backend/method_listbyservice.go new file mode 100644 index 00000000000..1c0cb8aab20 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/backend/method_listbyservice.go @@ -0,0 +1,125 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]BackendContract +} + +type ListByServiceCompleteResult struct { + Items []BackendContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c BackendClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/backends", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]BackendContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c BackendClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, BackendContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c BackendClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate BackendContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]BackendContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/backend/method_listbyservice_autorest.go deleted file mode 100644 index d2c7a50b168..00000000000 --- a/resource-manager/apimanagement/2022-08-01/backend/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package backend - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]BackendContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []BackendContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c BackendClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c BackendClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/backends", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c BackendClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []BackendContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c BackendClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, BackendContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c BackendClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate BackendContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]BackendContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_update.go b/resource-manager/apimanagement/2022-08-01/backend/method_update.go new file mode 100644 index 00000000000..16ad3a5f0f9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/backend/method_update.go @@ -0,0 +1,84 @@ +package backend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackendContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c BackendClient) Update(ctx context.Context, id BackendId, input BackendUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/backend/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/backend/method_update_autorest.go deleted file mode 100644 index 072e94d0e27..00000000000 --- a/resource-manager/apimanagement/2022-08-01/backend/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package backend - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *BackendContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c BackendClient) Update(ctx context.Context, id BackendId, input BackendUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backend.BackendClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c BackendClient) preparerForUpdate(ctx context.Context, id BackendId, input BackendUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c BackendClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/backendreconnect/client.go b/resource-manager/apimanagement/2022-08-01/backendreconnect/client.go index f4fd38d283c..b7bfc874b41 100644 --- a/resource-manager/apimanagement/2022-08-01/backendreconnect/client.go +++ b/resource-manager/apimanagement/2022-08-01/backendreconnect/client.go @@ -1,18 +1,26 @@ package backendreconnect -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type BackendReconnectClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewBackendReconnectClientWithBaseURI(endpoint string) BackendReconnectClient { - return BackendReconnectClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewBackendReconnectClientWithBaseURI(api sdkEnv.Api) (*BackendReconnectClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "backendreconnect", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating BackendReconnectClient: %+v", err) } + + return &BackendReconnectClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/backendreconnect/method_backendreconnect.go b/resource-manager/apimanagement/2022-08-01/backendreconnect/method_backendreconnect.go new file mode 100644 index 00000000000..d75c5992fac --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/backendreconnect/method_backendreconnect.go @@ -0,0 +1,51 @@ +package backendreconnect + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendReconnectOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// BackendReconnect ... +func (c BackendReconnectClient) BackendReconnect(ctx context.Context, id BackendId, input BackendReconnectContract) (result BackendReconnectOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reconnect", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/backendreconnect/method_backendreconnect_autorest.go b/resource-manager/apimanagement/2022-08-01/backendreconnect/method_backendreconnect_autorest.go deleted file mode 100644 index ae533c15f31..00000000000 --- a/resource-manager/apimanagement/2022-08-01/backendreconnect/method_backendreconnect_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package backendreconnect - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BackendReconnectOperationResponse struct { - HttpResponse *http.Response -} - -// BackendReconnect ... -func (c BackendReconnectClient) BackendReconnect(ctx context.Context, id BackendId, input BackendReconnectContract) (result BackendReconnectOperationResponse, err error) { - req, err := c.preparerForBackendReconnect(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "backendreconnect.BackendReconnectClient", "BackendReconnect", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backendreconnect.BackendReconnectClient", "BackendReconnect", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForBackendReconnect(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backendreconnect.BackendReconnectClient", "BackendReconnect", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForBackendReconnect prepares the BackendReconnect request. -func (c BackendReconnectClient) preparerForBackendReconnect(ctx context.Context, id BackendId, input BackendReconnectContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/reconnect", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForBackendReconnect handles the response to the BackendReconnect request. The method always -// closes the http.Response Body. -func (c BackendReconnectClient) responderForBackendReconnect(resp *http.Response) (result BackendReconnectOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusAccepted), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/cache/client.go b/resource-manager/apimanagement/2022-08-01/cache/client.go index 1d9fa5007ce..204643d622f 100644 --- a/resource-manager/apimanagement/2022-08-01/cache/client.go +++ b/resource-manager/apimanagement/2022-08-01/cache/client.go @@ -1,18 +1,26 @@ package cache -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type CacheClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewCacheClientWithBaseURI(endpoint string) CacheClient { - return CacheClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewCacheClientWithBaseURI(api sdkEnv.Api) (*CacheClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "cache", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CacheClient: %+v", err) } + + return &CacheClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/cache/method_createorupdate.go new file mode 100644 index 00000000000..ae370ba6bb9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/cache/method_createorupdate.go @@ -0,0 +1,85 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CacheContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c CacheClient) CreateOrUpdate(ctx context.Context, id CacheId, input CacheContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/cache/method_createorupdate_autorest.go deleted file mode 100644 index 157b734abcf..00000000000 --- a/resource-manager/apimanagement/2022-08-01/cache/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package cache - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *CacheContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c CacheClient) CreateOrUpdate(ctx context.Context, id CacheId, input CacheContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c CacheClient) preparerForCreateOrUpdate(ctx context.Context, id CacheId, input CacheContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_delete.go b/resource-manager/apimanagement/2022-08-01/cache/method_delete.go new file mode 100644 index 00000000000..4409902bb76 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/cache/method_delete.go @@ -0,0 +1,76 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c CacheClient) Delete(ctx context.Context, id CacheId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/cache/method_delete_autorest.go deleted file mode 100644 index d31981601b3..00000000000 --- a/resource-manager/apimanagement/2022-08-01/cache/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package cache - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c CacheClient) Delete(ctx context.Context, id CacheId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c CacheClient) preparerForDelete(ctx context.Context, id CacheId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_get.go b/resource-manager/apimanagement/2022-08-01/cache/method_get.go new file mode 100644 index 00000000000..8108214f781 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/cache/method_get.go @@ -0,0 +1,51 @@ +package cache + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CacheContract +} + +// Get ... +func (c CacheClient) Get(ctx context.Context, id CacheId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/cache/method_get_autorest.go deleted file mode 100644 index 3e001237bb8..00000000000 --- a/resource-manager/apimanagement/2022-08-01/cache/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package cache - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *CacheContract -} - -// Get ... -func (c CacheClient) Get(ctx context.Context, id CacheId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c CacheClient) preparerForGet(ctx context.Context, id CacheId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/cache/method_getentitytag.go new file mode 100644 index 00000000000..a221bde18d1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/cache/method_getentitytag.go @@ -0,0 +1,46 @@ +package cache + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c CacheClient) GetEntityTag(ctx context.Context, id CacheId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/cache/method_getentitytag_autorest.go deleted file mode 100644 index 5ac7d004001..00000000000 --- a/resource-manager/apimanagement/2022-08-01/cache/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package cache - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c CacheClient) GetEntityTag(ctx context.Context, id CacheId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c CacheClient) preparerForGetEntityTag(ctx context.Context, id CacheId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/cache/method_listbyservice.go new file mode 100644 index 00000000000..748d4374751 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/cache/method_listbyservice.go @@ -0,0 +1,121 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CacheContract +} + +type ListByServiceCompleteResult struct { + Items []CacheContract +} + +type ListByServiceOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c CacheClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/caches", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CacheContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c CacheClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, CacheContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CacheClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate CacheContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]CacheContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/cache/method_listbyservice_autorest.go deleted file mode 100644 index 0bf37f6599c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/cache/method_listbyservice_autorest.go +++ /dev/null @@ -1,220 +0,0 @@ -package cache - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]CacheContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []CacheContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c CacheClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c CacheClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/caches", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c CacheClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []CacheContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c CacheClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, CacheContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c CacheClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate CacheContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]CacheContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_update.go b/resource-manager/apimanagement/2022-08-01/cache/method_update.go new file mode 100644 index 00000000000..3aca9c35b36 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/cache/method_update.go @@ -0,0 +1,84 @@ +package cache + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CacheContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c CacheClient) Update(ctx context.Context, id CacheId, input CacheUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/cache/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/cache/method_update_autorest.go deleted file mode 100644 index 77f9a54c40b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/cache/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package cache - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *CacheContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c CacheClient) Update(ctx context.Context, id CacheId, input CacheUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cache.CacheClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c CacheClient) preparerForUpdate(ctx context.Context, id CacheId, input CacheUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c CacheClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/client.go b/resource-manager/apimanagement/2022-08-01/certificate/client.go index f304bfc665d..9caad657c9b 100644 --- a/resource-manager/apimanagement/2022-08-01/certificate/client.go +++ b/resource-manager/apimanagement/2022-08-01/certificate/client.go @@ -1,18 +1,26 @@ package certificate -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type CertificateClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewCertificateClientWithBaseURI(endpoint string) CertificateClient { - return CertificateClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewCertificateClientWithBaseURI(api sdkEnv.Api) (*CertificateClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "certificate", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CertificateClient: %+v", err) } + + return &CertificateClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/certificate/method_createorupdate.go new file mode 100644 index 00000000000..93fbccd7109 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/certificate/method_createorupdate.go @@ -0,0 +1,85 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CertificateContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c CertificateClient) CreateOrUpdate(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/certificate/method_createorupdate_autorest.go deleted file mode 100644 index 3f9fa70c148..00000000000 --- a/resource-manager/apimanagement/2022-08-01/certificate/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package certificate - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *CertificateContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c CertificateClient) CreateOrUpdate(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c CertificateClient) preparerForCreateOrUpdate(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_delete.go b/resource-manager/apimanagement/2022-08-01/certificate/method_delete.go new file mode 100644 index 00000000000..18be0e732de --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/certificate/method_delete.go @@ -0,0 +1,76 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c CertificateClient) Delete(ctx context.Context, id CertificateId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/certificate/method_delete_autorest.go deleted file mode 100644 index c5682ce3425..00000000000 --- a/resource-manager/apimanagement/2022-08-01/certificate/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package certificate - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c CertificateClient) Delete(ctx context.Context, id CertificateId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c CertificateClient) preparerForDelete(ctx context.Context, id CertificateId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_get.go b/resource-manager/apimanagement/2022-08-01/certificate/method_get.go new file mode 100644 index 00000000000..27e5fbafdfa --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/certificate/method_get.go @@ -0,0 +1,51 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CertificateContract +} + +// Get ... +func (c CertificateClient) Get(ctx context.Context, id CertificateId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/certificate/method_get_autorest.go deleted file mode 100644 index 9e737922fb6..00000000000 --- a/resource-manager/apimanagement/2022-08-01/certificate/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package certificate - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *CertificateContract -} - -// Get ... -func (c CertificateClient) Get(ctx context.Context, id CertificateId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c CertificateClient) preparerForGet(ctx context.Context, id CertificateId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/certificate/method_getentitytag.go new file mode 100644 index 00000000000..bcbd65b8f9b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/certificate/method_getentitytag.go @@ -0,0 +1,46 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c CertificateClient) GetEntityTag(ctx context.Context, id CertificateId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/certificate/method_getentitytag_autorest.go deleted file mode 100644 index 767706d23d9..00000000000 --- a/resource-manager/apimanagement/2022-08-01/certificate/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package certificate - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c CertificateClient) GetEntityTag(ctx context.Context, id CertificateId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c CertificateClient) preparerForGetEntityTag(ctx context.Context, id CertificateId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/certificate/method_listbyservice.go new file mode 100644 index 00000000000..cf5649185fc --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/certificate/method_listbyservice.go @@ -0,0 +1,129 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CertificateContract +} + +type ListByServiceCompleteResult struct { + Items []CertificateContract +} + +type ListByServiceOperationOptions struct { + Filter *string + IsKeyVaultRefreshFailed *bool + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IsKeyVaultRefreshFailed != nil { + out.Append("isKeyVaultRefreshFailed", fmt.Sprintf("%v", *o.IsKeyVaultRefreshFailed)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c CertificateClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/certificates", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CertificateContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c CertificateClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, CertificateContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CertificateClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate CertificateContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]CertificateContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/certificate/method_listbyservice_autorest.go deleted file mode 100644 index b7ec6fe5728..00000000000 --- a/resource-manager/apimanagement/2022-08-01/certificate/method_listbyservice_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package certificate - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]CertificateContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []CertificateContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - IsKeyVaultRefreshFailed *bool - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.IsKeyVaultRefreshFailed != nil { - out["isKeyVaultRefreshFailed"] = *o.IsKeyVaultRefreshFailed - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c CertificateClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c CertificateClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/certificates", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c CertificateClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []CertificateContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c CertificateClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, CertificateContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c CertificateClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate CertificateContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]CertificateContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_refreshsecret.go b/resource-manager/apimanagement/2022-08-01/certificate/method_refreshsecret.go new file mode 100644 index 00000000000..8c7aaf79162 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/certificate/method_refreshsecret.go @@ -0,0 +1,52 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RefreshSecretOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CertificateContract +} + +// RefreshSecret ... +func (c CertificateClient) RefreshSecret(ctx context.Context, id CertificateId) (result RefreshSecretOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/refreshSecret", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/certificate/method_refreshsecret_autorest.go b/resource-manager/apimanagement/2022-08-01/certificate/method_refreshsecret_autorest.go deleted file mode 100644 index 8202c39a9c5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/certificate/method_refreshsecret_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package certificate - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RefreshSecretOperationResponse struct { - HttpResponse *http.Response - Model *CertificateContract -} - -// RefreshSecret ... -func (c CertificateClient) RefreshSecret(ctx context.Context, id CertificateId) (result RefreshSecretOperationResponse, err error) { - req, err := c.preparerForRefreshSecret(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "RefreshSecret", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "RefreshSecret", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRefreshSecret(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "RefreshSecret", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRefreshSecret prepares the RefreshSecret request. -func (c CertificateClient) preparerForRefreshSecret(ctx context.Context, id CertificateId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/refreshSecret", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRefreshSecret handles the response to the RefreshSecret request. The method always -// closes the http.Response Body. -func (c CertificateClient) responderForRefreshSecret(resp *http.Response) (result RefreshSecretOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/client.go b/resource-manager/apimanagement/2022-08-01/client.go index ac7d3b35acd..f46deca1c6f 100644 --- a/resource-manager/apimanagement/2022-08-01/client.go +++ b/resource-manager/apimanagement/2022-08-01/client.go @@ -4,7 +4,8 @@ package v2022_08_01 // Licensed under the MIT License. See NOTICE.txt in the project root for license information. import ( - "github.com/Azure/go-autorest/autorest" + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2022-08-01/api" "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2022-08-01/apidiagnostic" "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2022-08-01/apiissue" @@ -106,6 +107,8 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2022-08-01/users" "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2022-08-01/usersubscription" "github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2022-08-01/usertoken" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -212,412 +215,714 @@ type Client struct { Users *users.UsersClient } -func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + apiClient, err := api.NewApiClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Api client: %+v", err) + } + configureFunc(apiClient.Client) - apiClient := api.NewApiClientWithBaseURI(endpoint) - configureAuthFunc(&apiClient.Client) + apiDiagnosticClient, err := apidiagnostic.NewApiDiagnosticClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiDiagnostic client: %+v", err) + } + configureFunc(apiDiagnosticClient.Client) - apiDiagnosticClient := apidiagnostic.NewApiDiagnosticClientWithBaseURI(endpoint) - configureAuthFunc(&apiDiagnosticClient.Client) + apiIssueAttachmentClient, err := apiissueattachment.NewApiIssueAttachmentClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiIssueAttachment client: %+v", err) + } + configureFunc(apiIssueAttachmentClient.Client) - apiIssueAttachmentClient := apiissueattachment.NewApiIssueAttachmentClientWithBaseURI(endpoint) - configureAuthFunc(&apiIssueAttachmentClient.Client) + apiIssueClient, err := apiissue.NewApiIssueClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiIssue client: %+v", err) + } + configureFunc(apiIssueClient.Client) - apiIssueClient := apiissue.NewApiIssueClientWithBaseURI(endpoint) - configureAuthFunc(&apiIssueClient.Client) + apiIssueCommentClient, err := apiissuecomment.NewApiIssueCommentClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiIssueComment client: %+v", err) + } + configureFunc(apiIssueCommentClient.Client) - apiIssueCommentClient := apiissuecomment.NewApiIssueCommentClientWithBaseURI(endpoint) - configureAuthFunc(&apiIssueCommentClient.Client) + apiManagementServiceClient, err := apimanagementservice.NewApiManagementServiceClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiManagementService client: %+v", err) + } + configureFunc(apiManagementServiceClient.Client) - apiManagementServiceClient := apimanagementservice.NewApiManagementServiceClientWithBaseURI(endpoint) - configureAuthFunc(&apiManagementServiceClient.Client) + apiManagementServiceSkusClient, err := apimanagementserviceskus.NewApiManagementServiceSkusClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiManagementServiceSkus client: %+v", err) + } + configureFunc(apiManagementServiceSkusClient.Client) - apiManagementServiceSkusClient := apimanagementserviceskus.NewApiManagementServiceSkusClientWithBaseURI(endpoint) - configureAuthFunc(&apiManagementServiceSkusClient.Client) + apiOperationClient, err := apioperation.NewApiOperationClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiOperation client: %+v", err) + } + configureFunc(apiOperationClient.Client) - apiOperationClient := apioperation.NewApiOperationClientWithBaseURI(endpoint) - configureAuthFunc(&apiOperationClient.Client) + apiOperationPolicyClient, err := apioperationpolicy.NewApiOperationPolicyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiOperationPolicy client: %+v", err) + } + configureFunc(apiOperationPolicyClient.Client) - apiOperationPolicyClient := apioperationpolicy.NewApiOperationPolicyClientWithBaseURI(endpoint) - configureAuthFunc(&apiOperationPolicyClient.Client) + apiOperationTagClient, err := apioperationtag.NewApiOperationTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiOperationTag client: %+v", err) + } + configureFunc(apiOperationTagClient.Client) - apiOperationTagClient := apioperationtag.NewApiOperationTagClientWithBaseURI(endpoint) - configureAuthFunc(&apiOperationTagClient.Client) + apiOperationsByTagClient, err := apioperationsbytag.NewApiOperationsByTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiOperationsByTag client: %+v", err) + } + configureFunc(apiOperationsByTagClient.Client) - apiOperationsByTagClient := apioperationsbytag.NewApiOperationsByTagClientWithBaseURI(endpoint) - configureAuthFunc(&apiOperationsByTagClient.Client) + apiPolicyClient, err := apipolicy.NewApiPolicyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiPolicy client: %+v", err) + } + configureFunc(apiPolicyClient.Client) - apiPolicyClient := apipolicy.NewApiPolicyClientWithBaseURI(endpoint) - configureAuthFunc(&apiPolicyClient.Client) + apiProductClient, err := apiproduct.NewApiProductClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiProduct client: %+v", err) + } + configureFunc(apiProductClient.Client) - apiProductClient := apiproduct.NewApiProductClientWithBaseURI(endpoint) - configureAuthFunc(&apiProductClient.Client) + apiReleaseClient, err := apirelease.NewApiReleaseClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiRelease client: %+v", err) + } + configureFunc(apiReleaseClient.Client) - apiReleaseClient := apirelease.NewApiReleaseClientWithBaseURI(endpoint) - configureAuthFunc(&apiReleaseClient.Client) + apiRevisionClient, err := apirevision.NewApiRevisionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiRevision client: %+v", err) + } + configureFunc(apiRevisionClient.Client) - apiRevisionClient := apirevision.NewApiRevisionClientWithBaseURI(endpoint) - configureAuthFunc(&apiRevisionClient.Client) + apiSchemaClient, err := apischema.NewApiSchemaClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiSchema client: %+v", err) + } + configureFunc(apiSchemaClient.Client) - apiSchemaClient := apischema.NewApiSchemaClientWithBaseURI(endpoint) - configureAuthFunc(&apiSchemaClient.Client) + apiTagClient, err := apitag.NewApiTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiTag client: %+v", err) + } + configureFunc(apiTagClient.Client) - apiTagClient := apitag.NewApiTagClientWithBaseURI(endpoint) - configureAuthFunc(&apiTagClient.Client) + apiTagDescriptionClient, err := apitagdescription.NewApiTagDescriptionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiTagDescription client: %+v", err) + } + configureFunc(apiTagDescriptionClient.Client) - apiTagDescriptionClient := apitagdescription.NewApiTagDescriptionClientWithBaseURI(endpoint) - configureAuthFunc(&apiTagDescriptionClient.Client) + apiVersionSetClient, err := apiversionset.NewApiVersionSetClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiVersionSet client: %+v", err) + } + configureFunc(apiVersionSetClient.Client) - apiVersionSetClient := apiversionset.NewApiVersionSetClientWithBaseURI(endpoint) - configureAuthFunc(&apiVersionSetClient.Client) + apiVersionSetsClient, err := apiversionsets.NewApiVersionSetsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiVersionSets client: %+v", err) + } + configureFunc(apiVersionSetsClient.Client) - apiVersionSetsClient := apiversionsets.NewApiVersionSetsClientWithBaseURI(endpoint) - configureAuthFunc(&apiVersionSetsClient.Client) + apiWikiClient, err := apiwiki.NewApiWikiClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApiWiki client: %+v", err) + } + configureFunc(apiWikiClient.Client) - apiWikiClient := apiwiki.NewApiWikiClientWithBaseURI(endpoint) - configureAuthFunc(&apiWikiClient.Client) + apisByTagClient, err := apisbytag.NewApisByTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ApisByTag client: %+v", err) + } + configureFunc(apisByTagClient.Client) - apisByTagClient := apisbytag.NewApisByTagClientWithBaseURI(endpoint) - configureAuthFunc(&apisByTagClient.Client) + authorizationAccessPolicyClient, err := authorizationaccesspolicy.NewAuthorizationAccessPolicyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building AuthorizationAccessPolicy client: %+v", err) + } + configureFunc(authorizationAccessPolicyClient.Client) - authorizationAccessPolicyClient := authorizationaccesspolicy.NewAuthorizationAccessPolicyClientWithBaseURI(endpoint) - configureAuthFunc(&authorizationAccessPolicyClient.Client) + authorizationClient, err := authorization.NewAuthorizationClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Authorization client: %+v", err) + } + configureFunc(authorizationClient.Client) - authorizationClient := authorization.NewAuthorizationClientWithBaseURI(endpoint) - configureAuthFunc(&authorizationClient.Client) + authorizationConfirmConsentCodeClient, err := authorizationconfirmconsentcode.NewAuthorizationConfirmConsentCodeClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building AuthorizationConfirmConsentCode client: %+v", err) + } + configureFunc(authorizationConfirmConsentCodeClient.Client) - authorizationConfirmConsentCodeClient := authorizationconfirmconsentcode.NewAuthorizationConfirmConsentCodeClientWithBaseURI(endpoint) - configureAuthFunc(&authorizationConfirmConsentCodeClient.Client) + authorizationLoginLinksClient, err := authorizationloginlinks.NewAuthorizationLoginLinksClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building AuthorizationLoginLinks client: %+v", err) + } + configureFunc(authorizationLoginLinksClient.Client) - authorizationLoginLinksClient := authorizationloginlinks.NewAuthorizationLoginLinksClientWithBaseURI(endpoint) - configureAuthFunc(&authorizationLoginLinksClient.Client) + authorizationProviderClient, err := authorizationprovider.NewAuthorizationProviderClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building AuthorizationProvider client: %+v", err) + } + configureFunc(authorizationProviderClient.Client) - authorizationProviderClient := authorizationprovider.NewAuthorizationProviderClientWithBaseURI(endpoint) - configureAuthFunc(&authorizationProviderClient.Client) + authorizationServerClient, err := authorizationserver.NewAuthorizationServerClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building AuthorizationServer client: %+v", err) + } + configureFunc(authorizationServerClient.Client) - authorizationServerClient := authorizationserver.NewAuthorizationServerClientWithBaseURI(endpoint) - configureAuthFunc(&authorizationServerClient.Client) + authorizationsClient, err := authorizations.NewAuthorizationsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Authorizations client: %+v", err) + } + configureFunc(authorizationsClient.Client) - authorizationsClient := authorizations.NewAuthorizationsClientWithBaseURI(endpoint) - configureAuthFunc(&authorizationsClient.Client) + backendClient, err := backend.NewBackendClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Backend client: %+v", err) + } + configureFunc(backendClient.Client) - backendClient := backend.NewBackendClientWithBaseURI(endpoint) - configureAuthFunc(&backendClient.Client) + backendReconnectClient, err := backendreconnect.NewBackendReconnectClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building BackendReconnect client: %+v", err) + } + configureFunc(backendReconnectClient.Client) - backendReconnectClient := backendreconnect.NewBackendReconnectClientWithBaseURI(endpoint) - configureAuthFunc(&backendReconnectClient.Client) + cacheClient, err := cache.NewCacheClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Cache client: %+v", err) + } + configureFunc(cacheClient.Client) - cacheClient := cache.NewCacheClientWithBaseURI(endpoint) - configureAuthFunc(&cacheClient.Client) + certificateClient, err := certificate.NewCertificateClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Certificate client: %+v", err) + } + configureFunc(certificateClient.Client) - certificateClient := certificate.NewCertificateClientWithBaseURI(endpoint) - configureAuthFunc(&certificateClient.Client) + contentTypeClient, err := contenttype.NewContentTypeClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ContentType client: %+v", err) + } + configureFunc(contentTypeClient.Client) - contentTypeClient := contenttype.NewContentTypeClientWithBaseURI(endpoint) - configureAuthFunc(&contentTypeClient.Client) + contentTypeContentItemClient, err := contenttypecontentitem.NewContentTypeContentItemClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ContentTypeContentItem client: %+v", err) + } + configureFunc(contentTypeContentItemClient.Client) - contentTypeContentItemClient := contenttypecontentitem.NewContentTypeContentItemClientWithBaseURI(endpoint) - configureAuthFunc(&contentTypeContentItemClient.Client) + delegationSettingsClient, err := delegationsettings.NewDelegationSettingsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building DelegationSettings client: %+v", err) + } + configureFunc(delegationSettingsClient.Client) - delegationSettingsClient := delegationsettings.NewDelegationSettingsClientWithBaseURI(endpoint) - configureAuthFunc(&delegationSettingsClient.Client) + deletedServiceClient, err := deletedservice.NewDeletedServiceClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building DeletedService client: %+v", err) + } + configureFunc(deletedServiceClient.Client) - deletedServiceClient := deletedservice.NewDeletedServiceClientWithBaseURI(endpoint) - configureAuthFunc(&deletedServiceClient.Client) + diagnosticClient, err := diagnostic.NewDiagnosticClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Diagnostic client: %+v", err) + } + configureFunc(diagnosticClient.Client) - diagnosticClient := diagnostic.NewDiagnosticClientWithBaseURI(endpoint) - configureAuthFunc(&diagnosticClient.Client) + documentationResourceClient, err := documentationresource.NewDocumentationResourceClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building DocumentationResource client: %+v", err) + } + configureFunc(documentationResourceClient.Client) - documentationResourceClient := documentationresource.NewDocumentationResourceClientWithBaseURI(endpoint) - configureAuthFunc(&documentationResourceClient.Client) + emailTemplateClient, err := emailtemplate.NewEmailTemplateClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building EmailTemplate client: %+v", err) + } + configureFunc(emailTemplateClient.Client) - emailTemplateClient := emailtemplate.NewEmailTemplateClientWithBaseURI(endpoint) - configureAuthFunc(&emailTemplateClient.Client) + emailTemplatesClient, err := emailtemplates.NewEmailTemplatesClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building EmailTemplates client: %+v", err) + } + configureFunc(emailTemplatesClient.Client) - emailTemplatesClient := emailtemplates.NewEmailTemplatesClientWithBaseURI(endpoint) - configureAuthFunc(&emailTemplatesClient.Client) + gatewayApiClient, err := gatewayapi.NewGatewayApiClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayApi client: %+v", err) + } + configureFunc(gatewayApiClient.Client) - gatewayApiClient := gatewayapi.NewGatewayApiClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayApiClient.Client) + gatewayCertificateAuthorityClient, err := gatewaycertificateauthority.NewGatewayCertificateAuthorityClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayCertificateAuthority client: %+v", err) + } + configureFunc(gatewayCertificateAuthorityClient.Client) - gatewayCertificateAuthorityClient := gatewaycertificateauthority.NewGatewayCertificateAuthorityClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayCertificateAuthorityClient.Client) + gatewayClient, err := gateway.NewGatewayClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Gateway client: %+v", err) + } + configureFunc(gatewayClient.Client) - gatewayClient := gateway.NewGatewayClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayClient.Client) + gatewayGenerateTokenClient, err := gatewaygeneratetoken.NewGatewayGenerateTokenClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayGenerateToken client: %+v", err) + } + configureFunc(gatewayGenerateTokenClient.Client) - gatewayGenerateTokenClient := gatewaygeneratetoken.NewGatewayGenerateTokenClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayGenerateTokenClient.Client) + gatewayHostnameConfigurationClient, err := gatewayhostnameconfiguration.NewGatewayHostnameConfigurationClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayHostnameConfiguration client: %+v", err) + } + configureFunc(gatewayHostnameConfigurationClient.Client) - gatewayHostnameConfigurationClient := gatewayhostnameconfiguration.NewGatewayHostnameConfigurationClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayHostnameConfigurationClient.Client) + gatewayListKeysClient, err := gatewaylistkeys.NewGatewayListKeysClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayListKeys client: %+v", err) + } + configureFunc(gatewayListKeysClient.Client) - gatewayListKeysClient := gatewaylistkeys.NewGatewayListKeysClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayListKeysClient.Client) + gatewayRegenerateKeyClient, err := gatewayregeneratekey.NewGatewayRegenerateKeyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GatewayRegenerateKey client: %+v", err) + } + configureFunc(gatewayRegenerateKeyClient.Client) - gatewayRegenerateKeyClient := gatewayregeneratekey.NewGatewayRegenerateKeyClientWithBaseURI(endpoint) - configureAuthFunc(&gatewayRegenerateKeyClient.Client) + graphQLApiResolverClient, err := graphqlapiresolver.NewGraphQLApiResolverClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GraphQLApiResolver client: %+v", err) + } + configureFunc(graphQLApiResolverClient.Client) - graphQLApiResolverClient := graphqlapiresolver.NewGraphQLApiResolverClientWithBaseURI(endpoint) - configureAuthFunc(&graphQLApiResolverClient.Client) + graphQLApiResolverPolicyClient, err := graphqlapiresolverpolicy.NewGraphQLApiResolverPolicyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GraphQLApiResolverPolicy client: %+v", err) + } + configureFunc(graphQLApiResolverPolicyClient.Client) - graphQLApiResolverPolicyClient := graphqlapiresolverpolicy.NewGraphQLApiResolverPolicyClientWithBaseURI(endpoint) - configureAuthFunc(&graphQLApiResolverPolicyClient.Client) + groupClient, err := group.NewGroupClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Group client: %+v", err) + } + configureFunc(groupClient.Client) - groupClient := group.NewGroupClientWithBaseURI(endpoint) - configureAuthFunc(&groupClient.Client) + groupUserClient, err := groupuser.NewGroupUserClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building GroupUser client: %+v", err) + } + configureFunc(groupUserClient.Client) - groupUserClient := groupuser.NewGroupUserClientWithBaseURI(endpoint) - configureAuthFunc(&groupUserClient.Client) + identityProviderClient, err := identityprovider.NewIdentityProviderClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building IdentityProvider client: %+v", err) + } + configureFunc(identityProviderClient.Client) - identityProviderClient := identityprovider.NewIdentityProviderClientWithBaseURI(endpoint) - configureAuthFunc(&identityProviderClient.Client) + issueClient, err := issue.NewIssueClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Issue client: %+v", err) + } + configureFunc(issueClient.Client) - issueClient := issue.NewIssueClientWithBaseURI(endpoint) - configureAuthFunc(&issueClient.Client) + loggerClient, err := logger.NewLoggerClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Logger client: %+v", err) + } + configureFunc(loggerClient.Client) - loggerClient := logger.NewLoggerClientWithBaseURI(endpoint) - configureAuthFunc(&loggerClient.Client) + namedValueClient, err := namedvalue.NewNamedValueClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building NamedValue client: %+v", err) + } + configureFunc(namedValueClient.Client) - namedValueClient := namedvalue.NewNamedValueClientWithBaseURI(endpoint) - configureAuthFunc(&namedValueClient.Client) + networkStatusClient, err := networkstatus.NewNetworkStatusClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building NetworkStatus client: %+v", err) + } + configureFunc(networkStatusClient.Client) - networkStatusClient := networkstatus.NewNetworkStatusClientWithBaseURI(endpoint) - configureAuthFunc(&networkStatusClient.Client) + notificationClient, err := notification.NewNotificationClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Notification client: %+v", err) + } + configureFunc(notificationClient.Client) - notificationClient := notification.NewNotificationClientWithBaseURI(endpoint) - configureAuthFunc(¬ificationClient.Client) + notificationRecipientEmailClient, err := notificationrecipientemail.NewNotificationRecipientEmailClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building NotificationRecipientEmail client: %+v", err) + } + configureFunc(notificationRecipientEmailClient.Client) - notificationRecipientEmailClient := notificationrecipientemail.NewNotificationRecipientEmailClientWithBaseURI(endpoint) - configureAuthFunc(¬ificationRecipientEmailClient.Client) + notificationRecipientUserClient, err := notificationrecipientuser.NewNotificationRecipientUserClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building NotificationRecipientUser client: %+v", err) + } + configureFunc(notificationRecipientUserClient.Client) - notificationRecipientUserClient := notificationrecipientuser.NewNotificationRecipientUserClientWithBaseURI(endpoint) - configureAuthFunc(¬ificationRecipientUserClient.Client) + openidConnectProviderClient, err := openidconnectprovider.NewOpenidConnectProviderClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building OpenidConnectProvider client: %+v", err) + } + configureFunc(openidConnectProviderClient.Client) - openidConnectProviderClient := openidconnectprovider.NewOpenidConnectProviderClientWithBaseURI(endpoint) - configureAuthFunc(&openidConnectProviderClient.Client) + outboundNetworkDependenciesEndpointsClient, err := outboundnetworkdependenciesendpoints.NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building OutboundNetworkDependenciesEndpoints client: %+v", err) + } + configureFunc(outboundNetworkDependenciesEndpointsClient.Client) - outboundNetworkDependenciesEndpointsClient := outboundnetworkdependenciesendpoints.NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(endpoint) - configureAuthFunc(&outboundNetworkDependenciesEndpointsClient.Client) + performConnectivityCheckClient, err := performconnectivitycheck.NewPerformConnectivityCheckClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PerformConnectivityCheck client: %+v", err) + } + configureFunc(performConnectivityCheckClient.Client) - performConnectivityCheckClient := performconnectivitycheck.NewPerformConnectivityCheckClientWithBaseURI(endpoint) - configureAuthFunc(&performConnectivityCheckClient.Client) + policyClient, err := policy.NewPolicyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Policy client: %+v", err) + } + configureFunc(policyClient.Client) - policyClient := policy.NewPolicyClientWithBaseURI(endpoint) - configureAuthFunc(&policyClient.Client) + policyDescriptionClient, err := policydescription.NewPolicyDescriptionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PolicyDescription client: %+v", err) + } + configureFunc(policyDescriptionClient.Client) - policyDescriptionClient := policydescription.NewPolicyDescriptionClientWithBaseURI(endpoint) - configureAuthFunc(&policyDescriptionClient.Client) + policyFragmentClient, err := policyfragment.NewPolicyFragmentClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PolicyFragment client: %+v", err) + } + configureFunc(policyFragmentClient.Client) - policyFragmentClient := policyfragment.NewPolicyFragmentClientWithBaseURI(endpoint) - configureAuthFunc(&policyFragmentClient.Client) + portalConfigClient, err := portalconfig.NewPortalConfigClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PortalConfig client: %+v", err) + } + configureFunc(portalConfigClient.Client) - portalConfigClient := portalconfig.NewPortalConfigClientWithBaseURI(endpoint) - configureAuthFunc(&portalConfigClient.Client) + portalRevisionClient, err := portalrevision.NewPortalRevisionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PortalRevision client: %+v", err) + } + configureFunc(portalRevisionClient.Client) - portalRevisionClient := portalrevision.NewPortalRevisionClientWithBaseURI(endpoint) - configureAuthFunc(&portalRevisionClient.Client) + portalSettingsClient, err := portalsettings.NewPortalSettingsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PortalSettings client: %+v", err) + } + configureFunc(portalSettingsClient.Client) - portalSettingsClient := portalsettings.NewPortalSettingsClientWithBaseURI(endpoint) - configureAuthFunc(&portalSettingsClient.Client) + privateEndpointConnectionsClient, err := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building PrivateEndpointConnections client: %+v", err) + } + configureFunc(privateEndpointConnectionsClient.Client) - privateEndpointConnectionsClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(endpoint) - configureAuthFunc(&privateEndpointConnectionsClient.Client) + productApiClient, err := productapi.NewProductApiClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductApi client: %+v", err) + } + configureFunc(productApiClient.Client) - productApiClient := productapi.NewProductApiClientWithBaseURI(endpoint) - configureAuthFunc(&productApiClient.Client) + productClient, err := product.NewProductClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Product client: %+v", err) + } + configureFunc(productClient.Client) - productClient := product.NewProductClientWithBaseURI(endpoint) - configureAuthFunc(&productClient.Client) + productGroupClient, err := productgroup.NewProductGroupClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductGroup client: %+v", err) + } + configureFunc(productGroupClient.Client) - productGroupClient := productgroup.NewProductGroupClientWithBaseURI(endpoint) - configureAuthFunc(&productGroupClient.Client) + productPolicyClient, err := productpolicy.NewProductPolicyClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductPolicy client: %+v", err) + } + configureFunc(productPolicyClient.Client) - productPolicyClient := productpolicy.NewProductPolicyClientWithBaseURI(endpoint) - configureAuthFunc(&productPolicyClient.Client) + productSubscriptionClient, err := productsubscription.NewProductSubscriptionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductSubscription client: %+v", err) + } + configureFunc(productSubscriptionClient.Client) - productSubscriptionClient := productsubscription.NewProductSubscriptionClientWithBaseURI(endpoint) - configureAuthFunc(&productSubscriptionClient.Client) + productTagClient, err := producttag.NewProductTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductTag client: %+v", err) + } + configureFunc(productTagClient.Client) - productTagClient := producttag.NewProductTagClientWithBaseURI(endpoint) - configureAuthFunc(&productTagClient.Client) + productWikiClient, err := productwiki.NewProductWikiClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductWiki client: %+v", err) + } + configureFunc(productWikiClient.Client) - productWikiClient := productwiki.NewProductWikiClientWithBaseURI(endpoint) - configureAuthFunc(&productWikiClient.Client) + productsByTagClient, err := productsbytag.NewProductsByTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building ProductsByTag client: %+v", err) + } + configureFunc(productsByTagClient.Client) - productsByTagClient := productsbytag.NewProductsByTagClientWithBaseURI(endpoint) - configureAuthFunc(&productsByTagClient.Client) + quotaByCounterKeysClient, err := quotabycounterkeys.NewQuotaByCounterKeysClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building QuotaByCounterKeys client: %+v", err) + } + configureFunc(quotaByCounterKeysClient.Client) - quotaByCounterKeysClient := quotabycounterkeys.NewQuotaByCounterKeysClientWithBaseURI(endpoint) - configureAuthFunc("aByCounterKeysClient.Client) + quotaByPeriodKeysClient, err := quotabyperiodkeys.NewQuotaByPeriodKeysClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building QuotaByPeriodKeys client: %+v", err) + } + configureFunc(quotaByPeriodKeysClient.Client) - quotaByPeriodKeysClient := quotabyperiodkeys.NewQuotaByPeriodKeysClientWithBaseURI(endpoint) - configureAuthFunc("aByPeriodKeysClient.Client) + regionClient, err := region.NewRegionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Region client: %+v", err) + } + configureFunc(regionClient.Client) - regionClient := region.NewRegionClientWithBaseURI(endpoint) - configureAuthFunc(®ionClient.Client) + reportsClient, err := reports.NewReportsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Reports client: %+v", err) + } + configureFunc(reportsClient.Client) - reportsClient := reports.NewReportsClientWithBaseURI(endpoint) - configureAuthFunc(&reportsClient.Client) + schemaClient, err := schema.NewSchemaClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Schema client: %+v", err) + } + configureFunc(schemaClient.Client) - schemaClient := schema.NewSchemaClientWithBaseURI(endpoint) - configureAuthFunc(&schemaClient.Client) + signInSettingsClient, err := signinsettings.NewSignInSettingsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building SignInSettings client: %+v", err) + } + configureFunc(signInSettingsClient.Client) - signInSettingsClient := signinsettings.NewSignInSettingsClientWithBaseURI(endpoint) - configureAuthFunc(&signInSettingsClient.Client) + signUpSettingsClient, err := signupsettings.NewSignUpSettingsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building SignUpSettings client: %+v", err) + } + configureFunc(signUpSettingsClient.Client) - signUpSettingsClient := signupsettings.NewSignUpSettingsClientWithBaseURI(endpoint) - configureAuthFunc(&signUpSettingsClient.Client) + skusClient, err := skus.NewSkusClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Skus client: %+v", err) + } + configureFunc(skusClient.Client) + + subscriptionClient, err := subscription.NewSubscriptionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Subscription client: %+v", err) + } + configureFunc(subscriptionClient.Client) + + tagClient, err := tag.NewTagClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Tag client: %+v", err) + } + configureFunc(tagClient.Client) + + tagResourceClient, err := tagresource.NewTagResourceClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TagResource client: %+v", err) + } + configureFunc(tagResourceClient.Client) + + tenantAccessClient, err := tenantaccess.NewTenantAccessClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TenantAccess client: %+v", err) + } + configureFunc(tenantAccessClient.Client) + + tenantAccessGitClient, err := tenantaccessgit.NewTenantAccessGitClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TenantAccessGit client: %+v", err) + } + configureFunc(tenantAccessGitClient.Client) + + tenantConfigurationClient, err := tenantconfiguration.NewTenantConfigurationClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TenantConfiguration client: %+v", err) + } + configureFunc(tenantConfigurationClient.Client) + + tenantConfigurationSyncStateClient, err := tenantconfigurationsyncstate.NewTenantConfigurationSyncStateClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TenantConfigurationSyncState client: %+v", err) + } + configureFunc(tenantConfigurationSyncStateClient.Client) + + tenantSettingsClient, err := tenantsettings.NewTenantSettingsClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building TenantSettings client: %+v", err) + } + configureFunc(tenantSettingsClient.Client) + + userClient, err := user.NewUserClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building User client: %+v", err) + } + configureFunc(userClient.Client) + + userConfirmationPasswordSendClient, err := userconfirmationpasswordsend.NewUserConfirmationPasswordSendClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building UserConfirmationPasswordSend client: %+v", err) + } + configureFunc(userConfirmationPasswordSendClient.Client) + + userGroupClient, err := usergroup.NewUserGroupClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building UserGroup client: %+v", err) + } + configureFunc(userGroupClient.Client) + + userIdentityClient, err := useridentity.NewUserIdentityClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building UserIdentity client: %+v", err) + } + configureFunc(userIdentityClient.Client) + + userSubscriptionClient, err := usersubscription.NewUserSubscriptionClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building UserSubscription client: %+v", err) + } + configureFunc(userSubscriptionClient.Client) + + userTokenClient, err := usertoken.NewUserTokenClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building UserToken client: %+v", err) + } + configureFunc(userTokenClient.Client) - skusClient := skus.NewSkusClientWithBaseURI(endpoint) - configureAuthFunc(&skusClient.Client) - - subscriptionClient := subscription.NewSubscriptionClientWithBaseURI(endpoint) - configureAuthFunc(&subscriptionClient.Client) - - tagClient := tag.NewTagClientWithBaseURI(endpoint) - configureAuthFunc(&tagClient.Client) - - tagResourceClient := tagresource.NewTagResourceClientWithBaseURI(endpoint) - configureAuthFunc(&tagResourceClient.Client) - - tenantAccessClient := tenantaccess.NewTenantAccessClientWithBaseURI(endpoint) - configureAuthFunc(&tenantAccessClient.Client) - - tenantAccessGitClient := tenantaccessgit.NewTenantAccessGitClientWithBaseURI(endpoint) - configureAuthFunc(&tenantAccessGitClient.Client) - - tenantConfigurationClient := tenantconfiguration.NewTenantConfigurationClientWithBaseURI(endpoint) - configureAuthFunc(&tenantConfigurationClient.Client) - - tenantConfigurationSyncStateClient := tenantconfigurationsyncstate.NewTenantConfigurationSyncStateClientWithBaseURI(endpoint) - configureAuthFunc(&tenantConfigurationSyncStateClient.Client) - - tenantSettingsClient := tenantsettings.NewTenantSettingsClientWithBaseURI(endpoint) - configureAuthFunc(&tenantSettingsClient.Client) - - userClient := user.NewUserClientWithBaseURI(endpoint) - configureAuthFunc(&userClient.Client) - - userConfirmationPasswordSendClient := userconfirmationpasswordsend.NewUserConfirmationPasswordSendClientWithBaseURI(endpoint) - configureAuthFunc(&userConfirmationPasswordSendClient.Client) - - userGroupClient := usergroup.NewUserGroupClientWithBaseURI(endpoint) - configureAuthFunc(&userGroupClient.Client) - - userIdentityClient := useridentity.NewUserIdentityClientWithBaseURI(endpoint) - configureAuthFunc(&userIdentityClient.Client) - - userSubscriptionClient := usersubscription.NewUserSubscriptionClientWithBaseURI(endpoint) - configureAuthFunc(&userSubscriptionClient.Client) - - userTokenClient := usertoken.NewUserTokenClientWithBaseURI(endpoint) - configureAuthFunc(&userTokenClient.Client) - - usersClient := users.NewUsersClientWithBaseURI(endpoint) - configureAuthFunc(&usersClient.Client) - - return Client{ - Api: &apiClient, - ApiDiagnostic: &apiDiagnosticClient, - ApiIssue: &apiIssueClient, - ApiIssueAttachment: &apiIssueAttachmentClient, - ApiIssueComment: &apiIssueCommentClient, - ApiManagementService: &apiManagementServiceClient, - ApiManagementServiceSkus: &apiManagementServiceSkusClient, - ApiOperation: &apiOperationClient, - ApiOperationPolicy: &apiOperationPolicyClient, - ApiOperationTag: &apiOperationTagClient, - ApiOperationsByTag: &apiOperationsByTagClient, - ApiPolicy: &apiPolicyClient, - ApiProduct: &apiProductClient, - ApiRelease: &apiReleaseClient, - ApiRevision: &apiRevisionClient, - ApiSchema: &apiSchemaClient, - ApiTag: &apiTagClient, - ApiTagDescription: &apiTagDescriptionClient, - ApiVersionSet: &apiVersionSetClient, - ApiVersionSets: &apiVersionSetsClient, - ApiWiki: &apiWikiClient, - ApisByTag: &apisByTagClient, - Authorization: &authorizationClient, - AuthorizationAccessPolicy: &authorizationAccessPolicyClient, - AuthorizationConfirmConsentCode: &authorizationConfirmConsentCodeClient, - AuthorizationLoginLinks: &authorizationLoginLinksClient, - AuthorizationProvider: &authorizationProviderClient, - AuthorizationServer: &authorizationServerClient, - Authorizations: &authorizationsClient, - Backend: &backendClient, - BackendReconnect: &backendReconnectClient, - Cache: &cacheClient, - Certificate: &certificateClient, - ContentType: &contentTypeClient, - ContentTypeContentItem: &contentTypeContentItemClient, - DelegationSettings: &delegationSettingsClient, - DeletedService: &deletedServiceClient, - Diagnostic: &diagnosticClient, - DocumentationResource: &documentationResourceClient, - EmailTemplate: &emailTemplateClient, - EmailTemplates: &emailTemplatesClient, - Gateway: &gatewayClient, - GatewayApi: &gatewayApiClient, - GatewayCertificateAuthority: &gatewayCertificateAuthorityClient, - GatewayGenerateToken: &gatewayGenerateTokenClient, - GatewayHostnameConfiguration: &gatewayHostnameConfigurationClient, - GatewayListKeys: &gatewayListKeysClient, - GatewayRegenerateKey: &gatewayRegenerateKeyClient, - GraphQLApiResolver: &graphQLApiResolverClient, - GraphQLApiResolverPolicy: &graphQLApiResolverPolicyClient, - Group: &groupClient, - GroupUser: &groupUserClient, - IdentityProvider: &identityProviderClient, - Issue: &issueClient, - Logger: &loggerClient, - NamedValue: &namedValueClient, - NetworkStatus: &networkStatusClient, - Notification: ¬ificationClient, - NotificationRecipientEmail: ¬ificationRecipientEmailClient, - NotificationRecipientUser: ¬ificationRecipientUserClient, - OpenidConnectProvider: &openidConnectProviderClient, - OutboundNetworkDependenciesEndpoints: &outboundNetworkDependenciesEndpointsClient, - PerformConnectivityCheck: &performConnectivityCheckClient, - Policy: &policyClient, - PolicyDescription: &policyDescriptionClient, - PolicyFragment: &policyFragmentClient, - PortalConfig: &portalConfigClient, - PortalRevision: &portalRevisionClient, - PortalSettings: &portalSettingsClient, - PrivateEndpointConnections: &privateEndpointConnectionsClient, - Product: &productClient, - ProductApi: &productApiClient, - ProductGroup: &productGroupClient, - ProductPolicy: &productPolicyClient, - ProductSubscription: &productSubscriptionClient, - ProductTag: &productTagClient, - ProductWiki: &productWikiClient, - ProductsByTag: &productsByTagClient, - QuotaByCounterKeys: "aByCounterKeysClient, - QuotaByPeriodKeys: "aByPeriodKeysClient, - Region: ®ionClient, - Reports: &reportsClient, - Schema: &schemaClient, - SignInSettings: &signInSettingsClient, - SignUpSettings: &signUpSettingsClient, - Skus: &skusClient, - Subscription: &subscriptionClient, - Tag: &tagClient, - TagResource: &tagResourceClient, - TenantAccess: &tenantAccessClient, - TenantAccessGit: &tenantAccessGitClient, - TenantConfiguration: &tenantConfigurationClient, - TenantConfigurationSyncState: &tenantConfigurationSyncStateClient, - TenantSettings: &tenantSettingsClient, - User: &userClient, - UserConfirmationPasswordSend: &userConfirmationPasswordSendClient, - UserGroup: &userGroupClient, - UserIdentity: &userIdentityClient, - UserSubscription: &userSubscriptionClient, - UserToken: &userTokenClient, - Users: &usersClient, + usersClient, err := users.NewUsersClientWithBaseURI(api) + if err != nil { + return nil, fmt.Errorf("building Users client: %+v", err) } + configureFunc(usersClient.Client) + + return &Client{ + Api: apiClient, + ApiDiagnostic: apiDiagnosticClient, + ApiIssue: apiIssueClient, + ApiIssueAttachment: apiIssueAttachmentClient, + ApiIssueComment: apiIssueCommentClient, + ApiManagementService: apiManagementServiceClient, + ApiManagementServiceSkus: apiManagementServiceSkusClient, + ApiOperation: apiOperationClient, + ApiOperationPolicy: apiOperationPolicyClient, + ApiOperationTag: apiOperationTagClient, + ApiOperationsByTag: apiOperationsByTagClient, + ApiPolicy: apiPolicyClient, + ApiProduct: apiProductClient, + ApiRelease: apiReleaseClient, + ApiRevision: apiRevisionClient, + ApiSchema: apiSchemaClient, + ApiTag: apiTagClient, + ApiTagDescription: apiTagDescriptionClient, + ApiVersionSet: apiVersionSetClient, + ApiVersionSets: apiVersionSetsClient, + ApiWiki: apiWikiClient, + ApisByTag: apisByTagClient, + Authorization: authorizationClient, + AuthorizationAccessPolicy: authorizationAccessPolicyClient, + AuthorizationConfirmConsentCode: authorizationConfirmConsentCodeClient, + AuthorizationLoginLinks: authorizationLoginLinksClient, + AuthorizationProvider: authorizationProviderClient, + AuthorizationServer: authorizationServerClient, + Authorizations: authorizationsClient, + Backend: backendClient, + BackendReconnect: backendReconnectClient, + Cache: cacheClient, + Certificate: certificateClient, + ContentType: contentTypeClient, + ContentTypeContentItem: contentTypeContentItemClient, + DelegationSettings: delegationSettingsClient, + DeletedService: deletedServiceClient, + Diagnostic: diagnosticClient, + DocumentationResource: documentationResourceClient, + EmailTemplate: emailTemplateClient, + EmailTemplates: emailTemplatesClient, + Gateway: gatewayClient, + GatewayApi: gatewayApiClient, + GatewayCertificateAuthority: gatewayCertificateAuthorityClient, + GatewayGenerateToken: gatewayGenerateTokenClient, + GatewayHostnameConfiguration: gatewayHostnameConfigurationClient, + GatewayListKeys: gatewayListKeysClient, + GatewayRegenerateKey: gatewayRegenerateKeyClient, + GraphQLApiResolver: graphQLApiResolverClient, + GraphQLApiResolverPolicy: graphQLApiResolverPolicyClient, + Group: groupClient, + GroupUser: groupUserClient, + IdentityProvider: identityProviderClient, + Issue: issueClient, + Logger: loggerClient, + NamedValue: namedValueClient, + NetworkStatus: networkStatusClient, + Notification: notificationClient, + NotificationRecipientEmail: notificationRecipientEmailClient, + NotificationRecipientUser: notificationRecipientUserClient, + OpenidConnectProvider: openidConnectProviderClient, + OutboundNetworkDependenciesEndpoints: outboundNetworkDependenciesEndpointsClient, + PerformConnectivityCheck: performConnectivityCheckClient, + Policy: policyClient, + PolicyDescription: policyDescriptionClient, + PolicyFragment: policyFragmentClient, + PortalConfig: portalConfigClient, + PortalRevision: portalRevisionClient, + PortalSettings: portalSettingsClient, + PrivateEndpointConnections: privateEndpointConnectionsClient, + Product: productClient, + ProductApi: productApiClient, + ProductGroup: productGroupClient, + ProductPolicy: productPolicyClient, + ProductSubscription: productSubscriptionClient, + ProductTag: productTagClient, + ProductWiki: productWikiClient, + ProductsByTag: productsByTagClient, + QuotaByCounterKeys: quotaByCounterKeysClient, + QuotaByPeriodKeys: quotaByPeriodKeysClient, + Region: regionClient, + Reports: reportsClient, + Schema: schemaClient, + SignInSettings: signInSettingsClient, + SignUpSettings: signUpSettingsClient, + Skus: skusClient, + Subscription: subscriptionClient, + Tag: tagClient, + TagResource: tagResourceClient, + TenantAccess: tenantAccessClient, + TenantAccessGit: tenantAccessGitClient, + TenantConfiguration: tenantConfigurationClient, + TenantConfigurationSyncState: tenantConfigurationSyncStateClient, + TenantSettings: tenantSettingsClient, + User: userClient, + UserConfirmationPasswordSend: userConfirmationPasswordSendClient, + UserGroup: userGroupClient, + UserIdentity: userIdentityClient, + UserSubscription: userSubscriptionClient, + UserToken: userTokenClient, + Users: usersClient, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/contenttype/client.go b/resource-manager/apimanagement/2022-08-01/contenttype/client.go index ad798035bab..d2af44c08b3 100644 --- a/resource-manager/apimanagement/2022-08-01/contenttype/client.go +++ b/resource-manager/apimanagement/2022-08-01/contenttype/client.go @@ -1,18 +1,26 @@ package contenttype -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ContentTypeClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewContentTypeClientWithBaseURI(endpoint string) ContentTypeClient { - return ContentTypeClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewContentTypeClientWithBaseURI(api sdkEnv.Api) (*ContentTypeClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "contenttype", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ContentTypeClient: %+v", err) } + + return &ContentTypeClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/contenttype/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/contenttype/method_createorupdate.go new file mode 100644 index 00000000000..777eb60bb34 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/contenttype/method_createorupdate.go @@ -0,0 +1,85 @@ +package contenttype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContentTypeContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ContentTypeClient) CreateOrUpdate(ctx context.Context, id ContentTypeId, input ContentTypeContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/contenttype/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/contenttype/method_createorupdate_autorest.go deleted file mode 100644 index 7e7af790b98..00000000000 --- a/resource-manager/apimanagement/2022-08-01/contenttype/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package contenttype - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ContentTypeContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ContentTypeClient) CreateOrUpdate(ctx context.Context, id ContentTypeId, input ContentTypeContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ContentTypeClient) preparerForCreateOrUpdate(ctx context.Context, id ContentTypeId, input ContentTypeContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ContentTypeClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/contenttype/method_delete.go b/resource-manager/apimanagement/2022-08-01/contenttype/method_delete.go new file mode 100644 index 00000000000..5a87b291973 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/contenttype/method_delete.go @@ -0,0 +1,76 @@ +package contenttype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ContentTypeClient) Delete(ctx context.Context, id ContentTypeId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/contenttype/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/contenttype/method_delete_autorest.go deleted file mode 100644 index c67c198a0f2..00000000000 --- a/resource-manager/apimanagement/2022-08-01/contenttype/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package contenttype - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ContentTypeClient) Delete(ctx context.Context, id ContentTypeId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ContentTypeClient) preparerForDelete(ctx context.Context, id ContentTypeId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ContentTypeClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/contenttype/method_get.go b/resource-manager/apimanagement/2022-08-01/contenttype/method_get.go new file mode 100644 index 00000000000..45f141d65b2 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/contenttype/method_get.go @@ -0,0 +1,51 @@ +package contenttype + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContentTypeContract +} + +// Get ... +func (c ContentTypeClient) Get(ctx context.Context, id ContentTypeId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/contenttype/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/contenttype/method_get_autorest.go deleted file mode 100644 index ffff3ebdfb5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/contenttype/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package contenttype - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ContentTypeContract -} - -// Get ... -func (c ContentTypeClient) Get(ctx context.Context, id ContentTypeId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ContentTypeClient) preparerForGet(ctx context.Context, id ContentTypeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ContentTypeClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/contenttype/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/contenttype/method_listbyservice.go new file mode 100644 index 00000000000..3a6d95c44ce --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/contenttype/method_listbyservice.go @@ -0,0 +1,89 @@ +package contenttype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ContentTypeContract +} + +type ListByServiceCompleteResult struct { + Items []ContentTypeContract +} + +// ListByService ... +func (c ContentTypeClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/contentTypes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ContentTypeContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ContentTypeClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, ContentTypeContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContentTypeClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate ContentTypeContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ContentTypeContract, 0) + + resp, err := c.ListByService(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/contenttype/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/contenttype/method_listbyservice_autorest.go deleted file mode 100644 index 80dfbe9830a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/contenttype/method_listbyservice_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package contenttype - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ContentTypeContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ContentTypeContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByService ... -func (c ContentTypeClient) ListByService(ctx context.Context, id ServiceId) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ContentTypeClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/contentTypes", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ContentTypeClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ContentTypeClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ContentTypeContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttype.ContentTypeClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ContentTypeClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, ContentTypeContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ContentTypeClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate ContentTypeContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ContentTypeContract, 0) - - page, err := c.ListByService(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/client.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/client.go index 89ca6821ddb..0ae62f20886 100644 --- a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/client.go +++ b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/client.go @@ -1,18 +1,26 @@ package contenttypecontentitem -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ContentTypeContentItemClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewContentTypeContentItemClientWithBaseURI(endpoint string) ContentTypeContentItemClient { - return ContentTypeContentItemClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewContentTypeContentItemClientWithBaseURI(api sdkEnv.Api) (*ContentTypeContentItemClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "contenttypecontentitem", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ContentTypeContentItemClient: %+v", err) } + + return &ContentTypeContentItemClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemcreateorupdate.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemcreateorupdate.go new file mode 100644 index 00000000000..f64c33e51f2 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemcreateorupdate.go @@ -0,0 +1,85 @@ +package contenttypecontentitem + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentItemCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContentItemContract +} + +type ContentItemCreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultContentItemCreateOrUpdateOperationOptions() ContentItemCreateOrUpdateOperationOptions { + return ContentItemCreateOrUpdateOperationOptions{} +} + +func (o ContentItemCreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o ContentItemCreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ContentItemCreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// ContentItemCreateOrUpdate ... +func (c ContentTypeContentItemClient) ContentItemCreateOrUpdate(ctx context.Context, id ContentItemId, input ContentItemContract, options ContentItemCreateOrUpdateOperationOptions) (result ContentItemCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemcreateorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemcreateorupdate_autorest.go deleted file mode 100644 index 74712be0162..00000000000 --- a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemcreateorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package contenttypecontentitem - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentItemCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ContentItemContract -} - -type ContentItemCreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultContentItemCreateOrUpdateOperationOptions() ContentItemCreateOrUpdateOperationOptions { - return ContentItemCreateOrUpdateOperationOptions{} -} - -func (o ContentItemCreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o ContentItemCreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// ContentItemCreateOrUpdate ... -func (c ContentTypeContentItemClient) ContentItemCreateOrUpdate(ctx context.Context, id ContentItemId, input ContentItemContract, options ContentItemCreateOrUpdateOperationOptions) (result ContentItemCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForContentItemCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentItemCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentItemCreateOrUpdate prepares the ContentItemCreateOrUpdate request. -func (c ContentTypeContentItemClient) preparerForContentItemCreateOrUpdate(ctx context.Context, id ContentItemId, input ContentItemContract, options ContentItemCreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentItemCreateOrUpdate handles the response to the ContentItemCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ContentTypeContentItemClient) responderForContentItemCreateOrUpdate(resp *http.Response) (result ContentItemCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemdelete.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemdelete.go new file mode 100644 index 00000000000..5b8b348a02c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemdelete.go @@ -0,0 +1,76 @@ +package contenttypecontentitem + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentItemDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type ContentItemDeleteOperationOptions struct { + IfMatch *string +} + +func DefaultContentItemDeleteOperationOptions() ContentItemDeleteOperationOptions { + return ContentItemDeleteOperationOptions{} +} + +func (o ContentItemDeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o ContentItemDeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ContentItemDeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// ContentItemDelete ... +func (c ContentTypeContentItemClient) ContentItemDelete(ctx context.Context, id ContentItemId, options ContentItemDeleteOperationOptions) (result ContentItemDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemdelete_autorest.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemdelete_autorest.go deleted file mode 100644 index 701903e5664..00000000000 --- a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemdelete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package contenttypecontentitem - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentItemDeleteOperationResponse struct { - HttpResponse *http.Response -} - -type ContentItemDeleteOperationOptions struct { - IfMatch *string -} - -func DefaultContentItemDeleteOperationOptions() ContentItemDeleteOperationOptions { - return ContentItemDeleteOperationOptions{} -} - -func (o ContentItemDeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o ContentItemDeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// ContentItemDelete ... -func (c ContentTypeContentItemClient) ContentItemDelete(ctx context.Context, id ContentItemId, options ContentItemDeleteOperationOptions) (result ContentItemDeleteOperationResponse, err error) { - req, err := c.preparerForContentItemDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentItemDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentItemDelete prepares the ContentItemDelete request. -func (c ContentTypeContentItemClient) preparerForContentItemDelete(ctx context.Context, id ContentItemId, options ContentItemDeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentItemDelete handles the response to the ContentItemDelete request. The method always -// closes the http.Response Body. -func (c ContentTypeContentItemClient) responderForContentItemDelete(resp *http.Response) (result ContentItemDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemget.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemget.go new file mode 100644 index 00000000000..8ea76ef555d --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemget.go @@ -0,0 +1,51 @@ +package contenttypecontentitem + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentItemGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ContentItemContract +} + +// ContentItemGet ... +func (c ContentTypeContentItemClient) ContentItemGet(ctx context.Context, id ContentItemId) (result ContentItemGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemget_autorest.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemget_autorest.go deleted file mode 100644 index efbe49d07d9..00000000000 --- a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package contenttypecontentitem - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentItemGetOperationResponse struct { - HttpResponse *http.Response - Model *ContentItemContract -} - -// ContentItemGet ... -func (c ContentTypeContentItemClient) ContentItemGet(ctx context.Context, id ContentItemId) (result ContentItemGetOperationResponse, err error) { - req, err := c.preparerForContentItemGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentItemGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentItemGet prepares the ContentItemGet request. -func (c ContentTypeContentItemClient) preparerForContentItemGet(ctx context.Context, id ContentItemId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentItemGet handles the response to the ContentItemGet request. The method always -// closes the http.Response Body. -func (c ContentTypeContentItemClient) responderForContentItemGet(resp *http.Response) (result ContentItemGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemgetentitytag.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemgetentitytag.go new file mode 100644 index 00000000000..072a373e255 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemgetentitytag.go @@ -0,0 +1,46 @@ +package contenttypecontentitem + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentItemGetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// ContentItemGetEntityTag ... +func (c ContentTypeContentItemClient) ContentItemGetEntityTag(ctx context.Context, id ContentItemId) (result ContentItemGetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemgetentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemgetentitytag_autorest.go deleted file mode 100644 index b6ba07420c2..00000000000 --- a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemgetentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package contenttypecontentitem - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentItemGetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// ContentItemGetEntityTag ... -func (c ContentTypeContentItemClient) ContentItemGetEntityTag(ctx context.Context, id ContentItemId) (result ContentItemGetEntityTagOperationResponse, err error) { - req, err := c.preparerForContentItemGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentItemGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemGetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentItemGetEntityTag prepares the ContentItemGetEntityTag request. -func (c ContentTypeContentItemClient) preparerForContentItemGetEntityTag(ctx context.Context, id ContentItemId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentItemGetEntityTag handles the response to the ContentItemGetEntityTag request. The method always -// closes the http.Response Body. -func (c ContentTypeContentItemClient) responderForContentItemGetEntityTag(resp *http.Response) (result ContentItemGetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemlistbyservice.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemlistbyservice.go new file mode 100644 index 00000000000..8e83525cd40 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemlistbyservice.go @@ -0,0 +1,89 @@ +package contenttypecontentitem + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentItemListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ContentItemContract +} + +type ContentItemListByServiceCompleteResult struct { + Items []ContentItemContract +} + +// ContentItemListByService ... +func (c ContentTypeContentItemClient) ContentItemListByService(ctx context.Context, id ContentTypeId) (result ContentItemListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/contentItems", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ContentItemContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ContentItemListByServiceComplete retrieves all the results into a single object +func (c ContentTypeContentItemClient) ContentItemListByServiceComplete(ctx context.Context, id ContentTypeId) (ContentItemListByServiceCompleteResult, error) { + return c.ContentItemListByServiceCompleteMatchingPredicate(ctx, id, ContentItemContractOperationPredicate{}) +} + +// ContentItemListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ContentTypeContentItemClient) ContentItemListByServiceCompleteMatchingPredicate(ctx context.Context, id ContentTypeId, predicate ContentItemContractOperationPredicate) (result ContentItemListByServiceCompleteResult, err error) { + items := make([]ContentItemContract, 0) + + resp, err := c.ContentItemListByService(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ContentItemListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemlistbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemlistbyservice_autorest.go deleted file mode 100644 index 4a4be76da22..00000000000 --- a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/method_contentitemlistbyservice_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package contenttypecontentitem - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentItemListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ContentItemContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ContentItemListByServiceOperationResponse, error) -} - -type ContentItemListByServiceCompleteResult struct { - Items []ContentItemContract -} - -func (r ContentItemListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ContentItemListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ContentItemListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ContentItemListByService ... -func (c ContentTypeContentItemClient) ContentItemListByService(ctx context.Context, id ContentTypeId) (resp ContentItemListByServiceOperationResponse, err error) { - req, err := c.preparerForContentItemListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForContentItemListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForContentItemListByService prepares the ContentItemListByService request. -func (c ContentTypeContentItemClient) preparerForContentItemListByService(ctx context.Context, id ContentTypeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/contentItems", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForContentItemListByServiceWithNextLink prepares the ContentItemListByService request with the given nextLink token. -func (c ContentTypeContentItemClient) preparerForContentItemListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentItemListByService handles the response to the ContentItemListByService request. The method always -// closes the http.Response Body. -func (c ContentTypeContentItemClient) responderForContentItemListByService(resp *http.Response) (result ContentItemListByServiceOperationResponse, err error) { - type page struct { - Values []ContentItemContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ContentItemListByServiceOperationResponse, err error) { - req, err := c.preparerForContentItemListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentItemListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contenttypecontentitem.ContentTypeContentItemClient", "ContentItemListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ContentItemListByServiceComplete retrieves all of the results into a single object -func (c ContentTypeContentItemClient) ContentItemListByServiceComplete(ctx context.Context, id ContentTypeId) (ContentItemListByServiceCompleteResult, error) { - return c.ContentItemListByServiceCompleteMatchingPredicate(ctx, id, ContentItemContractOperationPredicate{}) -} - -// ContentItemListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ContentTypeContentItemClient) ContentItemListByServiceCompleteMatchingPredicate(ctx context.Context, id ContentTypeId, predicate ContentItemContractOperationPredicate) (resp ContentItemListByServiceCompleteResult, err error) { - items := make([]ContentItemContract, 0) - - page, err := c.ContentItemListByService(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ContentItemListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/client.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/client.go index 72c97b7519c..8047bd74fb4 100644 --- a/resource-manager/apimanagement/2022-08-01/delegationsettings/client.go +++ b/resource-manager/apimanagement/2022-08-01/delegationsettings/client.go @@ -1,18 +1,26 @@ package delegationsettings -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type DelegationSettingsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewDelegationSettingsClientWithBaseURI(endpoint string) DelegationSettingsClient { - return DelegationSettingsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewDelegationSettingsClientWithBaseURI(api sdkEnv.Api) (*DelegationSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "delegationsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DelegationSettingsClient: %+v", err) } + + return &DelegationSettingsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_createorupdate.go new file mode 100644 index 00000000000..798382faf25 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_createorupdate.go @@ -0,0 +1,84 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalDelegationSettings +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c DelegationSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalDelegationSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_createorupdate_autorest.go deleted file mode 100644 index 51373a1a8ce..00000000000 --- a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package delegationsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PortalDelegationSettings -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c DelegationSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalDelegationSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c DelegationSettingsClient) preparerForCreateOrUpdate(ctx context.Context, id ServiceId, input PortalDelegationSettings, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/delegation", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c DelegationSettingsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_get.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_get.go new file mode 100644 index 00000000000..7e0f9378ef1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_get.go @@ -0,0 +1,52 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalDelegationSettings +} + +// Get ... +func (c DelegationSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_get_autorest.go deleted file mode 100644 index e2553b0753d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package delegationsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PortalDelegationSettings -} - -// Get ... -func (c DelegationSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c DelegationSettingsClient) preparerForGet(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/delegation", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c DelegationSettingsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_getentitytag.go new file mode 100644 index 00000000000..6d1fc5745c7 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_getentitytag.go @@ -0,0 +1,47 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c DelegationSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_getentitytag_autorest.go deleted file mode 100644 index 7a92ab1b000..00000000000 --- a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package delegationsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c DelegationSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c DelegationSettingsClient) preparerForGetEntityTag(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/delegation", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c DelegationSettingsClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_listsecrets.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_listsecrets.go new file mode 100644 index 00000000000..baf7a240e3b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_listsecrets.go @@ -0,0 +1,52 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSettingValidationKeyContract +} + +// ListSecrets ... +func (c DelegationSettingsClient) ListSecrets(ctx context.Context, id ServiceId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/portalsettings/delegation/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_listsecrets_autorest.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_listsecrets_autorest.go deleted file mode 100644 index 279c998cc3b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package delegationsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *PortalSettingValidationKeyContract -} - -// ListSecrets ... -func (c DelegationSettingsClient) ListSecrets(ctx context.Context, id ServiceId) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c DelegationSettingsClient) preparerForListSecrets(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/delegation/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c DelegationSettingsClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_update.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_update.go new file mode 100644 index 00000000000..924b296b5fa --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_update.go @@ -0,0 +1,79 @@ +package delegationsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c DelegationSettingsClient) Update(ctx context.Context, id ServiceId, input PortalDelegationSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/portalsettings/delegation", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/method_update_autorest.go deleted file mode 100644 index c768645478b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/delegationsettings/method_update_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package delegationsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c DelegationSettingsClient) Update(ctx context.Context, id ServiceId, input PortalDelegationSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "delegationsettings.DelegationSettingsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c DelegationSettingsClient) preparerForUpdate(ctx context.Context, id ServiceId, input PortalDelegationSettings, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/delegation", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c DelegationSettingsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/deletedservice/client.go b/resource-manager/apimanagement/2022-08-01/deletedservice/client.go index 481a31f9a8a..4db226a6f87 100644 --- a/resource-manager/apimanagement/2022-08-01/deletedservice/client.go +++ b/resource-manager/apimanagement/2022-08-01/deletedservice/client.go @@ -1,18 +1,26 @@ package deletedservice -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type DeletedServiceClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewDeletedServiceClientWithBaseURI(endpoint string) DeletedServiceClient { - return DeletedServiceClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewDeletedServiceClientWithBaseURI(api sdkEnv.Api) (*DeletedServiceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "deletedservice", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DeletedServiceClient: %+v", err) } + + return &DeletedServiceClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/deletedservice/method_getbyname.go b/resource-manager/apimanagement/2022-08-01/deletedservice/method_getbyname.go new file mode 100644 index 00000000000..f6404fd9b48 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/deletedservice/method_getbyname.go @@ -0,0 +1,51 @@ +package deletedservice + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetByNameOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DeletedServiceContract +} + +// GetByName ... +func (c DeletedServiceClient) GetByName(ctx context.Context, id DeletedServiceId) (result GetByNameOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/deletedservice/method_getbyname_autorest.go b/resource-manager/apimanagement/2022-08-01/deletedservice/method_getbyname_autorest.go deleted file mode 100644 index f80305a22eb..00000000000 --- a/resource-manager/apimanagement/2022-08-01/deletedservice/method_getbyname_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package deletedservice - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetByNameOperationResponse struct { - HttpResponse *http.Response - Model *DeletedServiceContract -} - -// GetByName ... -func (c DeletedServiceClient) GetByName(ctx context.Context, id DeletedServiceId) (result GetByNameOperationResponse, err error) { - req, err := c.preparerForGetByName(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "GetByName", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "GetByName", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetByName(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "GetByName", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetByName prepares the GetByName request. -func (c DeletedServiceClient) preparerForGetByName(ctx context.Context, id DeletedServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetByName handles the response to the GetByName request. The method always -// closes the http.Response Body. -func (c DeletedServiceClient) responderForGetByName(resp *http.Response) (result GetByNameOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/deletedservice/method_listbysubscription.go b/resource-manager/apimanagement/2022-08-01/deletedservice/method_listbysubscription.go new file mode 100644 index 00000000000..f6077a9e1f1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/deletedservice/method_listbysubscription.go @@ -0,0 +1,90 @@ +package deletedservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DeletedServiceContract +} + +type ListBySubscriptionCompleteResult struct { + Items []DeletedServiceContract +} + +// ListBySubscription ... +func (c DeletedServiceClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/deletedServices", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DeletedServiceContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c DeletedServiceClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DeletedServiceContractOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DeletedServiceClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DeletedServiceContractOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]DeletedServiceContract, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/deletedservice/method_listbysubscription_autorest.go b/resource-manager/apimanagement/2022-08-01/deletedservice/method_listbysubscription_autorest.go deleted file mode 100644 index 34e994381a2..00000000000 --- a/resource-manager/apimanagement/2022-08-01/deletedservice/method_listbysubscription_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package deletedservice - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *[]DeletedServiceContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []DeletedServiceContract -} - -func (r ListBySubscriptionOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListBySubscription ... -func (c DeletedServiceClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c DeletedServiceClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/deletedServices", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c DeletedServiceClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c DeletedServiceClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { - type page struct { - Values []DeletedServiceContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c DeletedServiceClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DeletedServiceContractOperationPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DeletedServiceClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DeletedServiceContractOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]DeletedServiceContract, 0) - - page, err := c.ListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/deletedservice/method_purge.go b/resource-manager/apimanagement/2022-08-01/deletedservice/method_purge.go new file mode 100644 index 00000000000..0e5dcf28a3d --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/deletedservice/method_purge.go @@ -0,0 +1,71 @@ +package deletedservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PurgeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Purge ... +func (c DeletedServiceClient) Purge(ctx context.Context, id DeletedServiceId) (result PurgeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PurgeThenPoll performs Purge then polls until it's completed +func (c DeletedServiceClient) PurgeThenPoll(ctx context.Context, id DeletedServiceId) error { + result, err := c.Purge(ctx, id) + if err != nil { + return fmt.Errorf("performing Purge: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Purge: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/deletedservice/method_purge_autorest.go b/resource-manager/apimanagement/2022-08-01/deletedservice/method_purge_autorest.go deleted file mode 100644 index 3494c6cdd2e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/deletedservice/method_purge_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package deletedservice - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PurgeOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Purge ... -func (c DeletedServiceClient) Purge(ctx context.Context, id DeletedServiceId) (result PurgeOperationResponse, err error) { - req, err := c.preparerForPurge(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "Purge", nil, "Failure preparing request") - return - } - - result, err = c.senderForPurge(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "deletedservice.DeletedServiceClient", "Purge", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// PurgeThenPoll performs Purge then polls until it's completed -func (c DeletedServiceClient) PurgeThenPoll(ctx context.Context, id DeletedServiceId) error { - result, err := c.Purge(ctx, id) - if err != nil { - return fmt.Errorf("performing Purge: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Purge: %+v", err) - } - - return nil -} - -// preparerForPurge prepares the Purge request. -func (c DeletedServiceClient) preparerForPurge(ctx context.Context, id DeletedServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForPurge sends the Purge request. The method will close the -// http.Response Body if it receives an error. -func (c DeletedServiceClient) senderForPurge(ctx context.Context, req *http.Request) (future PurgeOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/client.go b/resource-manager/apimanagement/2022-08-01/diagnostic/client.go index 724671ed06e..a24dae1dfb0 100644 --- a/resource-manager/apimanagement/2022-08-01/diagnostic/client.go +++ b/resource-manager/apimanagement/2022-08-01/diagnostic/client.go @@ -1,18 +1,26 @@ package diagnostic -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type DiagnosticClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewDiagnosticClientWithBaseURI(endpoint string) DiagnosticClient { - return DiagnosticClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewDiagnosticClientWithBaseURI(api sdkEnv.Api) (*DiagnosticClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "diagnostic", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DiagnosticClient: %+v", err) } + + return &DiagnosticClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/constants.go b/resource-manager/apimanagement/2022-08-01/diagnostic/constants.go index b75c24b4d61..cde4ab74afa 100644 --- a/resource-manager/apimanagement/2022-08-01/diagnostic/constants.go +++ b/resource-manager/apimanagement/2022-08-01/diagnostic/constants.go @@ -1,6 +1,10 @@ package diagnostic -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -17,6 +21,19 @@ func PossibleValuesForAlwaysLog() []string { } } +func (s *AlwaysLog) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAlwaysLog(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAlwaysLog(input string) (*AlwaysLog, error) { vals := map[string]AlwaysLog{ "allerrors": AlwaysLogAllErrors, @@ -44,6 +61,19 @@ func PossibleValuesForDataMaskingMode() []string { } } +func (s *DataMaskingMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDataMaskingMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDataMaskingMode(input string) (*DataMaskingMode, error) { vals := map[string]DataMaskingMode{ "hide": DataMaskingModeHide, @@ -74,6 +104,19 @@ func PossibleValuesForHTTPCorrelationProtocol() []string { } } +func (s *HTTPCorrelationProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHTTPCorrelationProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseHTTPCorrelationProtocol(input string) (*HTTPCorrelationProtocol, error) { vals := map[string]HTTPCorrelationProtocol{ "legacy": HTTPCorrelationProtocolLegacy, @@ -103,6 +146,19 @@ func PossibleValuesForOperationNameFormat() []string { } } +func (s *OperationNameFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperationNameFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOperationNameFormat(input string) (*OperationNameFormat, error) { vals := map[string]OperationNameFormat{ "name": OperationNameFormatName, @@ -129,6 +185,19 @@ func PossibleValuesForSamplingType() []string { } } +func (s *SamplingType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSamplingType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSamplingType(input string) (*SamplingType, error) { vals := map[string]SamplingType{ "fixed": SamplingTypeFixed, @@ -158,6 +227,19 @@ func PossibleValuesForVerbosity() []string { } } +func (s *Verbosity) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVerbosity(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVerbosity(input string) (*Verbosity, error) { vals := map[string]Verbosity{ "error": VerbosityError, diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_createorupdate.go new file mode 100644 index 00000000000..7b559f7022a --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/diagnostic/method_createorupdate.go @@ -0,0 +1,85 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c DiagnosticClient) CreateOrUpdate(ctx context.Context, id DiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_createorupdate_autorest.go deleted file mode 100644 index b4c6a433f43..00000000000 --- a/resource-manager/apimanagement/2022-08-01/diagnostic/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package diagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c DiagnosticClient) CreateOrUpdate(ctx context.Context, id DiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c DiagnosticClient) preparerForCreateOrUpdate(ctx context.Context, id DiagnosticId, input DiagnosticContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_delete.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_delete.go new file mode 100644 index 00000000000..3cd08df2cd9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/diagnostic/method_delete.go @@ -0,0 +1,76 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c DiagnosticClient) Delete(ctx context.Context, id DiagnosticId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_delete_autorest.go deleted file mode 100644 index e91965ee97f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/diagnostic/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package diagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c DiagnosticClient) Delete(ctx context.Context, id DiagnosticId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c DiagnosticClient) preparerForDelete(ctx context.Context, id DiagnosticId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_get.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_get.go new file mode 100644 index 00000000000..efc4cc74089 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/diagnostic/method_get.go @@ -0,0 +1,51 @@ +package diagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +// Get ... +func (c DiagnosticClient) Get(ctx context.Context, id DiagnosticId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_get_autorest.go deleted file mode 100644 index c5725fba3fd..00000000000 --- a/resource-manager/apimanagement/2022-08-01/diagnostic/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package diagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -// Get ... -func (c DiagnosticClient) Get(ctx context.Context, id DiagnosticId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c DiagnosticClient) preparerForGet(ctx context.Context, id DiagnosticId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_getentitytag.go new file mode 100644 index 00000000000..8be53cb6cbf --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/diagnostic/method_getentitytag.go @@ -0,0 +1,46 @@ +package diagnostic + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c DiagnosticClient) GetEntityTag(ctx context.Context, id DiagnosticId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_getentitytag_autorest.go deleted file mode 100644 index f06e74665d8..00000000000 --- a/resource-manager/apimanagement/2022-08-01/diagnostic/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package diagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c DiagnosticClient) GetEntityTag(ctx context.Context, id DiagnosticId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c DiagnosticClient) preparerForGetEntityTag(ctx context.Context, id DiagnosticId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_listbyservice.go new file mode 100644 index 00000000000..591d81877f4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/diagnostic/method_listbyservice.go @@ -0,0 +1,125 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DiagnosticContract +} + +type ListByServiceCompleteResult struct { + Items []DiagnosticContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c DiagnosticClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/diagnostics", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DiagnosticContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c DiagnosticClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DiagnosticContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DiagnosticClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate DiagnosticContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]DiagnosticContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_listbyservice_autorest.go deleted file mode 100644 index f02ef63c2c4..00000000000 --- a/resource-manager/apimanagement/2022-08-01/diagnostic/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package diagnostic - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]DiagnosticContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []DiagnosticContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c DiagnosticClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c DiagnosticClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/diagnostics", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c DiagnosticClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []DiagnosticContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c DiagnosticClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DiagnosticContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DiagnosticClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate DiagnosticContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]DiagnosticContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_update.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_update.go new file mode 100644 index 00000000000..cc36660c9e8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/diagnostic/method_update.go @@ -0,0 +1,84 @@ +package diagnostic + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DiagnosticContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c DiagnosticClient) Update(ctx context.Context, id DiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/diagnostic/method_update_autorest.go deleted file mode 100644 index f0c0c3763a8..00000000000 --- a/resource-manager/apimanagement/2022-08-01/diagnostic/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package diagnostic - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *DiagnosticContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c DiagnosticClient) Update(ctx context.Context, id DiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostic.DiagnosticClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c DiagnosticClient) preparerForUpdate(ctx context.Context, id DiagnosticId, input DiagnosticContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c DiagnosticClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/client.go b/resource-manager/apimanagement/2022-08-01/documentationresource/client.go index 4e67ef4a7b0..26f2728a026 100644 --- a/resource-manager/apimanagement/2022-08-01/documentationresource/client.go +++ b/resource-manager/apimanagement/2022-08-01/documentationresource/client.go @@ -1,18 +1,26 @@ package documentationresource -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type DocumentationResourceClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewDocumentationResourceClientWithBaseURI(endpoint string) DocumentationResourceClient { - return DocumentationResourceClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewDocumentationResourceClientWithBaseURI(api sdkEnv.Api) (*DocumentationResourceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "documentationresource", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DocumentationResourceClient: %+v", err) } + + return &DocumentationResourceClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_createorupdate.go new file mode 100644 index 00000000000..71a26b35388 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/documentationresource/method_createorupdate.go @@ -0,0 +1,85 @@ +package documentationresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DocumentationContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c DocumentationResourceClient) CreateOrUpdate(ctx context.Context, id DocumentationId, input DocumentationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_createorupdate_autorest.go deleted file mode 100644 index 9a9d4a32d99..00000000000 --- a/resource-manager/apimanagement/2022-08-01/documentationresource/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package documentationresource - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *DocumentationContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c DocumentationResourceClient) CreateOrUpdate(ctx context.Context, id DocumentationId, input DocumentationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c DocumentationResourceClient) preparerForCreateOrUpdate(ctx context.Context, id DocumentationId, input DocumentationContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c DocumentationResourceClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_delete.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_delete.go new file mode 100644 index 00000000000..317039d8290 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/documentationresource/method_delete.go @@ -0,0 +1,76 @@ +package documentationresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c DocumentationResourceClient) Delete(ctx context.Context, id DocumentationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_delete_autorest.go deleted file mode 100644 index 70d423f9ada..00000000000 --- a/resource-manager/apimanagement/2022-08-01/documentationresource/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package documentationresource - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c DocumentationResourceClient) Delete(ctx context.Context, id DocumentationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c DocumentationResourceClient) preparerForDelete(ctx context.Context, id DocumentationId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c DocumentationResourceClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_get.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_get.go new file mode 100644 index 00000000000..6bb219a02d1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/documentationresource/method_get.go @@ -0,0 +1,51 @@ +package documentationresource + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DocumentationContract +} + +// Get ... +func (c DocumentationResourceClient) Get(ctx context.Context, id DocumentationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_get_autorest.go deleted file mode 100644 index 6b1ff42de13..00000000000 --- a/resource-manager/apimanagement/2022-08-01/documentationresource/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package documentationresource - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *DocumentationContract -} - -// Get ... -func (c DocumentationResourceClient) Get(ctx context.Context, id DocumentationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c DocumentationResourceClient) preparerForGet(ctx context.Context, id DocumentationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c DocumentationResourceClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_getentitytag.go new file mode 100644 index 00000000000..2a462006188 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/documentationresource/method_getentitytag.go @@ -0,0 +1,46 @@ +package documentationresource + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c DocumentationResourceClient) GetEntityTag(ctx context.Context, id DocumentationId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_getentitytag_autorest.go deleted file mode 100644 index a93dbaf8157..00000000000 --- a/resource-manager/apimanagement/2022-08-01/documentationresource/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package documentationresource - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c DocumentationResourceClient) GetEntityTag(ctx context.Context, id DocumentationId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c DocumentationResourceClient) preparerForGetEntityTag(ctx context.Context, id DocumentationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c DocumentationResourceClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_listbyservice.go new file mode 100644 index 00000000000..fe6333d8f8c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/documentationresource/method_listbyservice.go @@ -0,0 +1,125 @@ +package documentationresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DocumentationContract +} + +type ListByServiceCompleteResult struct { + Items []DocumentationContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c DocumentationResourceClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/documentations", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DocumentationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c DocumentationResourceClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DocumentationContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DocumentationResourceClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate DocumentationContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]DocumentationContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_listbyservice_autorest.go deleted file mode 100644 index 2c9d3da0f67..00000000000 --- a/resource-manager/apimanagement/2022-08-01/documentationresource/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package documentationresource - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]DocumentationContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []DocumentationContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c DocumentationResourceClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c DocumentationResourceClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/documentations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c DocumentationResourceClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c DocumentationResourceClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []DocumentationContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c DocumentationResourceClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, DocumentationContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DocumentationResourceClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate DocumentationContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]DocumentationContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_update.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_update.go new file mode 100644 index 00000000000..440a0e90747 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/documentationresource/method_update.go @@ -0,0 +1,84 @@ +package documentationresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DocumentationContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c DocumentationResourceClient) Update(ctx context.Context, id DocumentationId, input DocumentationUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/documentationresource/method_update_autorest.go deleted file mode 100644 index ebde148c0ac..00000000000 --- a/resource-manager/apimanagement/2022-08-01/documentationresource/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package documentationresource - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *DocumentationContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c DocumentationResourceClient) Update(ctx context.Context, id DocumentationId, input DocumentationUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "documentationresource.DocumentationResourceClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c DocumentationResourceClient) preparerForUpdate(ctx context.Context, id DocumentationId, input DocumentationUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c DocumentationResourceClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplate/client.go b/resource-manager/apimanagement/2022-08-01/emailtemplate/client.go index fcf62feaf0d..b615036a9e1 100644 --- a/resource-manager/apimanagement/2022-08-01/emailtemplate/client.go +++ b/resource-manager/apimanagement/2022-08-01/emailtemplate/client.go @@ -1,18 +1,26 @@ package emailtemplate -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type EmailTemplateClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewEmailTemplateClientWithBaseURI(endpoint string) EmailTemplateClient { - return EmailTemplateClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewEmailTemplateClientWithBaseURI(api sdkEnv.Api) (*EmailTemplateClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "emailtemplate", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating EmailTemplateClient: %+v", err) } + + return &EmailTemplateClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplate/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/emailtemplate/method_listbyservice.go new file mode 100644 index 00000000000..ece5fedb586 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/emailtemplate/method_listbyservice.go @@ -0,0 +1,125 @@ +package emailtemplate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]EmailTemplateContract +} + +type ListByServiceCompleteResult struct { + Items []EmailTemplateContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c EmailTemplateClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/templates", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]EmailTemplateContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c EmailTemplateClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, EmailTemplateContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c EmailTemplateClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate EmailTemplateContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]EmailTemplateContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplate/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/emailtemplate/method_listbyservice_autorest.go deleted file mode 100644 index 69b66381ca2..00000000000 --- a/resource-manager/apimanagement/2022-08-01/emailtemplate/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package emailtemplate - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]EmailTemplateContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []EmailTemplateContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c EmailTemplateClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c EmailTemplateClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/templates", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c EmailTemplateClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c EmailTemplateClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []EmailTemplateContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplate.EmailTemplateClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c EmailTemplateClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, EmailTemplateContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c EmailTemplateClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate EmailTemplateContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]EmailTemplateContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/client.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/client.go index 9794f3dc9e2..78c7f6573ce 100644 --- a/resource-manager/apimanagement/2022-08-01/emailtemplates/client.go +++ b/resource-manager/apimanagement/2022-08-01/emailtemplates/client.go @@ -1,18 +1,26 @@ package emailtemplates -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type EmailTemplatesClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewEmailTemplatesClientWithBaseURI(endpoint string) EmailTemplatesClient { - return EmailTemplatesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewEmailTemplatesClientWithBaseURI(api sdkEnv.Api) (*EmailTemplatesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "emailtemplates", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating EmailTemplatesClient: %+v", err) } + + return &EmailTemplatesClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/constants.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/constants.go index 178c1c73651..19dadfefea4 100644 --- a/resource-manager/apimanagement/2022-08-01/emailtemplates/constants.go +++ b/resource-manager/apimanagement/2022-08-01/emailtemplates/constants.go @@ -1,6 +1,10 @@ package emailtemplates -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -43,6 +47,19 @@ func PossibleValuesForTemplateName() []string { } } +func (s *TemplateName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTemplateName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseTemplateName(input string) (*TemplateName, error) { vals := map[string]TemplateName{ "accountcloseddeveloper": TemplateNameAccountClosedDeveloper, diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatecreateorupdate.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatecreateorupdate.go new file mode 100644 index 00000000000..80154b944bc --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatecreateorupdate.go @@ -0,0 +1,85 @@ +package emailtemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EmailTemplateContract +} + +type EmailTemplateCreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultEmailTemplateCreateOrUpdateOperationOptions() EmailTemplateCreateOrUpdateOperationOptions { + return EmailTemplateCreateOrUpdateOperationOptions{} +} + +func (o EmailTemplateCreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o EmailTemplateCreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o EmailTemplateCreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// EmailTemplateCreateOrUpdate ... +func (c EmailTemplatesClient) EmailTemplateCreateOrUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateCreateOrUpdateOperationOptions) (result EmailTemplateCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatecreateorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatecreateorupdate_autorest.go deleted file mode 100644 index 3a2c54ff109..00000000000 --- a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatecreateorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package emailtemplates - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EmailTemplateCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *EmailTemplateContract -} - -type EmailTemplateCreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultEmailTemplateCreateOrUpdateOperationOptions() EmailTemplateCreateOrUpdateOperationOptions { - return EmailTemplateCreateOrUpdateOperationOptions{} -} - -func (o EmailTemplateCreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o EmailTemplateCreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// EmailTemplateCreateOrUpdate ... -func (c EmailTemplatesClient) EmailTemplateCreateOrUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateCreateOrUpdateOperationOptions) (result EmailTemplateCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForEmailTemplateCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEmailTemplateCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEmailTemplateCreateOrUpdate prepares the EmailTemplateCreateOrUpdate request. -func (c EmailTemplatesClient) preparerForEmailTemplateCreateOrUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateCreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEmailTemplateCreateOrUpdate handles the response to the EmailTemplateCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c EmailTemplatesClient) responderForEmailTemplateCreateOrUpdate(resp *http.Response) (result EmailTemplateCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatedelete.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatedelete.go new file mode 100644 index 00000000000..0edd892ed23 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatedelete.go @@ -0,0 +1,76 @@ +package emailtemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type EmailTemplateDeleteOperationOptions struct { + IfMatch *string +} + +func DefaultEmailTemplateDeleteOperationOptions() EmailTemplateDeleteOperationOptions { + return EmailTemplateDeleteOperationOptions{} +} + +func (o EmailTemplateDeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o EmailTemplateDeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o EmailTemplateDeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// EmailTemplateDelete ... +func (c EmailTemplatesClient) EmailTemplateDelete(ctx context.Context, id TemplateId, options EmailTemplateDeleteOperationOptions) (result EmailTemplateDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatedelete_autorest.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatedelete_autorest.go deleted file mode 100644 index ec2f991850a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplatedelete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package emailtemplates - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EmailTemplateDeleteOperationResponse struct { - HttpResponse *http.Response -} - -type EmailTemplateDeleteOperationOptions struct { - IfMatch *string -} - -func DefaultEmailTemplateDeleteOperationOptions() EmailTemplateDeleteOperationOptions { - return EmailTemplateDeleteOperationOptions{} -} - -func (o EmailTemplateDeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o EmailTemplateDeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// EmailTemplateDelete ... -func (c EmailTemplatesClient) EmailTemplateDelete(ctx context.Context, id TemplateId, options EmailTemplateDeleteOperationOptions) (result EmailTemplateDeleteOperationResponse, err error) { - req, err := c.preparerForEmailTemplateDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEmailTemplateDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEmailTemplateDelete prepares the EmailTemplateDelete request. -func (c EmailTemplatesClient) preparerForEmailTemplateDelete(ctx context.Context, id TemplateId, options EmailTemplateDeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEmailTemplateDelete handles the response to the EmailTemplateDelete request. The method always -// closes the http.Response Body. -func (c EmailTemplatesClient) responderForEmailTemplateDelete(resp *http.Response) (result EmailTemplateDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateget.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateget.go new file mode 100644 index 00000000000..91bd3f56c3a --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateget.go @@ -0,0 +1,51 @@ +package emailtemplates + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EmailTemplateContract +} + +// EmailTemplateGet ... +func (c EmailTemplatesClient) EmailTemplateGet(ctx context.Context, id TemplateId) (result EmailTemplateGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateget_autorest.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateget_autorest.go deleted file mode 100644 index 42f4ac52fc2..00000000000 --- a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package emailtemplates - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EmailTemplateGetOperationResponse struct { - HttpResponse *http.Response - Model *EmailTemplateContract -} - -// EmailTemplateGet ... -func (c EmailTemplatesClient) EmailTemplateGet(ctx context.Context, id TemplateId) (result EmailTemplateGetOperationResponse, err error) { - req, err := c.preparerForEmailTemplateGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEmailTemplateGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEmailTemplateGet prepares the EmailTemplateGet request. -func (c EmailTemplatesClient) preparerForEmailTemplateGet(ctx context.Context, id TemplateId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEmailTemplateGet handles the response to the EmailTemplateGet request. The method always -// closes the http.Response Body. -func (c EmailTemplatesClient) responderForEmailTemplateGet(resp *http.Response) (result EmailTemplateGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplategetentitytag.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplategetentitytag.go new file mode 100644 index 00000000000..fd7e5616549 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplategetentitytag.go @@ -0,0 +1,46 @@ +package emailtemplates + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateGetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// EmailTemplateGetEntityTag ... +func (c EmailTemplatesClient) EmailTemplateGetEntityTag(ctx context.Context, id TemplateId) (result EmailTemplateGetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplategetentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplategetentitytag_autorest.go deleted file mode 100644 index 81853d22c98..00000000000 --- a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplategetentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package emailtemplates - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EmailTemplateGetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// EmailTemplateGetEntityTag ... -func (c EmailTemplatesClient) EmailTemplateGetEntityTag(ctx context.Context, id TemplateId) (result EmailTemplateGetEntityTagOperationResponse, err error) { - req, err := c.preparerForEmailTemplateGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEmailTemplateGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateGetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEmailTemplateGetEntityTag prepares the EmailTemplateGetEntityTag request. -func (c EmailTemplatesClient) preparerForEmailTemplateGetEntityTag(ctx context.Context, id TemplateId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEmailTemplateGetEntityTag handles the response to the EmailTemplateGetEntityTag request. The method always -// closes the http.Response Body. -func (c EmailTemplatesClient) responderForEmailTemplateGetEntityTag(resp *http.Response) (result EmailTemplateGetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateupdate.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateupdate.go new file mode 100644 index 00000000000..5e5c6f703f2 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateupdate.go @@ -0,0 +1,84 @@ +package emailtemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EmailTemplateUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *EmailTemplateContract +} + +type EmailTemplateUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultEmailTemplateUpdateOperationOptions() EmailTemplateUpdateOperationOptions { + return EmailTemplateUpdateOperationOptions{} +} + +func (o EmailTemplateUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o EmailTemplateUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o EmailTemplateUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// EmailTemplateUpdate ... +func (c EmailTemplatesClient) EmailTemplateUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateUpdateOperationOptions) (result EmailTemplateUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateupdate_autorest.go deleted file mode 100644 index c53ed3c1cf7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/emailtemplates/method_emailtemplateupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package emailtemplates - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EmailTemplateUpdateOperationResponse struct { - HttpResponse *http.Response - Model *EmailTemplateContract -} - -type EmailTemplateUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultEmailTemplateUpdateOperationOptions() EmailTemplateUpdateOperationOptions { - return EmailTemplateUpdateOperationOptions{} -} - -func (o EmailTemplateUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o EmailTemplateUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// EmailTemplateUpdate ... -func (c EmailTemplatesClient) EmailTemplateUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateUpdateOperationOptions) (result EmailTemplateUpdateOperationResponse, err error) { - req, err := c.preparerForEmailTemplateUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEmailTemplateUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "emailtemplates.EmailTemplatesClient", "EmailTemplateUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEmailTemplateUpdate prepares the EmailTemplateUpdate request. -func (c EmailTemplatesClient) preparerForEmailTemplateUpdate(ctx context.Context, id TemplateId, input EmailTemplateUpdateParameters, options EmailTemplateUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEmailTemplateUpdate handles the response to the EmailTemplateUpdate request. The method always -// closes the http.Response Body. -func (c EmailTemplatesClient) responderForEmailTemplateUpdate(resp *http.Response) (result EmailTemplateUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/client.go b/resource-manager/apimanagement/2022-08-01/gateway/client.go index a88c9cdaf70..52986157195 100644 --- a/resource-manager/apimanagement/2022-08-01/gateway/client.go +++ b/resource-manager/apimanagement/2022-08-01/gateway/client.go @@ -1,18 +1,26 @@ package gateway -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayClientWithBaseURI(endpoint string) GatewayClient { - return GatewayClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayClientWithBaseURI(api sdkEnv.Api) (*GatewayClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gateway", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayClient: %+v", err) } + + return &GatewayClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/gateway/method_createorupdate.go new file mode 100644 index 00000000000..b166d062bf3 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gateway/method_createorupdate.go @@ -0,0 +1,85 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GatewayClient) CreateOrUpdate(ctx context.Context, id GatewayId, input GatewayContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/gateway/method_createorupdate_autorest.go deleted file mode 100644 index 6dd5cff75d6..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gateway/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package gateway - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *GatewayContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c GatewayClient) CreateOrUpdate(ctx context.Context, id GatewayId, input GatewayContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GatewayClient) preparerForCreateOrUpdate(ctx context.Context, id GatewayId, input GatewayContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_delete.go b/resource-manager/apimanagement/2022-08-01/gateway/method_delete.go new file mode 100644 index 00000000000..34c8698ad34 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gateway/method_delete.go @@ -0,0 +1,76 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GatewayClient) Delete(ctx context.Context, id GatewayId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/gateway/method_delete_autorest.go deleted file mode 100644 index 1f3f99da15b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gateway/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package gateway - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c GatewayClient) Delete(ctx context.Context, id GatewayId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GatewayClient) preparerForDelete(ctx context.Context, id GatewayId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_get.go b/resource-manager/apimanagement/2022-08-01/gateway/method_get.go new file mode 100644 index 00000000000..73393157e02 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gateway/method_get.go @@ -0,0 +1,51 @@ +package gateway + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayContract +} + +// Get ... +func (c GatewayClient) Get(ctx context.Context, id GatewayId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/gateway/method_get_autorest.go deleted file mode 100644 index 516262b26c0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gateway/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package gateway - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *GatewayContract -} - -// Get ... -func (c GatewayClient) Get(ctx context.Context, id GatewayId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c GatewayClient) preparerForGet(ctx context.Context, id GatewayId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/gateway/method_getentitytag.go new file mode 100644 index 00000000000..34c8cd8439b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gateway/method_getentitytag.go @@ -0,0 +1,46 @@ +package gateway + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayClient) GetEntityTag(ctx context.Context, id GatewayId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/gateway/method_getentitytag_autorest.go deleted file mode 100644 index 023b4dd2c1b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gateway/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package gateway - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GatewayClient) GetEntityTag(ctx context.Context, id GatewayId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GatewayClient) preparerForGetEntityTag(ctx context.Context, id GatewayId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/gateway/method_listbyservice.go new file mode 100644 index 00000000000..2e1953f23da --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gateway/method_listbyservice.go @@ -0,0 +1,125 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayContract +} + +type ListByServiceCompleteResult struct { + Items []GatewayContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/gateways", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GatewayContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate GatewayContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GatewayContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/gateway/method_listbyservice_autorest.go deleted file mode 100644 index 6bef69b64f7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gateway/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package gateway - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]GatewayContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []GatewayContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c GatewayClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c GatewayClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/gateways", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c GatewayClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []GatewayContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c GatewayClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GatewayClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate GatewayContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]GatewayContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_update.go b/resource-manager/apimanagement/2022-08-01/gateway/method_update.go new file mode 100644 index 00000000000..fcf2126f5bd --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gateway/method_update.go @@ -0,0 +1,84 @@ +package gateway + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c GatewayClient) Update(ctx context.Context, id GatewayId, input GatewayContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gateway/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/gateway/method_update_autorest.go deleted file mode 100644 index f307a2b614f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gateway/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package gateway - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *GatewayContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c GatewayClient) Update(ctx context.Context, id GatewayId, input GatewayContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gateway.GatewayClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c GatewayClient) preparerForUpdate(ctx context.Context, id GatewayId, input GatewayContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c GatewayClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/client.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/client.go index 46a46094cd5..b0d3e6d9914 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewayapi/client.go +++ b/resource-manager/apimanagement/2022-08-01/gatewayapi/client.go @@ -1,18 +1,26 @@ package gatewayapi -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayApiClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayApiClientWithBaseURI(endpoint string) GatewayApiClient { - return GatewayApiClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayApiClientWithBaseURI(api sdkEnv.Api) (*GatewayApiClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewayapi", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayApiClient: %+v", err) } + + return &GatewayApiClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/constants.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/constants.go index 0be8c860d66..0da8f569039 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewayapi/constants.go +++ b/resource-manager/apimanagement/2022-08-01/gatewayapi/constants.go @@ -1,6 +1,10 @@ package gatewayapi -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -85,6 +115,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, @@ -113,6 +156,19 @@ func PossibleValuesForProvisioningState() []string { } } +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ "created": ProvisioningStateCreated, @@ -142,6 +198,19 @@ func PossibleValuesForVersioningScheme() []string { } } +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVersioningScheme(input string) (*VersioningScheme, error) { vals := map[string]VersioningScheme{ "header": VersioningSchemeHeader, diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_createorupdate.go new file mode 100644 index 00000000000..8fd635de876 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_createorupdate.go @@ -0,0 +1,56 @@ +package gatewayapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +// CreateOrUpdate ... +func (c GatewayApiClient) CreateOrUpdate(ctx context.Context, id GatewayApiId, input AssociationContract) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_createorupdate_autorest.go deleted file mode 100644 index e8e7ed2c7aa..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package gatewayapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiContract -} - -// CreateOrUpdate ... -func (c GatewayApiClient) CreateOrUpdate(ctx context.Context, id GatewayApiId, input AssociationContract) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GatewayApiClient) preparerForCreateOrUpdate(ctx context.Context, id GatewayApiId, input AssociationContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GatewayApiClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_delete.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_delete.go new file mode 100644 index 00000000000..293176f784a --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_delete.go @@ -0,0 +1,47 @@ +package gatewayapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c GatewayApiClient) Delete(ctx context.Context, id GatewayApiId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_delete_autorest.go deleted file mode 100644 index 5da91051687..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package gatewayapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c GatewayApiClient) Delete(ctx context.Context, id GatewayApiId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GatewayApiClient) preparerForDelete(ctx context.Context, id GatewayApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GatewayApiClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_getentitytag.go new file mode 100644 index 00000000000..e14c0b61f72 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_getentitytag.go @@ -0,0 +1,46 @@ +package gatewayapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayApiClient) GetEntityTag(ctx context.Context, id GatewayApiId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_getentitytag_autorest.go deleted file mode 100644 index 9d658fd84a6..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package gatewayapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GatewayApiClient) GetEntityTag(ctx context.Context, id GatewayApiId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GatewayApiClient) preparerForGetEntityTag(ctx context.Context, id GatewayApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GatewayApiClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_listbyservice.go new file mode 100644 index 00000000000..478f87c8195 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_listbyservice.go @@ -0,0 +1,125 @@ +package gatewayapi + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiContract +} + +type ListByServiceCompleteResult struct { + Items []ApiContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayApiClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apis", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayApiClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayApiClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate ApiContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ApiContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/method_listbyservice_autorest.go deleted file mode 100644 index d219bb643d7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewayapi/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package gatewayapi - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ApiContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c GatewayApiClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c GatewayApiClient) preparerForListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/apis", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c GatewayApiClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c GatewayApiClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ApiContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayapi.GatewayApiClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c GatewayApiClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GatewayApiClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate ApiContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ApiContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/client.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/client.go index 05f22b3b215..889bdd77712 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/client.go +++ b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/client.go @@ -1,18 +1,26 @@ package gatewaycertificateauthority -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayCertificateAuthorityClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayCertificateAuthorityClientWithBaseURI(endpoint string) GatewayCertificateAuthorityClient { - return GatewayCertificateAuthorityClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayCertificateAuthorityClientWithBaseURI(api sdkEnv.Api) (*GatewayCertificateAuthorityClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewaycertificateauthority", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayCertificateAuthorityClient: %+v", err) } + + return &GatewayCertificateAuthorityClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_createorupdate.go new file mode 100644 index 00000000000..a982aaf94c4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_createorupdate.go @@ -0,0 +1,85 @@ +package gatewaycertificateauthority + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayCertificateAuthorityContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GatewayCertificateAuthorityClient) CreateOrUpdate(ctx context.Context, id CertificateAuthorityId, input GatewayCertificateAuthorityContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_createorupdate_autorest.go deleted file mode 100644 index 4e7230468d3..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package gatewaycertificateauthority - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *GatewayCertificateAuthorityContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c GatewayCertificateAuthorityClient) CreateOrUpdate(ctx context.Context, id CertificateAuthorityId, input GatewayCertificateAuthorityContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GatewayCertificateAuthorityClient) preparerForCreateOrUpdate(ctx context.Context, id CertificateAuthorityId, input GatewayCertificateAuthorityContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GatewayCertificateAuthorityClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_delete.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_delete.go new file mode 100644 index 00000000000..ee1deb63010 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_delete.go @@ -0,0 +1,76 @@ +package gatewaycertificateauthority + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GatewayCertificateAuthorityClient) Delete(ctx context.Context, id CertificateAuthorityId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_delete_autorest.go deleted file mode 100644 index 0f9df6ed8a0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package gatewaycertificateauthority - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c GatewayCertificateAuthorityClient) Delete(ctx context.Context, id CertificateAuthorityId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GatewayCertificateAuthorityClient) preparerForDelete(ctx context.Context, id CertificateAuthorityId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GatewayCertificateAuthorityClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_get.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_get.go new file mode 100644 index 00000000000..12ff864df7c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_get.go @@ -0,0 +1,51 @@ +package gatewaycertificateauthority + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayCertificateAuthorityContract +} + +// Get ... +func (c GatewayCertificateAuthorityClient) Get(ctx context.Context, id CertificateAuthorityId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_get_autorest.go deleted file mode 100644 index c858b3b46b5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package gatewaycertificateauthority - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *GatewayCertificateAuthorityContract -} - -// Get ... -func (c GatewayCertificateAuthorityClient) Get(ctx context.Context, id CertificateAuthorityId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c GatewayCertificateAuthorityClient) preparerForGet(ctx context.Context, id CertificateAuthorityId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c GatewayCertificateAuthorityClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_getentitytag.go new file mode 100644 index 00000000000..cc382dbb6d8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_getentitytag.go @@ -0,0 +1,46 @@ +package gatewaycertificateauthority + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayCertificateAuthorityClient) GetEntityTag(ctx context.Context, id CertificateAuthorityId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_getentitytag_autorest.go deleted file mode 100644 index 642eee2277d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package gatewaycertificateauthority - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GatewayCertificateAuthorityClient) GetEntityTag(ctx context.Context, id CertificateAuthorityId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GatewayCertificateAuthorityClient) preparerForGetEntityTag(ctx context.Context, id CertificateAuthorityId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GatewayCertificateAuthorityClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_listbyservice.go new file mode 100644 index 00000000000..3b24a4a53a6 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_listbyservice.go @@ -0,0 +1,125 @@ +package gatewaycertificateauthority + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayCertificateAuthorityContract +} + +type ListByServiceCompleteResult struct { + Items []GatewayCertificateAuthorityContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayCertificateAuthorityClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/certificateAuthorities", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GatewayCertificateAuthorityContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayCertificateAuthorityClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayCertificateAuthorityContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayCertificateAuthorityClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate GatewayCertificateAuthorityContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GatewayCertificateAuthorityContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_listbyservice_autorest.go deleted file mode 100644 index e629cd90912..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package gatewaycertificateauthority - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]GatewayCertificateAuthorityContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []GatewayCertificateAuthorityContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c GatewayCertificateAuthorityClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c GatewayCertificateAuthorityClient) preparerForListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/certificateAuthorities", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c GatewayCertificateAuthorityClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c GatewayCertificateAuthorityClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []GatewayCertificateAuthorityContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaycertificateauthority.GatewayCertificateAuthorityClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c GatewayCertificateAuthorityClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayCertificateAuthorityContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GatewayCertificateAuthorityClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate GatewayCertificateAuthorityContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]GatewayCertificateAuthorityContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/client.go b/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/client.go index 5eef6f835aa..85d00532dc6 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/client.go +++ b/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/client.go @@ -1,18 +1,26 @@ package gatewaygeneratetoken -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayGenerateTokenClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayGenerateTokenClientWithBaseURI(endpoint string) GatewayGenerateTokenClient { - return GatewayGenerateTokenClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayGenerateTokenClientWithBaseURI(api sdkEnv.Api) (*GatewayGenerateTokenClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewaygeneratetoken", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayGenerateTokenClient: %+v", err) } + + return &GatewayGenerateTokenClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/constants.go b/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/constants.go index 2b5b29d0556..23e4c225a32 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/constants.go +++ b/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/constants.go @@ -1,6 +1,10 @@ package gatewaygeneratetoken -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForKeyType() []string { } } +func (s *KeyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKeyType(input string) (*KeyType, error) { vals := map[string]KeyType{ "primary": KeyTypePrimary, diff --git a/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken.go b/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken.go new file mode 100644 index 00000000000..3c75500bfd1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken.go @@ -0,0 +1,56 @@ +package gatewaygeneratetoken + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayGenerateTokenOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayTokenContract +} + +// GatewayGenerateToken ... +func (c GatewayGenerateTokenClient) GatewayGenerateToken(ctx context.Context, id GatewayId, input GatewayTokenRequestContract) (result GatewayGenerateTokenOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateToken", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken_autorest.go deleted file mode 100644 index cec0cc96400..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/method_gatewaygeneratetoken_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package gatewaygeneratetoken - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GatewayGenerateTokenOperationResponse struct { - HttpResponse *http.Response - Model *GatewayTokenContract -} - -// GatewayGenerateToken ... -func (c GatewayGenerateTokenClient) GatewayGenerateToken(ctx context.Context, id GatewayId, input GatewayTokenRequestContract) (result GatewayGenerateTokenOperationResponse, err error) { - req, err := c.preparerForGatewayGenerateToken(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaygeneratetoken.GatewayGenerateTokenClient", "GatewayGenerateToken", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaygeneratetoken.GatewayGenerateTokenClient", "GatewayGenerateToken", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGatewayGenerateToken(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaygeneratetoken.GatewayGenerateTokenClient", "GatewayGenerateToken", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGatewayGenerateToken prepares the GatewayGenerateToken request. -func (c GatewayGenerateTokenClient) preparerForGatewayGenerateToken(ctx context.Context, id GatewayId, input GatewayTokenRequestContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/generateToken", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGatewayGenerateToken handles the response to the GatewayGenerateToken request. The method always -// closes the http.Response Body. -func (c GatewayGenerateTokenClient) responderForGatewayGenerateToken(resp *http.Response) (result GatewayGenerateTokenOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/client.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/client.go index d6e83f1d02e..44a535d1be6 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/client.go +++ b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/client.go @@ -1,18 +1,26 @@ package gatewayhostnameconfiguration -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayHostnameConfigurationClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayHostnameConfigurationClientWithBaseURI(endpoint string) GatewayHostnameConfigurationClient { - return GatewayHostnameConfigurationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayHostnameConfigurationClientWithBaseURI(api sdkEnv.Api) (*GatewayHostnameConfigurationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewayhostnameconfiguration", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayHostnameConfigurationClient: %+v", err) } + + return &GatewayHostnameConfigurationClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_createorupdate.go new file mode 100644 index 00000000000..1a362be1c96 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_createorupdate.go @@ -0,0 +1,85 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayHostnameConfigurationContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GatewayHostnameConfigurationClient) CreateOrUpdate(ctx context.Context, id HostnameConfigurationId, input GatewayHostnameConfigurationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_createorupdate_autorest.go deleted file mode 100644 index 1636e17ebb1..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package gatewayhostnameconfiguration - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *GatewayHostnameConfigurationContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c GatewayHostnameConfigurationClient) CreateOrUpdate(ctx context.Context, id HostnameConfigurationId, input GatewayHostnameConfigurationContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GatewayHostnameConfigurationClient) preparerForCreateOrUpdate(ctx context.Context, id HostnameConfigurationId, input GatewayHostnameConfigurationContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GatewayHostnameConfigurationClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_delete.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_delete.go new file mode 100644 index 00000000000..d36e0d55e20 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_delete.go @@ -0,0 +1,76 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GatewayHostnameConfigurationClient) Delete(ctx context.Context, id HostnameConfigurationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_delete_autorest.go deleted file mode 100644 index 64f4fa809d7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package gatewayhostnameconfiguration - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c GatewayHostnameConfigurationClient) Delete(ctx context.Context, id HostnameConfigurationId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GatewayHostnameConfigurationClient) preparerForDelete(ctx context.Context, id HostnameConfigurationId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GatewayHostnameConfigurationClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_get.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_get.go new file mode 100644 index 00000000000..f1f5ec6b270 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_get.go @@ -0,0 +1,51 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayHostnameConfigurationContract +} + +// Get ... +func (c GatewayHostnameConfigurationClient) Get(ctx context.Context, id HostnameConfigurationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_get_autorest.go deleted file mode 100644 index be5cbec23ca..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package gatewayhostnameconfiguration - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *GatewayHostnameConfigurationContract -} - -// Get ... -func (c GatewayHostnameConfigurationClient) Get(ctx context.Context, id HostnameConfigurationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c GatewayHostnameConfigurationClient) preparerForGet(ctx context.Context, id HostnameConfigurationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c GatewayHostnameConfigurationClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_getentitytag.go new file mode 100644 index 00000000000..76b08b4e076 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_getentitytag.go @@ -0,0 +1,46 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GatewayHostnameConfigurationClient) GetEntityTag(ctx context.Context, id HostnameConfigurationId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_getentitytag_autorest.go deleted file mode 100644 index 424ecbb64c0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package gatewayhostnameconfiguration - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GatewayHostnameConfigurationClient) GetEntityTag(ctx context.Context, id HostnameConfigurationId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GatewayHostnameConfigurationClient) preparerForGetEntityTag(ctx context.Context, id HostnameConfigurationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GatewayHostnameConfigurationClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_listbyservice.go new file mode 100644 index 00000000000..6842b2c14d3 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_listbyservice.go @@ -0,0 +1,125 @@ +package gatewayhostnameconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GatewayHostnameConfigurationContract +} + +type ListByServiceCompleteResult struct { + Items []GatewayHostnameConfigurationContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GatewayHostnameConfigurationClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/hostnameConfigurations", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GatewayHostnameConfigurationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GatewayHostnameConfigurationClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayHostnameConfigurationContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GatewayHostnameConfigurationClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate GatewayHostnameConfigurationContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GatewayHostnameConfigurationContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_listbyservice_autorest.go deleted file mode 100644 index ce7ed9c80f0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package gatewayhostnameconfiguration - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]GatewayHostnameConfigurationContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []GatewayHostnameConfigurationContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c GatewayHostnameConfigurationClient) ListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c GatewayHostnameConfigurationClient) preparerForListByService(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/hostnameConfigurations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c GatewayHostnameConfigurationClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c GatewayHostnameConfigurationClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []GatewayHostnameConfigurationContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayhostnameconfiguration.GatewayHostnameConfigurationClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c GatewayHostnameConfigurationClient) ListByServiceComplete(ctx context.Context, id GatewayId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GatewayHostnameConfigurationContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GatewayHostnameConfigurationClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id GatewayId, options ListByServiceOperationOptions, predicate GatewayHostnameConfigurationContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]GatewayHostnameConfigurationContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/client.go b/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/client.go index 01978a51eaa..3da598944dd 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/client.go +++ b/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/client.go @@ -1,18 +1,26 @@ package gatewaylistkeys -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayListKeysClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayListKeysClientWithBaseURI(endpoint string) GatewayListKeysClient { - return GatewayListKeysClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayListKeysClientWithBaseURI(api sdkEnv.Api) (*GatewayListKeysClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewaylistkeys", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayListKeysClient: %+v", err) } + + return &GatewayListKeysClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/method_gatewaylistkeys.go b/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/method_gatewaylistkeys.go new file mode 100644 index 00000000000..8fc1104a3b3 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/method_gatewaylistkeys.go @@ -0,0 +1,52 @@ +package gatewaylistkeys + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayListKeysOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GatewayKeysContract +} + +// GatewayListKeys ... +func (c GatewayListKeysClient) GatewayListKeys(ctx context.Context, id GatewayId) (result GatewayListKeysOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listKeys", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/method_gatewaylistkeys_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/method_gatewaylistkeys_autorest.go deleted file mode 100644 index 3ad468fa9f9..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/method_gatewaylistkeys_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package gatewaylistkeys - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GatewayListKeysOperationResponse struct { - HttpResponse *http.Response - Model *GatewayKeysContract -} - -// GatewayListKeys ... -func (c GatewayListKeysClient) GatewayListKeys(ctx context.Context, id GatewayId) (result GatewayListKeysOperationResponse, err error) { - req, err := c.preparerForGatewayListKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaylistkeys.GatewayListKeysClient", "GatewayListKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaylistkeys.GatewayListKeysClient", "GatewayListKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGatewayListKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewaylistkeys.GatewayListKeysClient", "GatewayListKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGatewayListKeys prepares the GatewayListKeys request. -func (c GatewayListKeysClient) preparerForGatewayListKeys(ctx context.Context, id GatewayId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGatewayListKeys handles the response to the GatewayListKeys request. The method always -// closes the http.Response Body. -func (c GatewayListKeysClient) responderForGatewayListKeys(resp *http.Response) (result GatewayListKeysOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/client.go b/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/client.go index 68eee704676..b937a665eb7 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/client.go +++ b/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/client.go @@ -1,18 +1,26 @@ package gatewayregeneratekey -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GatewayRegenerateKeyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGatewayRegenerateKeyClientWithBaseURI(endpoint string) GatewayRegenerateKeyClient { - return GatewayRegenerateKeyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGatewayRegenerateKeyClientWithBaseURI(api sdkEnv.Api) (*GatewayRegenerateKeyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "gatewayregeneratekey", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GatewayRegenerateKeyClient: %+v", err) } + + return &GatewayRegenerateKeyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/constants.go b/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/constants.go index e69fb786bb4..f8762636760 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/constants.go +++ b/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/constants.go @@ -1,6 +1,10 @@ package gatewayregeneratekey -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForKeyType() []string { } } +func (s *KeyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKeyType(input string) (*KeyType, error) { vals := map[string]KeyType{ "primary": KeyTypePrimary, diff --git a/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/method_gatewayregeneratekey.go b/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/method_gatewayregeneratekey.go new file mode 100644 index 00000000000..8783e036af9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/method_gatewayregeneratekey.go @@ -0,0 +1,51 @@ +package gatewayregeneratekey + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayRegenerateKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GatewayRegenerateKey ... +func (c GatewayRegenerateKeyClient) GatewayRegenerateKey(ctx context.Context, id GatewayId, input GatewayKeyRegenerationRequestContract) (result GatewayRegenerateKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/method_gatewayregeneratekey_autorest.go b/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/method_gatewayregeneratekey_autorest.go deleted file mode 100644 index 944a561ab8b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/method_gatewayregeneratekey_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package gatewayregeneratekey - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GatewayRegenerateKeyOperationResponse struct { - HttpResponse *http.Response -} - -// GatewayRegenerateKey ... -func (c GatewayRegenerateKeyClient) GatewayRegenerateKey(ctx context.Context, id GatewayId, input GatewayKeyRegenerationRequestContract) (result GatewayRegenerateKeyOperationResponse, err error) { - req, err := c.preparerForGatewayRegenerateKey(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayregeneratekey.GatewayRegenerateKeyClient", "GatewayRegenerateKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayregeneratekey.GatewayRegenerateKeyClient", "GatewayRegenerateKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGatewayRegenerateKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "gatewayregeneratekey.GatewayRegenerateKeyClient", "GatewayRegenerateKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGatewayRegenerateKey prepares the GatewayRegenerateKey request. -func (c GatewayRegenerateKeyClient) preparerForGatewayRegenerateKey(ctx context.Context, id GatewayId, input GatewayKeyRegenerationRequestContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGatewayRegenerateKey handles the response to the GatewayRegenerateKey request. The method always -// closes the http.Response Body. -func (c GatewayRegenerateKeyClient) responderForGatewayRegenerateKey(resp *http.Response) (result GatewayRegenerateKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/client.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/client.go index dbfd2a175f4..8d670ad680f 100644 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/client.go +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/client.go @@ -1,18 +1,26 @@ package graphqlapiresolver -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GraphQLApiResolverClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGraphQLApiResolverClientWithBaseURI(endpoint string) GraphQLApiResolverClient { - return GraphQLApiResolverClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGraphQLApiResolverClientWithBaseURI(api sdkEnv.Api) (*GraphQLApiResolverClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "graphqlapiresolver", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GraphQLApiResolverClient: %+v", err) } + + return &GraphQLApiResolverClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_createorupdate.go new file mode 100644 index 00000000000..12e81075cb8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_createorupdate.go @@ -0,0 +1,85 @@ +package graphqlapiresolver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ResolverContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GraphQLApiResolverClient) CreateOrUpdate(ctx context.Context, id ResolverId, input ResolverContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_createorupdate_autorest.go deleted file mode 100644 index 3c04d258ca6..00000000000 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package graphqlapiresolver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ResolverContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c GraphQLApiResolverClient) CreateOrUpdate(ctx context.Context, id ResolverId, input ResolverContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GraphQLApiResolverClient) preparerForCreateOrUpdate(ctx context.Context, id ResolverId, input ResolverContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GraphQLApiResolverClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_delete.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_delete.go new file mode 100644 index 00000000000..8cc0fdc47a5 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_delete.go @@ -0,0 +1,76 @@ +package graphqlapiresolver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GraphQLApiResolverClient) Delete(ctx context.Context, id ResolverId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_delete_autorest.go deleted file mode 100644 index 5e13100b737..00000000000 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package graphqlapiresolver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c GraphQLApiResolverClient) Delete(ctx context.Context, id ResolverId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GraphQLApiResolverClient) preparerForDelete(ctx context.Context, id ResolverId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GraphQLApiResolverClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_get.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_get.go new file mode 100644 index 00000000000..bf75697111f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_get.go @@ -0,0 +1,51 @@ +package graphqlapiresolver + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ResolverContract +} + +// Get ... +func (c GraphQLApiResolverClient) Get(ctx context.Context, id ResolverId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_get_autorest.go deleted file mode 100644 index 38d04eb19b8..00000000000 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package graphqlapiresolver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ResolverContract -} - -// Get ... -func (c GraphQLApiResolverClient) Get(ctx context.Context, id ResolverId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c GraphQLApiResolverClient) preparerForGet(ctx context.Context, id ResolverId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c GraphQLApiResolverClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_getentitytag.go new file mode 100644 index 00000000000..8b234a108a8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_getentitytag.go @@ -0,0 +1,46 @@ +package graphqlapiresolver + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GraphQLApiResolverClient) GetEntityTag(ctx context.Context, id ResolverId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_getentitytag_autorest.go deleted file mode 100644 index 5776112824d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package graphqlapiresolver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GraphQLApiResolverClient) GetEntityTag(ctx context.Context, id ResolverId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GraphQLApiResolverClient) preparerForGetEntityTag(ctx context.Context, id ResolverId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GraphQLApiResolverClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_listbyapi.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_listbyapi.go new file mode 100644 index 00000000000..2b2b84c7958 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_listbyapi.go @@ -0,0 +1,125 @@ +package graphqlapiresolver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ResolverContract +} + +type ListByApiCompleteResult struct { + Items []ResolverContract +} + +type ListByApiOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByApiOperationOptions() ListByApiOperationOptions { + return ListByApiOperationOptions{} +} + +func (o ListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByApi ... +func (c GraphQLApiResolverClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/resolvers", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ResolverContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByApiComplete retrieves all the results into a single object +func (c GraphQLApiResolverClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { + return c.ListByApiCompleteMatchingPredicate(ctx, id, options, ResolverContractOperationPredicate{}) +} + +// ListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GraphQLApiResolverClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate ResolverContractOperationPredicate) (result ListByApiCompleteResult, err error) { + items := make([]ResolverContract, 0) + + resp, err := c.ListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_listbyapi_autorest.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_listbyapi_autorest.go deleted file mode 100644 index 737fd0e185f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_listbyapi_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package graphqlapiresolver - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByApiOperationResponse struct { - HttpResponse *http.Response - Model *[]ResolverContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByApiOperationResponse, error) -} - -type ListByApiCompleteResult struct { - Items []ResolverContract -} - -func (r ListByApiOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByApiOperationResponse) LoadMore(ctx context.Context) (resp ListByApiOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByApiOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByApiOperationOptions() ListByApiOperationOptions { - return ListByApiOperationOptions{} -} - -func (o ListByApiOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByApiOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByApi ... -func (c GraphQLApiResolverClient) ListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (resp ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApi(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "ListByApi", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "ListByApi", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByApi(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "ListByApi", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByApi prepares the ListByApi request. -func (c GraphQLApiResolverClient) preparerForListByApi(ctx context.Context, id ApiId, options ListByApiOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/resolvers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByApiWithNextLink prepares the ListByApi request with the given nextLink token. -func (c GraphQLApiResolverClient) preparerForListByApiWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByApi handles the response to the ListByApi request. The method always -// closes the http.Response Body. -func (c GraphQLApiResolverClient) responderForListByApi(resp *http.Response) (result ListByApiOperationResponse, err error) { - type page struct { - Values []ResolverContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApiWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "ListByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "ListByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "ListByApi", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByApiComplete retrieves all of the results into a single object -func (c GraphQLApiResolverClient) ListByApiComplete(ctx context.Context, id ApiId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { - return c.ListByApiCompleteMatchingPredicate(ctx, id, options, ResolverContractOperationPredicate{}) -} - -// ListByApiCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GraphQLApiResolverClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ApiId, options ListByApiOperationOptions, predicate ResolverContractOperationPredicate) (resp ListByApiCompleteResult, err error) { - items := make([]ResolverContract, 0) - - page, err := c.ListByApi(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByApiCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_update.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_update.go new file mode 100644 index 00000000000..e7fdfb45c02 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_update.go @@ -0,0 +1,84 @@ +package graphqlapiresolver + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ResolverContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c GraphQLApiResolverClient) Update(ctx context.Context, id ResolverId, input ResolverUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_update_autorest.go deleted file mode 100644 index 2efaa46ef89..00000000000 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package graphqlapiresolver - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *ResolverContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c GraphQLApiResolverClient) Update(ctx context.Context, id ResolverId, input ResolverUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolver.GraphQLApiResolverClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c GraphQLApiResolverClient) preparerForUpdate(ctx context.Context, id ResolverId, input ResolverUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c GraphQLApiResolverClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/client.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/client.go index e2de745a777..9ee22066c62 100644 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/client.go +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/client.go @@ -1,18 +1,26 @@ package graphqlapiresolverpolicy -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GraphQLApiResolverPolicyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGraphQLApiResolverPolicyClientWithBaseURI(endpoint string) GraphQLApiResolverPolicyClient { - return GraphQLApiResolverPolicyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGraphQLApiResolverPolicyClientWithBaseURI(api sdkEnv.Api) (*GraphQLApiResolverPolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "graphqlapiresolverpolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GraphQLApiResolverPolicyClient: %+v", err) } + + return &GraphQLApiResolverPolicyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/constants.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/constants.go index c234bd2e482..dac91618621 100644 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/constants.go +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/constants.go @@ -1,6 +1,10 @@ package graphqlapiresolverpolicy -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPolicyContentFormat() []string { } } +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { vals := map[string]PolicyContentFormat{ "rawxml": PolicyContentFormatRawxml, @@ -53,6 +70,19 @@ func PossibleValuesForPolicyExportFormat() []string { } } +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { vals := map[string]PolicyExportFormat{ "rawxml": PolicyExportFormatRawxml, diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_createorupdate.go new file mode 100644 index 00000000000..5ec63ae65a4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_createorupdate.go @@ -0,0 +1,85 @@ +package graphqlapiresolverpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GraphQLApiResolverPolicyClient) CreateOrUpdate(ctx context.Context, id ResolverId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_createorupdate_autorest.go deleted file mode 100644 index b0684a787af..00000000000 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package graphqlapiresolverpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c GraphQLApiResolverPolicyClient) CreateOrUpdate(ctx context.Context, id ResolverId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GraphQLApiResolverPolicyClient) preparerForCreateOrUpdate(ctx context.Context, id ResolverId, input PolicyContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GraphQLApiResolverPolicyClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_delete.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_delete.go new file mode 100644 index 00000000000..5e547dd0eb1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_delete.go @@ -0,0 +1,76 @@ +package graphqlapiresolverpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GraphQLApiResolverPolicyClient) Delete(ctx context.Context, id ResolverId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_delete_autorest.go deleted file mode 100644 index 97c2c5cc21d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_delete_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package graphqlapiresolverpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c GraphQLApiResolverPolicyClient) Delete(ctx context.Context, id ResolverId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GraphQLApiResolverPolicyClient) preparerForDelete(ctx context.Context, id ResolverId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GraphQLApiResolverPolicyClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_get.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_get.go new file mode 100644 index 00000000000..ceda2268db8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_get.go @@ -0,0 +1,80 @@ +package graphqlapiresolverpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c GraphQLApiResolverPolicyClient) Get(ctx context.Context, id ResolverId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_get_autorest.go deleted file mode 100644 index d65ead5108c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_get_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package graphqlapiresolverpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type GetOperationOptions struct { - Format *PolicyExportFormat -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - return out -} - -// Get ... -func (c GraphQLApiResolverPolicyClient) Get(ctx context.Context, id ResolverId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c GraphQLApiResolverPolicyClient) preparerForGet(ctx context.Context, id ResolverId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c GraphQLApiResolverPolicyClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_getentitytag.go new file mode 100644 index 00000000000..74dcf82b122 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_getentitytag.go @@ -0,0 +1,47 @@ +package graphqlapiresolverpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GraphQLApiResolverPolicyClient) GetEntityTag(ctx context.Context, id ResolverId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_getentitytag_autorest.go deleted file mode 100644 index 7fb3886277f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package graphqlapiresolverpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GraphQLApiResolverPolicyClient) GetEntityTag(ctx context.Context, id ResolverId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GraphQLApiResolverPolicyClient) preparerForGetEntityTag(ctx context.Context, id ResolverId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GraphQLApiResolverPolicyClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_listbyresolver.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_listbyresolver.go new file mode 100644 index 00000000000..e9465a9790e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_listbyresolver.go @@ -0,0 +1,89 @@ +package graphqlapiresolverpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResolverOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PolicyContract +} + +type ListByResolverCompleteResult struct { + Items []PolicyContract +} + +// ListByResolver ... +func (c GraphQLApiResolverPolicyClient) ListByResolver(ctx context.Context, id ResolverId) (result ListByResolverOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]PolicyContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResolverComplete retrieves all the results into a single object +func (c GraphQLApiResolverPolicyClient) ListByResolverComplete(ctx context.Context, id ResolverId) (ListByResolverCompleteResult, error) { + return c.ListByResolverCompleteMatchingPredicate(ctx, id, PolicyContractOperationPredicate{}) +} + +// ListByResolverCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GraphQLApiResolverPolicyClient) ListByResolverCompleteMatchingPredicate(ctx context.Context, id ResolverId, predicate PolicyContractOperationPredicate) (result ListByResolverCompleteResult, err error) { + items := make([]PolicyContract, 0) + + resp, err := c.ListByResolver(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResolverCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_listbyresolver_autorest.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_listbyresolver_autorest.go deleted file mode 100644 index 8d4b2ce62f5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/method_listbyresolver_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package graphqlapiresolverpolicy - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByResolverOperationResponse struct { - HttpResponse *http.Response - Model *[]PolicyContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResolverOperationResponse, error) -} - -type ListByResolverCompleteResult struct { - Items []PolicyContract -} - -func (r ListByResolverOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResolverOperationResponse) LoadMore(ctx context.Context) (resp ListByResolverOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResolver ... -func (c GraphQLApiResolverPolicyClient) ListByResolver(ctx context.Context, id ResolverId) (resp ListByResolverOperationResponse, err error) { - req, err := c.preparerForListByResolver(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "ListByResolver", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "ListByResolver", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResolver(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "ListByResolver", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResolver prepares the ListByResolver request. -func (c GraphQLApiResolverPolicyClient) preparerForListByResolver(ctx context.Context, id ResolverId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResolverWithNextLink prepares the ListByResolver request with the given nextLink token. -func (c GraphQLApiResolverPolicyClient) preparerForListByResolverWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResolver handles the response to the ListByResolver request. The method always -// closes the http.Response Body. -func (c GraphQLApiResolverPolicyClient) responderForListByResolver(resp *http.Response) (result ListByResolverOperationResponse, err error) { - type page struct { - Values []PolicyContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResolverOperationResponse, err error) { - req, err := c.preparerForListByResolverWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "ListByResolver", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "ListByResolver", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResolver(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "graphqlapiresolverpolicy.GraphQLApiResolverPolicyClient", "ListByResolver", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResolverComplete retrieves all of the results into a single object -func (c GraphQLApiResolverPolicyClient) ListByResolverComplete(ctx context.Context, id ResolverId) (ListByResolverCompleteResult, error) { - return c.ListByResolverCompleteMatchingPredicate(ctx, id, PolicyContractOperationPredicate{}) -} - -// ListByResolverCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GraphQLApiResolverPolicyClient) ListByResolverCompleteMatchingPredicate(ctx context.Context, id ResolverId, predicate PolicyContractOperationPredicate) (resp ListByResolverCompleteResult, err error) { - items := make([]PolicyContract, 0) - - page, err := c.ListByResolver(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResolverCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/group/client.go b/resource-manager/apimanagement/2022-08-01/group/client.go index 78b8515c749..ceb8d93829f 100644 --- a/resource-manager/apimanagement/2022-08-01/group/client.go +++ b/resource-manager/apimanagement/2022-08-01/group/client.go @@ -1,18 +1,26 @@ package group -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GroupClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGroupClientWithBaseURI(endpoint string) GroupClient { - return GroupClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGroupClientWithBaseURI(api sdkEnv.Api) (*GroupClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "group", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GroupClient: %+v", err) } + + return &GroupClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/group/constants.go b/resource-manager/apimanagement/2022-08-01/group/constants.go index a4fc43f47e7..1cda5dadcaf 100644 --- a/resource-manager/apimanagement/2022-08-01/group/constants.go +++ b/resource-manager/apimanagement/2022-08-01/group/constants.go @@ -1,6 +1,10 @@ package group -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForGroupType() []string { } } +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGroupType(input string) (*GroupType, error) { vals := map[string]GroupType{ "custom": GroupTypeCustom, diff --git a/resource-manager/apimanagement/2022-08-01/group/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/group/method_createorupdate.go new file mode 100644 index 00000000000..c7c3873d667 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/group/method_createorupdate.go @@ -0,0 +1,85 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c GroupClient) CreateOrUpdate(ctx context.Context, id GroupId, input GroupCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/group/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/group/method_createorupdate_autorest.go deleted file mode 100644 index 17bbc0cae9b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/group/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package group - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *GroupContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c GroupClient) CreateOrUpdate(ctx context.Context, id GroupId, input GroupCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c GroupClient) preparerForCreateOrUpdate(ctx context.Context, id GroupId, input GroupCreateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/group/method_delete.go b/resource-manager/apimanagement/2022-08-01/group/method_delete.go new file mode 100644 index 00000000000..8bd332e45a2 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/group/method_delete.go @@ -0,0 +1,76 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c GroupClient) Delete(ctx context.Context, id GroupId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/group/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/group/method_delete_autorest.go deleted file mode 100644 index 9abfbd05611..00000000000 --- a/resource-manager/apimanagement/2022-08-01/group/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package group - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c GroupClient) Delete(ctx context.Context, id GroupId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GroupClient) preparerForDelete(ctx context.Context, id GroupId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/group/method_get.go b/resource-manager/apimanagement/2022-08-01/group/method_get.go new file mode 100644 index 00000000000..4dbbc0759e2 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/group/method_get.go @@ -0,0 +1,51 @@ +package group + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +// Get ... +func (c GroupClient) Get(ctx context.Context, id GroupId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/group/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/group/method_get_autorest.go deleted file mode 100644 index bb3e3b2d619..00000000000 --- a/resource-manager/apimanagement/2022-08-01/group/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package group - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *GroupContract -} - -// Get ... -func (c GroupClient) Get(ctx context.Context, id GroupId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c GroupClient) preparerForGet(ctx context.Context, id GroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/group/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/group/method_getentitytag.go new file mode 100644 index 00000000000..e6ee5a9ba2d --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/group/method_getentitytag.go @@ -0,0 +1,46 @@ +package group + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c GroupClient) GetEntityTag(ctx context.Context, id GroupId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/group/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/group/method_getentitytag_autorest.go deleted file mode 100644 index 3dca8de39a0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/group/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package group - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c GroupClient) GetEntityTag(ctx context.Context, id GroupId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c GroupClient) preparerForGetEntityTag(ctx context.Context, id GroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/group/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/group/method_listbyservice.go new file mode 100644 index 00000000000..080778877db --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/group/method_listbyservice.go @@ -0,0 +1,125 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GroupContract +} + +type ListByServiceCompleteResult struct { + Items []GroupContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c GroupClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/groups", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GroupContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c GroupClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GroupClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate GroupContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]GroupContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/group/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/group/method_listbyservice_autorest.go deleted file mode 100644 index f2981bb97a5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/group/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package group - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]GroupContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []GroupContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c GroupClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c GroupClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/groups", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c GroupClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []GroupContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c GroupClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GroupClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate GroupContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]GroupContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/group/method_update.go b/resource-manager/apimanagement/2022-08-01/group/method_update.go new file mode 100644 index 00000000000..8ef4191a0f2 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/group/method_update.go @@ -0,0 +1,84 @@ +package group + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c GroupClient) Update(ctx context.Context, id GroupId, input GroupUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/group/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/group/method_update_autorest.go deleted file mode 100644 index 09760546a0e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/group/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package group - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *GroupContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c GroupClient) Update(ctx context.Context, id GroupId, input GroupUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "group.GroupClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c GroupClient) preparerForUpdate(ctx context.Context, id GroupId, input GroupUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c GroupClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/client.go b/resource-manager/apimanagement/2022-08-01/groupuser/client.go index ab4bea57574..d1e443455e9 100644 --- a/resource-manager/apimanagement/2022-08-01/groupuser/client.go +++ b/resource-manager/apimanagement/2022-08-01/groupuser/client.go @@ -1,18 +1,26 @@ package groupuser -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type GroupUserClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewGroupUserClientWithBaseURI(endpoint string) GroupUserClient { - return GroupUserClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewGroupUserClientWithBaseURI(api sdkEnv.Api) (*GroupUserClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "groupuser", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GroupUserClient: %+v", err) } + + return &GroupUserClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/constants.go b/resource-manager/apimanagement/2022-08-01/groupuser/constants.go index 4023a21458d..520579fefd7 100644 --- a/resource-manager/apimanagement/2022-08-01/groupuser/constants.go +++ b/resource-manager/apimanagement/2022-08-01/groupuser/constants.go @@ -1,6 +1,10 @@ package groupuser -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForGroupType() []string { } } +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGroupType(input string) (*GroupType, error) { vals := map[string]GroupType{ "custom": GroupTypeCustom, @@ -54,6 +71,19 @@ func PossibleValuesForUserState() []string { } } +func (s *UserState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUserState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUserState(input string) (*UserState, error) { vals := map[string]UserState{ "active": UserStateActive, diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/method_checkentityexists.go b/resource-manager/apimanagement/2022-08-01/groupuser/method_checkentityexists.go new file mode 100644 index 00000000000..ecf5ac1f37b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/groupuser/method_checkentityexists.go @@ -0,0 +1,46 @@ +package groupuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c GroupUserClient) CheckEntityExists(ctx context.Context, id GroupUserId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/method_checkentityexists_autorest.go b/resource-manager/apimanagement/2022-08-01/groupuser/method_checkentityexists_autorest.go deleted file mode 100644 index 6c318ef5a01..00000000000 --- a/resource-manager/apimanagement/2022-08-01/groupuser/method_checkentityexists_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package groupuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckEntityExistsOperationResponse struct { - HttpResponse *http.Response -} - -// CheckEntityExists ... -func (c GroupUserClient) CheckEntityExists(ctx context.Context, id GroupUserId) (result CheckEntityExistsOperationResponse, err error) { - req, err := c.preparerForCheckEntityExists(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "CheckEntityExists", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckEntityExists(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "CheckEntityExists", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckEntityExists prepares the CheckEntityExists request. -func (c GroupUserClient) preparerForCheckEntityExists(ctx context.Context, id GroupUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckEntityExists handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (c GroupUserClient) responderForCheckEntityExists(resp *http.Response) (result CheckEntityExistsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/method_create.go b/resource-manager/apimanagement/2022-08-01/groupuser/method_create.go new file mode 100644 index 00000000000..b13b301f403 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/groupuser/method_create.go @@ -0,0 +1,52 @@ +package groupuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +// Create ... +func (c GroupUserClient) Create(ctx context.Context, id GroupUserId) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/method_create_autorest.go b/resource-manager/apimanagement/2022-08-01/groupuser/method_create_autorest.go deleted file mode 100644 index bc34063331f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/groupuser/method_create_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package groupuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOperationResponse struct { - HttpResponse *http.Response - Model *UserContract -} - -// Create ... -func (c GroupUserClient) Create(ctx context.Context, id GroupUserId) (result CreateOperationResponse, err error) { - req, err := c.preparerForCreate(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Create", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Create", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreate prepares the Create request. -func (c GroupUserClient) preparerForCreate(ctx context.Context, id GroupUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreate handles the response to the Create request. The method always -// closes the http.Response Body. -func (c GroupUserClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/method_delete.go b/resource-manager/apimanagement/2022-08-01/groupuser/method_delete.go new file mode 100644 index 00000000000..e8513f36120 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/groupuser/method_delete.go @@ -0,0 +1,47 @@ +package groupuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c GroupUserClient) Delete(ctx context.Context, id GroupUserId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/groupuser/method_delete_autorest.go deleted file mode 100644 index 26cb84da7d4..00000000000 --- a/resource-manager/apimanagement/2022-08-01/groupuser/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package groupuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c GroupUserClient) Delete(ctx context.Context, id GroupUserId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c GroupUserClient) preparerForDelete(ctx context.Context, id GroupUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c GroupUserClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/method_list.go b/resource-manager/apimanagement/2022-08-01/groupuser/method_list.go new file mode 100644 index 00000000000..0f87bb365b1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/groupuser/method_list.go @@ -0,0 +1,125 @@ +package groupuser + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]UserContract +} + +type ListCompleteResult struct { + Items []UserContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c GroupUserClient) List(ctx context.Context, id GroupId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/users", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]UserContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c GroupUserClient) ListComplete(ctx context.Context, id GroupId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, UserContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GroupUserClient) ListCompleteMatchingPredicate(ctx context.Context, id GroupId, options ListOperationOptions, predicate UserContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]UserContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/method_list_autorest.go b/resource-manager/apimanagement/2022-08-01/groupuser/method_list_autorest.go deleted file mode 100644 index 92652a7a09f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/groupuser/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package groupuser - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]UserContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []UserContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c GroupUserClient) List(ctx context.Context, id GroupId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c GroupUserClient) preparerForList(ctx context.Context, id GroupId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/users", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c GroupUserClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c GroupUserClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []UserContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "groupuser.GroupUserClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c GroupUserClient) ListComplete(ctx context.Context, id GroupId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, UserContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c GroupUserClient) ListCompleteMatchingPredicate(ctx context.Context, id GroupId, options ListOperationOptions, predicate UserContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]UserContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/client.go b/resource-manager/apimanagement/2022-08-01/identityprovider/client.go index 72328783c91..92ebed9126e 100644 --- a/resource-manager/apimanagement/2022-08-01/identityprovider/client.go +++ b/resource-manager/apimanagement/2022-08-01/identityprovider/client.go @@ -1,18 +1,26 @@ package identityprovider -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type IdentityProviderClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewIdentityProviderClientWithBaseURI(endpoint string) IdentityProviderClient { - return IdentityProviderClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewIdentityProviderClientWithBaseURI(api sdkEnv.Api) (*IdentityProviderClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "identityprovider", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating IdentityProviderClient: %+v", err) } + + return &IdentityProviderClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/constants.go b/resource-manager/apimanagement/2022-08-01/identityprovider/constants.go index dbcc693e57a..d96fcd03253 100644 --- a/resource-manager/apimanagement/2022-08-01/identityprovider/constants.go +++ b/resource-manager/apimanagement/2022-08-01/identityprovider/constants.go @@ -1,6 +1,10 @@ package identityprovider -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -27,6 +31,19 @@ func PossibleValuesForIdentityProviderType() []string { } } +func (s *IdentityProviderType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIdentityProviderType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIdentityProviderType(input string) (*IdentityProviderType, error) { vals := map[string]IdentityProviderType{ "aad": IdentityProviderTypeAad, diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_createorupdate.go new file mode 100644 index 00000000000..7e7257ff801 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/identityprovider/method_createorupdate.go @@ -0,0 +1,85 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IdentityProviderContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c IdentityProviderClient) CreateOrUpdate(ctx context.Context, id IdentityProviderId, input IdentityProviderCreateContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_createorupdate_autorest.go deleted file mode 100644 index 01365a7baa9..00000000000 --- a/resource-manager/apimanagement/2022-08-01/identityprovider/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package identityprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *IdentityProviderContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c IdentityProviderClient) CreateOrUpdate(ctx context.Context, id IdentityProviderId, input IdentityProviderCreateContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c IdentityProviderClient) preparerForCreateOrUpdate(ctx context.Context, id IdentityProviderId, input IdentityProviderCreateContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_delete.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_delete.go new file mode 100644 index 00000000000..ff4f9cee7c4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/identityprovider/method_delete.go @@ -0,0 +1,76 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c IdentityProviderClient) Delete(ctx context.Context, id IdentityProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_delete_autorest.go deleted file mode 100644 index d65e64e44b4..00000000000 --- a/resource-manager/apimanagement/2022-08-01/identityprovider/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package identityprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c IdentityProviderClient) Delete(ctx context.Context, id IdentityProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c IdentityProviderClient) preparerForDelete(ctx context.Context, id IdentityProviderId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_get.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_get.go new file mode 100644 index 00000000000..3ea0d912b93 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/identityprovider/method_get.go @@ -0,0 +1,51 @@ +package identityprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IdentityProviderContract +} + +// Get ... +func (c IdentityProviderClient) Get(ctx context.Context, id IdentityProviderId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_get_autorest.go deleted file mode 100644 index 05ae191473a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/identityprovider/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package identityprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *IdentityProviderContract -} - -// Get ... -func (c IdentityProviderClient) Get(ctx context.Context, id IdentityProviderId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c IdentityProviderClient) preparerForGet(ctx context.Context, id IdentityProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_getentitytag.go new file mode 100644 index 00000000000..626d199ac1f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/identityprovider/method_getentitytag.go @@ -0,0 +1,46 @@ +package identityprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c IdentityProviderClient) GetEntityTag(ctx context.Context, id IdentityProviderId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_getentitytag_autorest.go deleted file mode 100644 index 1df4d8b8805..00000000000 --- a/resource-manager/apimanagement/2022-08-01/identityprovider/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package identityprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c IdentityProviderClient) GetEntityTag(ctx context.Context, id IdentityProviderId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c IdentityProviderClient) preparerForGetEntityTag(ctx context.Context, id IdentityProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_listbyservice.go new file mode 100644 index 00000000000..881b7200016 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/identityprovider/method_listbyservice.go @@ -0,0 +1,89 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]IdentityProviderContract +} + +type ListByServiceCompleteResult struct { + Items []IdentityProviderContract +} + +// ListByService ... +func (c IdentityProviderClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/identityProviders", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]IdentityProviderContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c IdentityProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, IdentityProviderContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c IdentityProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate IdentityProviderContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]IdentityProviderContract, 0) + + resp, err := c.ListByService(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_listbyservice_autorest.go deleted file mode 100644 index 993d95a854d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/identityprovider/method_listbyservice_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package identityprovider - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]IdentityProviderContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []IdentityProviderContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByService ... -func (c IdentityProviderClient) ListByService(ctx context.Context, id ServiceId) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c IdentityProviderClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/identityProviders", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c IdentityProviderClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []IdentityProviderContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c IdentityProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, IdentityProviderContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c IdentityProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate IdentityProviderContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]IdentityProviderContract, 0) - - page, err := c.ListByService(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_listsecrets.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_listsecrets.go new file mode 100644 index 00000000000..bf808b63434 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/identityprovider/method_listsecrets.go @@ -0,0 +1,52 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ClientSecretContract +} + +// ListSecrets ... +func (c IdentityProviderClient) ListSecrets(ctx context.Context, id IdentityProviderId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_listsecrets_autorest.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_listsecrets_autorest.go deleted file mode 100644 index 1e36cc02469..00000000000 --- a/resource-manager/apimanagement/2022-08-01/identityprovider/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package identityprovider - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *ClientSecretContract -} - -// ListSecrets ... -func (c IdentityProviderClient) ListSecrets(ctx context.Context, id IdentityProviderId) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c IdentityProviderClient) preparerForListSecrets(ctx context.Context, id IdentityProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_update.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_update.go new file mode 100644 index 00000000000..9ac8eaebfa4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/identityprovider/method_update.go @@ -0,0 +1,84 @@ +package identityprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IdentityProviderContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c IdentityProviderClient) Update(ctx context.Context, id IdentityProviderId, input IdentityProviderUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/identityprovider/method_update_autorest.go deleted file mode 100644 index 0f1cbf0647f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/identityprovider/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package identityprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *IdentityProviderContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c IdentityProviderClient) Update(ctx context.Context, id IdentityProviderId, input IdentityProviderUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "identityprovider.IdentityProviderClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c IdentityProviderClient) preparerForUpdate(ctx context.Context, id IdentityProviderId, input IdentityProviderUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c IdentityProviderClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/issue/client.go b/resource-manager/apimanagement/2022-08-01/issue/client.go index 973a74c9ec3..726d6359298 100644 --- a/resource-manager/apimanagement/2022-08-01/issue/client.go +++ b/resource-manager/apimanagement/2022-08-01/issue/client.go @@ -1,18 +1,26 @@ package issue -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type IssueClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewIssueClientWithBaseURI(endpoint string) IssueClient { - return IssueClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewIssueClientWithBaseURI(api sdkEnv.Api) (*IssueClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "issue", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating IssueClient: %+v", err) } + + return &IssueClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/issue/constants.go b/resource-manager/apimanagement/2022-08-01/issue/constants.go index 837f3883c24..737222a81b0 100644 --- a/resource-manager/apimanagement/2022-08-01/issue/constants.go +++ b/resource-manager/apimanagement/2022-08-01/issue/constants.go @@ -1,6 +1,10 @@ package issue -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -25,6 +29,19 @@ func PossibleValuesForState() []string { } } +func (s *State) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseState(input string) (*State, error) { vals := map[string]State{ "closed": StateClosed, diff --git a/resource-manager/apimanagement/2022-08-01/issue/method_get.go b/resource-manager/apimanagement/2022-08-01/issue/method_get.go new file mode 100644 index 00000000000..d23f005d647 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/issue/method_get.go @@ -0,0 +1,51 @@ +package issue + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *IssueContract +} + +// Get ... +func (c IssueClient) Get(ctx context.Context, id IssueId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/issue/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/issue/method_get_autorest.go deleted file mode 100644 index fbdc95d1081..00000000000 --- a/resource-manager/apimanagement/2022-08-01/issue/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package issue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *IssueContract -} - -// Get ... -func (c IssueClient) Get(ctx context.Context, id IssueId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c IssueClient) preparerForGet(ctx context.Context, id IssueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c IssueClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/issue/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/issue/method_listbyservice.go new file mode 100644 index 00000000000..f18cb96e08c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/issue/method_listbyservice.go @@ -0,0 +1,125 @@ +package issue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]IssueContract +} + +type ListByServiceCompleteResult struct { + Items []IssueContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c IssueClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/issues", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]IssueContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c IssueClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c IssueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate IssueContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]IssueContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/issue/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/issue/method_listbyservice_autorest.go deleted file mode 100644 index c811024f3da..00000000000 --- a/resource-manager/apimanagement/2022-08-01/issue/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package issue - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]IssueContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []IssueContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c IssueClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c IssueClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/issues", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c IssueClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c IssueClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []IssueContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "issue.IssueClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c IssueClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, IssueContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c IssueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate IssueContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]IssueContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/logger/client.go b/resource-manager/apimanagement/2022-08-01/logger/client.go index 35b0189b9e7..f38d60c4b30 100644 --- a/resource-manager/apimanagement/2022-08-01/logger/client.go +++ b/resource-manager/apimanagement/2022-08-01/logger/client.go @@ -1,18 +1,26 @@ package logger -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type LoggerClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewLoggerClientWithBaseURI(endpoint string) LoggerClient { - return LoggerClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewLoggerClientWithBaseURI(api sdkEnv.Api) (*LoggerClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "logger", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating LoggerClient: %+v", err) } + + return &LoggerClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/logger/constants.go b/resource-manager/apimanagement/2022-08-01/logger/constants.go index cf45d74e056..0aa7cb68a3e 100644 --- a/resource-manager/apimanagement/2022-08-01/logger/constants.go +++ b/resource-manager/apimanagement/2022-08-01/logger/constants.go @@ -1,6 +1,10 @@ package logger -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForLoggerType() []string { } } +func (s *LoggerType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLoggerType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLoggerType(input string) (*LoggerType, error) { vals := map[string]LoggerType{ "applicationinsights": LoggerTypeApplicationInsights, diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/logger/method_createorupdate.go new file mode 100644 index 00000000000..5afa3c7881e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/logger/method_createorupdate.go @@ -0,0 +1,85 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LoggerContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c LoggerClient) CreateOrUpdate(ctx context.Context, id LoggerId, input LoggerContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/logger/method_createorupdate_autorest.go deleted file mode 100644 index 0575dfc04e6..00000000000 --- a/resource-manager/apimanagement/2022-08-01/logger/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package logger - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *LoggerContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c LoggerClient) CreateOrUpdate(ctx context.Context, id LoggerId, input LoggerContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c LoggerClient) preparerForCreateOrUpdate(ctx context.Context, id LoggerId, input LoggerContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_delete.go b/resource-manager/apimanagement/2022-08-01/logger/method_delete.go new file mode 100644 index 00000000000..9a3b1b42ad9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/logger/method_delete.go @@ -0,0 +1,76 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c LoggerClient) Delete(ctx context.Context, id LoggerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/logger/method_delete_autorest.go deleted file mode 100644 index cdc22bf87cc..00000000000 --- a/resource-manager/apimanagement/2022-08-01/logger/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package logger - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c LoggerClient) Delete(ctx context.Context, id LoggerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c LoggerClient) preparerForDelete(ctx context.Context, id LoggerId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_get.go b/resource-manager/apimanagement/2022-08-01/logger/method_get.go new file mode 100644 index 00000000000..a755ecf8263 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/logger/method_get.go @@ -0,0 +1,51 @@ +package logger + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LoggerContract +} + +// Get ... +func (c LoggerClient) Get(ctx context.Context, id LoggerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/logger/method_get_autorest.go deleted file mode 100644 index 37e10193f3d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/logger/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package logger - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *LoggerContract -} - -// Get ... -func (c LoggerClient) Get(ctx context.Context, id LoggerId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c LoggerClient) preparerForGet(ctx context.Context, id LoggerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/logger/method_getentitytag.go new file mode 100644 index 00000000000..b65f6ac22bd --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/logger/method_getentitytag.go @@ -0,0 +1,46 @@ +package logger + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c LoggerClient) GetEntityTag(ctx context.Context, id LoggerId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/logger/method_getentitytag_autorest.go deleted file mode 100644 index 4e2a41cb3a9..00000000000 --- a/resource-manager/apimanagement/2022-08-01/logger/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package logger - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c LoggerClient) GetEntityTag(ctx context.Context, id LoggerId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c LoggerClient) preparerForGetEntityTag(ctx context.Context, id LoggerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/logger/method_listbyservice.go new file mode 100644 index 00000000000..6049c405eb8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/logger/method_listbyservice.go @@ -0,0 +1,125 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]LoggerContract +} + +type ListByServiceCompleteResult struct { + Items []LoggerContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c LoggerClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/loggers", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]LoggerContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c LoggerClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, LoggerContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c LoggerClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate LoggerContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]LoggerContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/logger/method_listbyservice_autorest.go deleted file mode 100644 index 23f43bba9ca..00000000000 --- a/resource-manager/apimanagement/2022-08-01/logger/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package logger - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]LoggerContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []LoggerContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c LoggerClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c LoggerClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/loggers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c LoggerClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []LoggerContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c LoggerClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, LoggerContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c LoggerClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate LoggerContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]LoggerContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_update.go b/resource-manager/apimanagement/2022-08-01/logger/method_update.go new file mode 100644 index 00000000000..f7245ad9404 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/logger/method_update.go @@ -0,0 +1,84 @@ +package logger + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LoggerContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c LoggerClient) Update(ctx context.Context, id LoggerId, input LoggerUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/logger/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/logger/method_update_autorest.go deleted file mode 100644 index 73a90ec1fbc..00000000000 --- a/resource-manager/apimanagement/2022-08-01/logger/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package logger - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *LoggerContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c LoggerClient) Update(ctx context.Context, id LoggerId, input LoggerUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "logger.LoggerClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c LoggerClient) preparerForUpdate(ctx context.Context, id LoggerId, input LoggerUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c LoggerClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/client.go b/resource-manager/apimanagement/2022-08-01/namedvalue/client.go index 50c96afd343..cb03913825c 100644 --- a/resource-manager/apimanagement/2022-08-01/namedvalue/client.go +++ b/resource-manager/apimanagement/2022-08-01/namedvalue/client.go @@ -1,18 +1,26 @@ package namedvalue -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type NamedValueClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewNamedValueClientWithBaseURI(endpoint string) NamedValueClient { - return NamedValueClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewNamedValueClientWithBaseURI(api sdkEnv.Api) (*NamedValueClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "namedvalue", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NamedValueClient: %+v", err) } + + return &NamedValueClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_createorupdate.go new file mode 100644 index 00000000000..09c8aa0bbe5 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/namedvalue/method_createorupdate.go @@ -0,0 +1,103 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c NamedValueClient) CreateOrUpdate(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c NamedValueClient) CreateOrUpdateThenPoll(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_createorupdate_autorest.go deleted file mode 100644 index 7f838bb490b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/namedvalue/method_createorupdate_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package namedvalue - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c NamedValueClient) CreateOrUpdate(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c NamedValueClient) CreateOrUpdateThenPoll(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c NamedValueClient) preparerForCreateOrUpdate(ctx context.Context, id NamedValueId, input NamedValueCreateContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c NamedValueClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_delete.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_delete.go new file mode 100644 index 00000000000..82bbf62ac51 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/namedvalue/method_delete.go @@ -0,0 +1,76 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c NamedValueClient) Delete(ctx context.Context, id NamedValueId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_delete_autorest.go deleted file mode 100644 index da4a8178f35..00000000000 --- a/resource-manager/apimanagement/2022-08-01/namedvalue/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package namedvalue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c NamedValueClient) Delete(ctx context.Context, id NamedValueId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c NamedValueClient) preparerForDelete(ctx context.Context, id NamedValueId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c NamedValueClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_get.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_get.go new file mode 100644 index 00000000000..db6c7dc54e2 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/namedvalue/method_get.go @@ -0,0 +1,51 @@ +package namedvalue + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NamedValueContract +} + +// Get ... +func (c NamedValueClient) Get(ctx context.Context, id NamedValueId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_get_autorest.go deleted file mode 100644 index ce18c60cb5f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/namedvalue/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package namedvalue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *NamedValueContract -} - -// Get ... -func (c NamedValueClient) Get(ctx context.Context, id NamedValueId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c NamedValueClient) preparerForGet(ctx context.Context, id NamedValueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c NamedValueClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_getentitytag.go new file mode 100644 index 00000000000..d292a66e0af --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/namedvalue/method_getentitytag.go @@ -0,0 +1,46 @@ +package namedvalue + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c NamedValueClient) GetEntityTag(ctx context.Context, id NamedValueId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_getentitytag_autorest.go deleted file mode 100644 index ac30709913d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/namedvalue/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package namedvalue - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c NamedValueClient) GetEntityTag(ctx context.Context, id NamedValueId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c NamedValueClient) preparerForGetEntityTag(ctx context.Context, id NamedValueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c NamedValueClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_listbyservice.go new file mode 100644 index 00000000000..ebb1b6b4849 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/namedvalue/method_listbyservice.go @@ -0,0 +1,129 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NamedValueContract +} + +type ListByServiceCompleteResult struct { + Items []NamedValueContract +} + +type ListByServiceOperationOptions struct { + Filter *string + IsKeyVaultRefreshFailed *bool + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IsKeyVaultRefreshFailed != nil { + out.Append("isKeyVaultRefreshFailed", fmt.Sprintf("%v", *o.IsKeyVaultRefreshFailed)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c NamedValueClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/namedValues", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]NamedValueContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c NamedValueClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, NamedValueContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c NamedValueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate NamedValueContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]NamedValueContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_listbyservice_autorest.go deleted file mode 100644 index cbfcd1b0b7b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/namedvalue/method_listbyservice_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package namedvalue - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]NamedValueContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []NamedValueContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - IsKeyVaultRefreshFailed *bool - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.IsKeyVaultRefreshFailed != nil { - out["isKeyVaultRefreshFailed"] = *o.IsKeyVaultRefreshFailed - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c NamedValueClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c NamedValueClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/namedValues", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c NamedValueClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c NamedValueClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []NamedValueContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c NamedValueClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, NamedValueContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c NamedValueClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate NamedValueContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]NamedValueContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_listvalue.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_listvalue.go new file mode 100644 index 00000000000..4dbf0997989 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/namedvalue/method_listvalue.go @@ -0,0 +1,52 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListValueOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NamedValueSecretContract +} + +// ListValue ... +func (c NamedValueClient) ListValue(ctx context.Context, id NamedValueId) (result ListValueOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listValue", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_listvalue_autorest.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_listvalue_autorest.go deleted file mode 100644 index 0370e762206..00000000000 --- a/resource-manager/apimanagement/2022-08-01/namedvalue/method_listvalue_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package namedvalue - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListValueOperationResponse struct { - HttpResponse *http.Response - Model *NamedValueSecretContract -} - -// ListValue ... -func (c NamedValueClient) ListValue(ctx context.Context, id NamedValueId) (result ListValueOperationResponse, err error) { - req, err := c.preparerForListValue(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListValue", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListValue", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListValue(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "ListValue", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListValue prepares the ListValue request. -func (c NamedValueClient) preparerForListValue(ctx context.Context, id NamedValueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listValue", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListValue handles the response to the ListValue request. The method always -// closes the http.Response Body. -func (c NamedValueClient) responderForListValue(resp *http.Response) (result ListValueOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_refreshsecret.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_refreshsecret.go new file mode 100644 index 00000000000..0dd3a006aec --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/namedvalue/method_refreshsecret.go @@ -0,0 +1,70 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RefreshSecretOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RefreshSecret ... +func (c NamedValueClient) RefreshSecret(ctx context.Context, id NamedValueId) (result RefreshSecretOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/refreshSecret", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RefreshSecretThenPoll performs RefreshSecret then polls until it's completed +func (c NamedValueClient) RefreshSecretThenPoll(ctx context.Context, id NamedValueId) error { + result, err := c.RefreshSecret(ctx, id) + if err != nil { + return fmt.Errorf("performing RefreshSecret: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RefreshSecret: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_refreshsecret_autorest.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_refreshsecret_autorest.go deleted file mode 100644 index 7574f5aaaf5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/namedvalue/method_refreshsecret_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package namedvalue - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RefreshSecretOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RefreshSecret ... -func (c NamedValueClient) RefreshSecret(ctx context.Context, id NamedValueId) (result RefreshSecretOperationResponse, err error) { - req, err := c.preparerForRefreshSecret(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "RefreshSecret", nil, "Failure preparing request") - return - } - - result, err = c.senderForRefreshSecret(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "RefreshSecret", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RefreshSecretThenPoll performs RefreshSecret then polls until it's completed -func (c NamedValueClient) RefreshSecretThenPoll(ctx context.Context, id NamedValueId) error { - result, err := c.RefreshSecret(ctx, id) - if err != nil { - return fmt.Errorf("performing RefreshSecret: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RefreshSecret: %+v", err) - } - - return nil -} - -// preparerForRefreshSecret prepares the RefreshSecret request. -func (c NamedValueClient) preparerForRefreshSecret(ctx context.Context, id NamedValueId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/refreshSecret", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRefreshSecret sends the RefreshSecret request. The method will close the -// http.Response Body if it receives an error. -func (c NamedValueClient) senderForRefreshSecret(ctx context.Context, req *http.Request) (future RefreshSecretOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_update.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_update.go new file mode 100644 index 00000000000..83793e803c7 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/namedvalue/method_update.go @@ -0,0 +1,102 @@ +package namedvalue + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c NamedValueClient) Update(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c NamedValueClient) UpdateThenPoll(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/namedvalue/method_update_autorest.go deleted file mode 100644 index 9de4e8a7883..00000000000 --- a/resource-manager/apimanagement/2022-08-01/namedvalue/method_update_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package namedvalue - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c NamedValueClient) Update(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "namedvalue.NamedValueClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c NamedValueClient) UpdateThenPoll(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) error { - result, err := c.Update(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c NamedValueClient) preparerForUpdate(ctx context.Context, id NamedValueId, input NamedValueUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c NamedValueClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/networkstatus/client.go b/resource-manager/apimanagement/2022-08-01/networkstatus/client.go index 7d6f9215235..5223df0ad30 100644 --- a/resource-manager/apimanagement/2022-08-01/networkstatus/client.go +++ b/resource-manager/apimanagement/2022-08-01/networkstatus/client.go @@ -1,18 +1,26 @@ package networkstatus -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type NetworkStatusClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewNetworkStatusClientWithBaseURI(endpoint string) NetworkStatusClient { - return NetworkStatusClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewNetworkStatusClientWithBaseURI(api sdkEnv.Api) (*NetworkStatusClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "networkstatus", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NetworkStatusClient: %+v", err) } + + return &NetworkStatusClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/networkstatus/constants.go b/resource-manager/apimanagement/2022-08-01/networkstatus/constants.go index fe5f4ceaf1c..caf05ed6a2c 100644 --- a/resource-manager/apimanagement/2022-08-01/networkstatus/constants.go +++ b/resource-manager/apimanagement/2022-08-01/networkstatus/constants.go @@ -1,6 +1,10 @@ package networkstatus -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForConnectivityStatusType() []string { } } +func (s *ConnectivityStatusType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConnectivityStatusType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseConnectivityStatusType(input string) (*ConnectivityStatusType, error) { vals := map[string]ConnectivityStatusType{ "failure": ConnectivityStatusTypeFailure, diff --git a/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbylocation.go b/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbylocation.go new file mode 100644 index 00000000000..040ec0de64d --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbylocation.go @@ -0,0 +1,52 @@ +package networkstatus + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NetworkStatusContract +} + +// ListByLocation ... +func (c NetworkStatusClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/networkstatus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbylocation_autorest.go b/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbylocation_autorest.go deleted file mode 100644 index bd98a6e965e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbylocation_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package networkstatus - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByLocationOperationResponse struct { - HttpResponse *http.Response - Model *NetworkStatusContract -} - -// ListByLocation ... -func (c NetworkStatusClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { - req, err := c.preparerForListByLocation(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByLocation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByLocation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByLocation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByLocation", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByLocation prepares the ListByLocation request. -func (c NetworkStatusClient) preparerForListByLocation(ctx context.Context, id LocationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/networkstatus", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByLocation handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (c NetworkStatusClient) responderForListByLocation(resp *http.Response) (result ListByLocationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbyservice.go new file mode 100644 index 00000000000..509a1b2da91 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbyservice.go @@ -0,0 +1,52 @@ +package networkstatus + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NetworkStatusContractByLocation +} + +// ListByService ... +func (c NetworkStatusClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/networkstatus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbyservice_autorest.go deleted file mode 100644 index e5f374af6e0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/networkstatus/method_listbyservice_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package networkstatus - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]NetworkStatusContractByLocation -} - -// ListByService ... -func (c NetworkStatusClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "networkstatus.NetworkStatusClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c NetworkStatusClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/networkstatus", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c NetworkStatusClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/notification/client.go b/resource-manager/apimanagement/2022-08-01/notification/client.go index 090f6db749d..98d22942b6c 100644 --- a/resource-manager/apimanagement/2022-08-01/notification/client.go +++ b/resource-manager/apimanagement/2022-08-01/notification/client.go @@ -1,18 +1,26 @@ package notification -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type NotificationClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewNotificationClientWithBaseURI(endpoint string) NotificationClient { - return NotificationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewNotificationClientWithBaseURI(api sdkEnv.Api) (*NotificationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "notification", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NotificationClient: %+v", err) } + + return &NotificationClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/notification/constants.go b/resource-manager/apimanagement/2022-08-01/notification/constants.go index e4c9332d3bd..28634a3bb8e 100644 --- a/resource-manager/apimanagement/2022-08-01/notification/constants.go +++ b/resource-manager/apimanagement/2022-08-01/notification/constants.go @@ -1,6 +1,10 @@ package notification -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -29,6 +33,19 @@ func PossibleValuesForNotificationName() []string { } } +func (s *NotificationName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNotificationName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNotificationName(input string) (*NotificationName, error) { vals := map[string]NotificationName{ "accountclosedpublisher": NotificationNameAccountClosedPublisher, diff --git a/resource-manager/apimanagement/2022-08-01/notification/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/notification/method_createorupdate.go new file mode 100644 index 00000000000..f1f56dbe3ba --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/notification/method_createorupdate.go @@ -0,0 +1,80 @@ +package notification + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NotificationContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c NotificationClient) CreateOrUpdate(ctx context.Context, id NotificationId, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/notification/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/notification/method_createorupdate_autorest.go deleted file mode 100644 index 129cedaaadd..00000000000 --- a/resource-manager/apimanagement/2022-08-01/notification/method_createorupdate_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package notification - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *NotificationContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c NotificationClient) CreateOrUpdate(ctx context.Context, id NotificationId, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c NotificationClient) preparerForCreateOrUpdate(ctx context.Context, id NotificationId, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c NotificationClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/notification/method_get.go b/resource-manager/apimanagement/2022-08-01/notification/method_get.go new file mode 100644 index 00000000000..a5f0293b824 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/notification/method_get.go @@ -0,0 +1,51 @@ +package notification + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NotificationContract +} + +// Get ... +func (c NotificationClient) Get(ctx context.Context, id NotificationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/notification/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/notification/method_get_autorest.go deleted file mode 100644 index 1290bcc6685..00000000000 --- a/resource-manager/apimanagement/2022-08-01/notification/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package notification - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *NotificationContract -} - -// Get ... -func (c NotificationClient) Get(ctx context.Context, id NotificationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c NotificationClient) preparerForGet(ctx context.Context, id NotificationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c NotificationClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/notification/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/notification/method_listbyservice.go new file mode 100644 index 00000000000..ec6e29b47c6 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/notification/method_listbyservice.go @@ -0,0 +1,121 @@ +package notification + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NotificationContract +} + +type ListByServiceCompleteResult struct { + Items []NotificationContract +} + +type ListByServiceOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c NotificationClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/notifications", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]NotificationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c NotificationClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, NotificationContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c NotificationClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate NotificationContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]NotificationContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/notification/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/notification/method_listbyservice_autorest.go deleted file mode 100644 index d439d198b0c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/notification/method_listbyservice_autorest.go +++ /dev/null @@ -1,220 +0,0 @@ -package notification - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]NotificationContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []NotificationContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c NotificationClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c NotificationClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/notifications", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c NotificationClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c NotificationClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []NotificationContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notification.NotificationClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c NotificationClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, NotificationContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c NotificationClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate NotificationContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]NotificationContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/client.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/client.go index 6f974759762..1a1b8cceb61 100644 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/client.go +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/client.go @@ -1,18 +1,26 @@ package notificationrecipientemail -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type NotificationRecipientEmailClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewNotificationRecipientEmailClientWithBaseURI(endpoint string) NotificationRecipientEmailClient { - return NotificationRecipientEmailClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewNotificationRecipientEmailClientWithBaseURI(api sdkEnv.Api) (*NotificationRecipientEmailClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "notificationrecipientemail", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NotificationRecipientEmailClient: %+v", err) } + + return &NotificationRecipientEmailClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/constants.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/constants.go index e48b9eee0a2..85940aee54e 100644 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/constants.go +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/constants.go @@ -1,6 +1,10 @@ package notificationrecipientemail -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -29,6 +33,19 @@ func PossibleValuesForNotificationName() []string { } } +func (s *NotificationName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNotificationName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNotificationName(input string) (*NotificationName, error) { vals := map[string]NotificationName{ "accountclosedpublisher": NotificationNameAccountClosedPublisher, diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_checkentityexists.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_checkentityexists.go new file mode 100644 index 00000000000..acddee29b82 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_checkentityexists.go @@ -0,0 +1,46 @@ +package notificationrecipientemail + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c NotificationRecipientEmailClient) CheckEntityExists(ctx context.Context, id RecipientEmailId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_checkentityexists_autorest.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_checkentityexists_autorest.go deleted file mode 100644 index da1fef7c04b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_checkentityexists_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package notificationrecipientemail - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckEntityExistsOperationResponse struct { - HttpResponse *http.Response -} - -// CheckEntityExists ... -func (c NotificationRecipientEmailClient) CheckEntityExists(ctx context.Context, id RecipientEmailId) (result CheckEntityExistsOperationResponse, err error) { - req, err := c.preparerForCheckEntityExists(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CheckEntityExists", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckEntityExists(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CheckEntityExists", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckEntityExists prepares the CheckEntityExists request. -func (c NotificationRecipientEmailClient) preparerForCheckEntityExists(ctx context.Context, id RecipientEmailId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckEntityExists handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (c NotificationRecipientEmailClient) responderForCheckEntityExists(resp *http.Response) (result CheckEntityExistsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_createorupdate.go new file mode 100644 index 00000000000..076065b12a4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_createorupdate.go @@ -0,0 +1,52 @@ +package notificationrecipientemail + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientEmailContract +} + +// CreateOrUpdate ... +func (c NotificationRecipientEmailClient) CreateOrUpdate(ctx context.Context, id RecipientEmailId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_createorupdate_autorest.go deleted file mode 100644 index 54e5266a7f4..00000000000 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_createorupdate_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package notificationrecipientemail - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *RecipientEmailContract -} - -// CreateOrUpdate ... -func (c NotificationRecipientEmailClient) CreateOrUpdate(ctx context.Context, id RecipientEmailId) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c NotificationRecipientEmailClient) preparerForCreateOrUpdate(ctx context.Context, id RecipientEmailId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c NotificationRecipientEmailClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_delete.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_delete.go new file mode 100644 index 00000000000..083dbc0417f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_delete.go @@ -0,0 +1,47 @@ +package notificationrecipientemail + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c NotificationRecipientEmailClient) Delete(ctx context.Context, id RecipientEmailId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_delete_autorest.go deleted file mode 100644 index c38e5d32b20..00000000000 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package notificationrecipientemail - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c NotificationRecipientEmailClient) Delete(ctx context.Context, id RecipientEmailId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c NotificationRecipientEmailClient) preparerForDelete(ctx context.Context, id RecipientEmailId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c NotificationRecipientEmailClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_listbynotification.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_listbynotification.go new file mode 100644 index 00000000000..091cf193ce9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_listbynotification.go @@ -0,0 +1,52 @@ +package notificationrecipientemail + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNotificationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientEmailCollection +} + +// ListByNotification ... +func (c NotificationRecipientEmailClient) ListByNotification(ctx context.Context, id NotificationId) (result ListByNotificationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/recipientEmails", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_listbynotification_autorest.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_listbynotification_autorest.go deleted file mode 100644 index c694b327a26..00000000000 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/method_listbynotification_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package notificationrecipientemail - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByNotificationOperationResponse struct { - HttpResponse *http.Response - Model *RecipientEmailCollection -} - -// ListByNotification ... -func (c NotificationRecipientEmailClient) ListByNotification(ctx context.Context, id NotificationId) (result ListByNotificationOperationResponse, err error) { - req, err := c.preparerForListByNotification(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "ListByNotification", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "ListByNotification", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByNotification(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientemail.NotificationRecipientEmailClient", "ListByNotification", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByNotification prepares the ListByNotification request. -func (c NotificationRecipientEmailClient) preparerForListByNotification(ctx context.Context, id NotificationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/recipientEmails", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByNotification handles the response to the ListByNotification request. The method always -// closes the http.Response Body. -func (c NotificationRecipientEmailClient) responderForListByNotification(resp *http.Response) (result ListByNotificationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/client.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/client.go index ee1917a9307..eead3052766 100644 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/client.go +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/client.go @@ -1,18 +1,26 @@ package notificationrecipientuser -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type NotificationRecipientUserClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewNotificationRecipientUserClientWithBaseURI(endpoint string) NotificationRecipientUserClient { - return NotificationRecipientUserClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewNotificationRecipientUserClientWithBaseURI(api sdkEnv.Api) (*NotificationRecipientUserClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "notificationrecipientuser", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NotificationRecipientUserClient: %+v", err) } + + return &NotificationRecipientUserClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/constants.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/constants.go index 32178bd55a0..879dbf85c44 100644 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/constants.go +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/constants.go @@ -1,6 +1,10 @@ package notificationrecipientuser -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -29,6 +33,19 @@ func PossibleValuesForNotificationName() []string { } } +func (s *NotificationName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNotificationName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNotificationName(input string) (*NotificationName, error) { vals := map[string]NotificationName{ "accountclosedpublisher": NotificationNameAccountClosedPublisher, diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_checkentityexists.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_checkentityexists.go new file mode 100644 index 00000000000..baae87b86d1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_checkentityexists.go @@ -0,0 +1,46 @@ +package notificationrecipientuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c NotificationRecipientUserClient) CheckEntityExists(ctx context.Context, id RecipientUserId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_checkentityexists_autorest.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_checkentityexists_autorest.go deleted file mode 100644 index ddfad8eeecb..00000000000 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_checkentityexists_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package notificationrecipientuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckEntityExistsOperationResponse struct { - HttpResponse *http.Response -} - -// CheckEntityExists ... -func (c NotificationRecipientUserClient) CheckEntityExists(ctx context.Context, id RecipientUserId) (result CheckEntityExistsOperationResponse, err error) { - req, err := c.preparerForCheckEntityExists(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CheckEntityExists", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckEntityExists(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CheckEntityExists", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckEntityExists prepares the CheckEntityExists request. -func (c NotificationRecipientUserClient) preparerForCheckEntityExists(ctx context.Context, id RecipientUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckEntityExists handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (c NotificationRecipientUserClient) responderForCheckEntityExists(resp *http.Response) (result CheckEntityExistsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_createorupdate.go new file mode 100644 index 00000000000..a9b12b60ca8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_createorupdate.go @@ -0,0 +1,52 @@ +package notificationrecipientuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientUserContract +} + +// CreateOrUpdate ... +func (c NotificationRecipientUserClient) CreateOrUpdate(ctx context.Context, id RecipientUserId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_createorupdate_autorest.go deleted file mode 100644 index 3c013a3fa62..00000000000 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_createorupdate_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package notificationrecipientuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *RecipientUserContract -} - -// CreateOrUpdate ... -func (c NotificationRecipientUserClient) CreateOrUpdate(ctx context.Context, id RecipientUserId) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c NotificationRecipientUserClient) preparerForCreateOrUpdate(ctx context.Context, id RecipientUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c NotificationRecipientUserClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_delete.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_delete.go new file mode 100644 index 00000000000..d0bf672da2e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_delete.go @@ -0,0 +1,47 @@ +package notificationrecipientuser + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c NotificationRecipientUserClient) Delete(ctx context.Context, id RecipientUserId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_delete_autorest.go deleted file mode 100644 index 808cdd48ac5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package notificationrecipientuser - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c NotificationRecipientUserClient) Delete(ctx context.Context, id RecipientUserId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c NotificationRecipientUserClient) preparerForDelete(ctx context.Context, id RecipientUserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c NotificationRecipientUserClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_listbynotification.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_listbynotification.go new file mode 100644 index 00000000000..bfe4badf1f5 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_listbynotification.go @@ -0,0 +1,52 @@ +package notificationrecipientuser + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNotificationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecipientUserCollection +} + +// ListByNotification ... +func (c NotificationRecipientUserClient) ListByNotification(ctx context.Context, id NotificationId) (result ListByNotificationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/recipientUsers", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_listbynotification_autorest.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_listbynotification_autorest.go deleted file mode 100644 index adefe67aec1..00000000000 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/method_listbynotification_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package notificationrecipientuser - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByNotificationOperationResponse struct { - HttpResponse *http.Response - Model *RecipientUserCollection -} - -// ListByNotification ... -func (c NotificationRecipientUserClient) ListByNotification(ctx context.Context, id NotificationId) (result ListByNotificationOperationResponse, err error) { - req, err := c.preparerForListByNotification(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "ListByNotification", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "ListByNotification", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByNotification(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationrecipientuser.NotificationRecipientUserClient", "ListByNotification", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByNotification prepares the ListByNotification request. -func (c NotificationRecipientUserClient) preparerForListByNotification(ctx context.Context, id NotificationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/recipientUsers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByNotification handles the response to the ListByNotification request. The method always -// closes the http.Response Body. -func (c NotificationRecipientUserClient) responderForListByNotification(resp *http.Response) (result ListByNotificationOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/client.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/client.go index 6e9956e13eb..38b4e8fc97e 100644 --- a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/client.go +++ b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/client.go @@ -1,18 +1,26 @@ package openidconnectprovider -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type OpenidConnectProviderClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewOpenidConnectProviderClientWithBaseURI(endpoint string) OpenidConnectProviderClient { - return OpenidConnectProviderClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewOpenidConnectProviderClientWithBaseURI(api sdkEnv.Api) (*OpenidConnectProviderClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "openidconnectprovider", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating OpenidConnectProviderClient: %+v", err) } + + return &OpenidConnectProviderClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_createorupdate.go new file mode 100644 index 00000000000..022112dd8ee --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_createorupdate.go @@ -0,0 +1,85 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OpenidConnectProviderContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c OpenidConnectProviderClient) CreateOrUpdate(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_createorupdate_autorest.go deleted file mode 100644 index 4dc253d0cac..00000000000 --- a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *OpenidConnectProviderContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c OpenidConnectProviderClient) CreateOrUpdate(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c OpenidConnectProviderClient) preparerForCreateOrUpdate(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_delete.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_delete.go new file mode 100644 index 00000000000..dd6f6bbf9c4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_delete.go @@ -0,0 +1,76 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c OpenidConnectProviderClient) Delete(ctx context.Context, id OpenidConnectProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_delete_autorest.go deleted file mode 100644 index e8d831f0dbf..00000000000 --- a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c OpenidConnectProviderClient) Delete(ctx context.Context, id OpenidConnectProviderId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c OpenidConnectProviderClient) preparerForDelete(ctx context.Context, id OpenidConnectProviderId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_get.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_get.go new file mode 100644 index 00000000000..25939c8a1ce --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_get.go @@ -0,0 +1,51 @@ +package openidconnectprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OpenidConnectProviderContract +} + +// Get ... +func (c OpenidConnectProviderClient) Get(ctx context.Context, id OpenidConnectProviderId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_get_autorest.go deleted file mode 100644 index b7d07f681e5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *OpenidConnectProviderContract -} - -// Get ... -func (c OpenidConnectProviderClient) Get(ctx context.Context, id OpenidConnectProviderId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c OpenidConnectProviderClient) preparerForGet(ctx context.Context, id OpenidConnectProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_getentitytag.go new file mode 100644 index 00000000000..3f411d67cae --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_getentitytag.go @@ -0,0 +1,46 @@ +package openidconnectprovider + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c OpenidConnectProviderClient) GetEntityTag(ctx context.Context, id OpenidConnectProviderId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_getentitytag_autorest.go deleted file mode 100644 index 02fdba1af30..00000000000 --- a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c OpenidConnectProviderClient) GetEntityTag(ctx context.Context, id OpenidConnectProviderId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c OpenidConnectProviderClient) preparerForGetEntityTag(ctx context.Context, id OpenidConnectProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listbyservice.go new file mode 100644 index 00000000000..42ba42327c5 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listbyservice.go @@ -0,0 +1,125 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OpenidConnectProviderContract +} + +type ListByServiceCompleteResult struct { + Items []OpenidConnectProviderContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c OpenidConnectProviderClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/openidConnectProviders", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]OpenidConnectProviderContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c OpenidConnectProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, OpenidConnectProviderContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c OpenidConnectProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate OpenidConnectProviderContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]OpenidConnectProviderContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listbyservice_autorest.go deleted file mode 100644 index e84f3a32000..00000000000 --- a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]OpenidConnectProviderContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []OpenidConnectProviderContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c OpenidConnectProviderClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c OpenidConnectProviderClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/openidConnectProviders", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c OpenidConnectProviderClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []OpenidConnectProviderContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c OpenidConnectProviderClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, OpenidConnectProviderContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c OpenidConnectProviderClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate OpenidConnectProviderContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]OpenidConnectProviderContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listsecrets.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listsecrets.go new file mode 100644 index 00000000000..d05b3d3c365 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listsecrets.go @@ -0,0 +1,52 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ClientSecretContract +} + +// ListSecrets ... +func (c OpenidConnectProviderClient) ListSecrets(ctx context.Context, id OpenidConnectProviderId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listsecrets_autorest.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listsecrets_autorest.go deleted file mode 100644 index df2556cf4f3..00000000000 --- a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *ClientSecretContract -} - -// ListSecrets ... -func (c OpenidConnectProviderClient) ListSecrets(ctx context.Context, id OpenidConnectProviderId) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c OpenidConnectProviderClient) preparerForListSecrets(ctx context.Context, id OpenidConnectProviderId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_update.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_update.go new file mode 100644 index 00000000000..5b2402019c0 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_update.go @@ -0,0 +1,84 @@ +package openidconnectprovider + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OpenidConnectProviderContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c OpenidConnectProviderClient) Update(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_update_autorest.go deleted file mode 100644 index 5f1845c884d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package openidconnectprovider - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *OpenidConnectProviderContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c OpenidConnectProviderClient) Update(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "openidconnectprovider.OpenidConnectProviderClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c OpenidConnectProviderClient) preparerForUpdate(ctx context.Context, id OpenidConnectProviderId, input OpenidConnectProviderUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c OpenidConnectProviderClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/client.go b/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/client.go index 22c16a831a4..a9777dea6e6 100644 --- a/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/client.go +++ b/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/client.go @@ -1,18 +1,26 @@ package outboundnetworkdependenciesendpoints -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type OutboundNetworkDependenciesEndpointsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(endpoint string) OutboundNetworkDependenciesEndpointsClient { - return OutboundNetworkDependenciesEndpointsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api sdkEnv.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "outboundnetworkdependenciesendpoints", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating OutboundNetworkDependenciesEndpointsClient: %+v", err) } + + return &OutboundNetworkDependenciesEndpointsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/method_listbyservice.go new file mode 100644 index 00000000000..32234f6b430 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/method_listbyservice.go @@ -0,0 +1,52 @@ +package outboundnetworkdependenciesendpoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OutboundEnvironmentEndpointList +} + +// ListByService ... +func (c OutboundNetworkDependenciesEndpointsClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/method_listbyservice_autorest.go deleted file mode 100644 index 6c0aaf4214b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/method_listbyservice_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package outboundnetworkdependenciesendpoints - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *OutboundEnvironmentEndpointList -} - -// ListByService ... -func (c OutboundNetworkDependenciesEndpointsClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "outboundnetworkdependenciesendpoints.OutboundNetworkDependenciesEndpointsClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "outboundnetworkdependenciesendpoints.OutboundNetworkDependenciesEndpointsClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "outboundnetworkdependenciesendpoints.OutboundNetworkDependenciesEndpointsClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c OutboundNetworkDependenciesEndpointsClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c OutboundNetworkDependenciesEndpointsClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/client.go b/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/client.go index 9ad3cc36b7c..7edfe6f1c0d 100644 --- a/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/client.go +++ b/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/client.go @@ -1,18 +1,26 @@ package performconnectivitycheck -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PerformConnectivityCheckClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPerformConnectivityCheckClientWithBaseURI(endpoint string) PerformConnectivityCheckClient { - return PerformConnectivityCheckClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPerformConnectivityCheckClientWithBaseURI(api sdkEnv.Api) (*PerformConnectivityCheckClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "performconnectivitycheck", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PerformConnectivityCheckClient: %+v", err) } + + return &PerformConnectivityCheckClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/constants.go b/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/constants.go index 9bf9ce98491..df0ed03802b 100644 --- a/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/constants.go +++ b/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/constants.go @@ -1,6 +1,10 @@ package performconnectivitycheck -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForConnectionStatus() []string { } } +func (s *ConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseConnectionStatus(input string) (*ConnectionStatus, error) { vals := map[string]ConnectionStatus{ "connected": ConnectionStatusConnected, @@ -55,6 +72,19 @@ func PossibleValuesForConnectivityCheckProtocol() []string { } } +func (s *ConnectivityCheckProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConnectivityCheckProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseConnectivityCheckProtocol(input string) (*ConnectivityCheckProtocol, error) { vals := map[string]ConnectivityCheckProtocol{ "http": ConnectivityCheckProtocolHTTP, @@ -98,6 +128,19 @@ func PossibleValuesForIssueType() []string { } } +func (s *IssueType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIssueType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIssueType(input string) (*IssueType, error) { vals := map[string]IssueType{ "agentstopped": IssueTypeAgentStopped, @@ -133,6 +176,19 @@ func PossibleValuesForMethod() []string { } } +func (s *Method) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseMethod(input string) (*Method, error) { vals := map[string]Method{ "get": MethodGET, @@ -163,6 +219,19 @@ func PossibleValuesForOrigin() []string { } } +func (s *Origin) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrigin(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseOrigin(input string) (*Origin, error) { vals := map[string]Origin{ "inbound": OriginInbound, @@ -190,6 +259,19 @@ func PossibleValuesForPreferredIPVersion() []string { } } +func (s *PreferredIPVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePreferredIPVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePreferredIPVersion(input string) (*PreferredIPVersion, error) { vals := map[string]PreferredIPVersion{ "ipv4": PreferredIPVersionIPvFour, @@ -217,6 +299,19 @@ func PossibleValuesForSeverity() []string { } } +func (s *Severity) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSeverity(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSeverity(input string) (*Severity, error) { vals := map[string]Severity{ "error": SeverityError, diff --git a/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/method_async.go b/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/method_async.go new file mode 100644 index 00000000000..ecb7574e628 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/method_async.go @@ -0,0 +1,74 @@ +package performconnectivitycheck + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AsyncOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Async ... +func (c PerformConnectivityCheckClient) Async(ctx context.Context, id ServiceId, input ConnectivityCheckRequest) (result AsyncOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/connectivityCheck", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AsyncThenPoll performs Async then polls until it's completed +func (c PerformConnectivityCheckClient) AsyncThenPoll(ctx context.Context, id ServiceId, input ConnectivityCheckRequest) error { + result, err := c.Async(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Async: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Async: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/method_async_autorest.go b/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/method_async_autorest.go deleted file mode 100644 index a2c486cc975..00000000000 --- a/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/method_async_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package performconnectivitycheck - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AsyncOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Async ... -func (c PerformConnectivityCheckClient) Async(ctx context.Context, id ServiceId, input ConnectivityCheckRequest) (result AsyncOperationResponse, err error) { - req, err := c.preparerForAsync(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "performconnectivitycheck.PerformConnectivityCheckClient", "Async", nil, "Failure preparing request") - return - } - - result, err = c.senderForAsync(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "performconnectivitycheck.PerformConnectivityCheckClient", "Async", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// AsyncThenPoll performs Async then polls until it's completed -func (c PerformConnectivityCheckClient) AsyncThenPoll(ctx context.Context, id ServiceId, input ConnectivityCheckRequest) error { - result, err := c.Async(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Async: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Async: %+v", err) - } - - return nil -} - -// preparerForAsync prepares the Async request. -func (c PerformConnectivityCheckClient) preparerForAsync(ctx context.Context, id ServiceId, input ConnectivityCheckRequest) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/connectivityCheck", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForAsync sends the Async request. The method will close the -// http.Response Body if it receives an error. -func (c PerformConnectivityCheckClient) senderForAsync(ctx context.Context, req *http.Request) (future AsyncOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policy/client.go b/resource-manager/apimanagement/2022-08-01/policy/client.go index 100ea9be74e..3d97a46f131 100644 --- a/resource-manager/apimanagement/2022-08-01/policy/client.go +++ b/resource-manager/apimanagement/2022-08-01/policy/client.go @@ -1,18 +1,26 @@ package policy -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PolicyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPolicyClientWithBaseURI(endpoint string) PolicyClient { - return PolicyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPolicyClientWithBaseURI(api sdkEnv.Api) (*PolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "policy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PolicyClient: %+v", err) } + + return &PolicyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/policy/constants.go b/resource-manager/apimanagement/2022-08-01/policy/constants.go index d347a3402e1..10a4650a395 100644 --- a/resource-manager/apimanagement/2022-08-01/policy/constants.go +++ b/resource-manager/apimanagement/2022-08-01/policy/constants.go @@ -1,6 +1,10 @@ package policy -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPolicyContentFormat() []string { } } +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { vals := map[string]PolicyContentFormat{ "rawxml": PolicyContentFormatRawxml, @@ -53,6 +70,19 @@ func PossibleValuesForPolicyExportFormat() []string { } } +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { vals := map[string]PolicyExportFormat{ "rawxml": PolicyExportFormatRawxml, diff --git a/resource-manager/apimanagement/2022-08-01/policy/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/policy/method_createorupdate.go new file mode 100644 index 00000000000..0303d637d5e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policy/method_createorupdate.go @@ -0,0 +1,85 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c PolicyClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/policy/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/policy/method_createorupdate_autorest.go deleted file mode 100644 index 6891db3acdb..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policy/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package policy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c PolicyClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c PolicyClient) preparerForCreateOrUpdate(ctx context.Context, id ServiceId, input PolicyContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c PolicyClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policy/method_delete.go b/resource-manager/apimanagement/2022-08-01/policy/method_delete.go new file mode 100644 index 00000000000..4ddd78e13cb --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policy/method_delete.go @@ -0,0 +1,76 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c PolicyClient) Delete(ctx context.Context, id ServiceId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/policy/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/policy/method_delete_autorest.go deleted file mode 100644 index 48c0e129f41..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policy/method_delete_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package policy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c PolicyClient) Delete(ctx context.Context, id ServiceId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c PolicyClient) preparerForDelete(ctx context.Context, id ServiceId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c PolicyClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policy/method_get.go b/resource-manager/apimanagement/2022-08-01/policy/method_get.go new file mode 100644 index 00000000000..829e84ff74d --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policy/method_get.go @@ -0,0 +1,80 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c PolicyClient) Get(ctx context.Context, id ServiceId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/policy/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/policy/method_get_autorest.go deleted file mode 100644 index 5b1f10a4714..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policy/method_get_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package policy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type GetOperationOptions struct { - Format *PolicyExportFormat -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - return out -} - -// Get ... -func (c PolicyClient) Get(ctx context.Context, id ServiceId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c PolicyClient) preparerForGet(ctx context.Context, id ServiceId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c PolicyClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policy/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/policy/method_getentitytag.go new file mode 100644 index 00000000000..d8575a5f4ca --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policy/method_getentitytag.go @@ -0,0 +1,47 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c PolicyClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/policy/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/policy/method_getentitytag_autorest.go deleted file mode 100644 index 40957baa188..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policy/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package policy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c PolicyClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c PolicyClient) preparerForGetEntityTag(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c PolicyClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policy/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/policy/method_listbyservice.go new file mode 100644 index 00000000000..2cba37b4dd0 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policy/method_listbyservice.go @@ -0,0 +1,52 @@ +package policy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByService ... +func (c PolicyClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/policy/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/policy/method_listbyservice_autorest.go deleted file mode 100644 index 753788e2a82..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policy/method_listbyservice_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package policy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *PolicyCollection -} - -// ListByService ... -func (c PolicyClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.PolicyClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c PolicyClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c PolicyClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policydescription/client.go b/resource-manager/apimanagement/2022-08-01/policydescription/client.go index 2ad1b60908c..92766324c7e 100644 --- a/resource-manager/apimanagement/2022-08-01/policydescription/client.go +++ b/resource-manager/apimanagement/2022-08-01/policydescription/client.go @@ -1,18 +1,26 @@ package policydescription -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PolicyDescriptionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPolicyDescriptionClientWithBaseURI(endpoint string) PolicyDescriptionClient { - return PolicyDescriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPolicyDescriptionClientWithBaseURI(api sdkEnv.Api) (*PolicyDescriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "policydescription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PolicyDescriptionClient: %+v", err) } + + return &PolicyDescriptionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/policydescription/constants.go b/resource-manager/apimanagement/2022-08-01/policydescription/constants.go index 5f73fe9e994..be5c274580c 100644 --- a/resource-manager/apimanagement/2022-08-01/policydescription/constants.go +++ b/resource-manager/apimanagement/2022-08-01/policydescription/constants.go @@ -1,6 +1,10 @@ package policydescription -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -25,6 +29,19 @@ func PossibleValuesForPolicyScopeContract() []string { } } +func (s *PolicyScopeContract) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyScopeContract(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyScopeContract(input string) (*PolicyScopeContract, error) { vals := map[string]PolicyScopeContract{ "all": PolicyScopeContractAll, diff --git a/resource-manager/apimanagement/2022-08-01/policydescription/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/policydescription/method_listbyservice.go new file mode 100644 index 00000000000..397951b3351 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policydescription/method_listbyservice.go @@ -0,0 +1,80 @@ +package policydescription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyDescriptionCollection +} + +type ListByServiceOperationOptions struct { + Scope *PolicyScopeContract +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Scope != nil { + out.Append("scope", fmt.Sprintf("%v", *o.Scope)) + } + return &out +} + +// ListByService ... +func (c PolicyDescriptionClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policyDescriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/policydescription/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/policydescription/method_listbyservice_autorest.go deleted file mode 100644 index 0b74d09e511..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policydescription/method_listbyservice_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package policydescription - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *PolicyDescriptionCollection -} - -type ListByServiceOperationOptions struct { - Scope *PolicyScopeContract -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Scope != nil { - out["scope"] = *o.Scope - } - - return out -} - -// ListByService ... -func (c PolicyDescriptionClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policydescription.PolicyDescriptionClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policydescription.PolicyDescriptionClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policydescription.PolicyDescriptionClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c PolicyDescriptionClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policyDescriptions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c PolicyDescriptionClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/client.go b/resource-manager/apimanagement/2022-08-01/policyfragment/client.go index 18490ea107c..8967162b5ee 100644 --- a/resource-manager/apimanagement/2022-08-01/policyfragment/client.go +++ b/resource-manager/apimanagement/2022-08-01/policyfragment/client.go @@ -1,18 +1,26 @@ package policyfragment -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PolicyFragmentClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPolicyFragmentClientWithBaseURI(endpoint string) PolicyFragmentClient { - return PolicyFragmentClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPolicyFragmentClientWithBaseURI(api sdkEnv.Api) (*PolicyFragmentClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "policyfragment", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PolicyFragmentClient: %+v", err) } + + return &PolicyFragmentClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/constants.go b/resource-manager/apimanagement/2022-08-01/policyfragment/constants.go index 488ac0f2c2a..60aec2160bc 100644 --- a/resource-manager/apimanagement/2022-08-01/policyfragment/constants.go +++ b/resource-manager/apimanagement/2022-08-01/policyfragment/constants.go @@ -1,6 +1,10 @@ package policyfragment -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForPolicyFragmentContentFormat() []string { } } +func (s *PolicyFragmentContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyFragmentContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyFragmentContentFormat(input string) (*PolicyFragmentContentFormat, error) { vals := map[string]PolicyFragmentContentFormat{ "rawxml": PolicyFragmentContentFormatRawxml, diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_createorupdate.go new file mode 100644 index 00000000000..009b8d3a927 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policyfragment/method_createorupdate.go @@ -0,0 +1,103 @@ +package policyfragment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c PolicyFragmentClient) CreateOrUpdate(ctx context.Context, id PolicyFragmentId, input PolicyFragmentContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PolicyFragmentClient) CreateOrUpdateThenPoll(ctx context.Context, id PolicyFragmentId, input PolicyFragmentContract, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_createorupdate_autorest.go deleted file mode 100644 index a2894348f3d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policyfragment/method_createorupdate_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package policyfragment - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c PolicyFragmentClient) CreateOrUpdate(ctx context.Context, id PolicyFragmentId, input PolicyFragmentContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c PolicyFragmentClient) CreateOrUpdateThenPoll(ctx context.Context, id PolicyFragmentId, input PolicyFragmentContract, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c PolicyFragmentClient) preparerForCreateOrUpdate(ctx context.Context, id PolicyFragmentId, input PolicyFragmentContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c PolicyFragmentClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_delete.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_delete.go new file mode 100644 index 00000000000..c64764861f9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policyfragment/method_delete.go @@ -0,0 +1,76 @@ +package policyfragment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c PolicyFragmentClient) Delete(ctx context.Context, id PolicyFragmentId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_delete_autorest.go deleted file mode 100644 index 3fa7776b197..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policyfragment/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package policyfragment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c PolicyFragmentClient) Delete(ctx context.Context, id PolicyFragmentId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c PolicyFragmentClient) preparerForDelete(ctx context.Context, id PolicyFragmentId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c PolicyFragmentClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_get.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_get.go new file mode 100644 index 00000000000..d954db31db3 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policyfragment/method_get.go @@ -0,0 +1,80 @@ +package policyfragment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyFragmentContract +} + +type GetOperationOptions struct { + Format *PolicyFragmentContentFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c PolicyFragmentClient) Get(ctx context.Context, id PolicyFragmentId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_get_autorest.go deleted file mode 100644 index 9308600e3de..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policyfragment/method_get_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package policyfragment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PolicyFragmentContract -} - -type GetOperationOptions struct { - Format *PolicyFragmentContentFormat -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - return out -} - -// Get ... -func (c PolicyFragmentClient) Get(ctx context.Context, id PolicyFragmentId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c PolicyFragmentClient) preparerForGet(ctx context.Context, id PolicyFragmentId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c PolicyFragmentClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_getentitytag.go new file mode 100644 index 00000000000..1d3b811f0e0 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policyfragment/method_getentitytag.go @@ -0,0 +1,46 @@ +package policyfragment + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c PolicyFragmentClient) GetEntityTag(ctx context.Context, id PolicyFragmentId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_getentitytag_autorest.go deleted file mode 100644 index f1a7ad2c35d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policyfragment/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package policyfragment - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c PolicyFragmentClient) GetEntityTag(ctx context.Context, id PolicyFragmentId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c PolicyFragmentClient) preparerForGetEntityTag(ctx context.Context, id PolicyFragmentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c PolicyFragmentClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_listbyservice.go new file mode 100644 index 00000000000..04a5102f3ea --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policyfragment/method_listbyservice.go @@ -0,0 +1,92 @@ +package policyfragment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyFragmentCollection +} + +type ListByServiceOperationOptions struct { + Filter *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c PolicyFragmentClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policyFragments", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_listbyservice_autorest.go deleted file mode 100644 index 0207c407e77..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policyfragment/method_listbyservice_autorest.go +++ /dev/null @@ -1,113 +0,0 @@ -package policyfragment - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *PolicyFragmentCollection -} - -type ListByServiceOperationOptions struct { - Filter *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c PolicyFragmentClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c PolicyFragmentClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policyFragments", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c PolicyFragmentClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_listreferences.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_listreferences.go new file mode 100644 index 00000000000..77dd2dbf94a --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/policyfragment/method_listreferences.go @@ -0,0 +1,84 @@ +package policyfragment + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListReferencesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ResourceCollection +} + +type ListReferencesOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListReferencesOperationOptions() ListReferencesOperationOptions { + return ListReferencesOperationOptions{} +} + +func (o ListReferencesOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListReferencesOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListReferencesOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListReferences ... +func (c PolicyFragmentClient) ListReferences(ctx context.Context, id PolicyFragmentId, options ListReferencesOperationOptions) (result ListReferencesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listReferences", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/method_listreferences_autorest.go b/resource-manager/apimanagement/2022-08-01/policyfragment/method_listreferences_autorest.go deleted file mode 100644 index 2faa2082619..00000000000 --- a/resource-manager/apimanagement/2022-08-01/policyfragment/method_listreferences_autorest.go +++ /dev/null @@ -1,103 +0,0 @@ -package policyfragment - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListReferencesOperationResponse struct { - HttpResponse *http.Response - Model *ResourceCollection -} - -type ListReferencesOperationOptions struct { - Skip *int64 - Top *int64 -} - -func DefaultListReferencesOperationOptions() ListReferencesOperationOptions { - return ListReferencesOperationOptions{} -} - -func (o ListReferencesOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListReferencesOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListReferences ... -func (c PolicyFragmentClient) ListReferences(ctx context.Context, id PolicyFragmentId, options ListReferencesOperationOptions) (result ListReferencesOperationResponse, err error) { - req, err := c.preparerForListReferences(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "ListReferences", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "ListReferences", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListReferences(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "policyfragment.PolicyFragmentClient", "ListReferences", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListReferences prepares the ListReferences request. -func (c PolicyFragmentClient) preparerForListReferences(ctx context.Context, id PolicyFragmentId, options ListReferencesOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/listReferences", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListReferences handles the response to the ListReferences request. The method always -// closes the http.Response Body. -func (c PolicyFragmentClient) responderForListReferences(resp *http.Response) (result ListReferencesOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/client.go b/resource-manager/apimanagement/2022-08-01/portalconfig/client.go index 11a8d2ba497..4af5c5865fc 100644 --- a/resource-manager/apimanagement/2022-08-01/portalconfig/client.go +++ b/resource-manager/apimanagement/2022-08-01/portalconfig/client.go @@ -1,18 +1,26 @@ package portalconfig -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PortalConfigClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPortalConfigClientWithBaseURI(endpoint string) PortalConfigClient { - return PortalConfigClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPortalConfigClientWithBaseURI(api sdkEnv.Api) (*PortalConfigClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "portalconfig", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PortalConfigClient: %+v", err) } + + return &PortalConfigClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/constants.go b/resource-manager/apimanagement/2022-08-01/portalconfig/constants.go index 2a479921c56..5329a0b27fc 100644 --- a/resource-manager/apimanagement/2022-08-01/portalconfig/constants.go +++ b/resource-manager/apimanagement/2022-08-01/portalconfig/constants.go @@ -1,6 +1,10 @@ package portalconfig -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForPortalSettingsCspMode() []string { } } +func (s *PortalSettingsCspMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePortalSettingsCspMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePortalSettingsCspMode(input string) (*PortalSettingsCspMode, error) { vals := map[string]PortalSettingsCspMode{ "disabled": PortalSettingsCspModeDisabled, diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/portalconfig/method_createorupdate.go new file mode 100644 index 00000000000..b25743bf5fa --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/portalconfig/method_createorupdate.go @@ -0,0 +1,84 @@ +package portalconfig + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalConfigContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c PortalConfigClient) CreateOrUpdate(ctx context.Context, id PortalConfigId, input PortalConfigContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/portalconfig/method_createorupdate_autorest.go deleted file mode 100644 index 65548a236c4..00000000000 --- a/resource-manager/apimanagement/2022-08-01/portalconfig/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package portalconfig - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PortalConfigContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c PortalConfigClient) CreateOrUpdate(ctx context.Context, id PortalConfigId, input PortalConfigContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c PortalConfigClient) preparerForCreateOrUpdate(ctx context.Context, id PortalConfigId, input PortalConfigContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c PortalConfigClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/method_get.go b/resource-manager/apimanagement/2022-08-01/portalconfig/method_get.go new file mode 100644 index 00000000000..5c75192f019 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/portalconfig/method_get.go @@ -0,0 +1,51 @@ +package portalconfig + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalConfigContract +} + +// Get ... +func (c PortalConfigClient) Get(ctx context.Context, id PortalConfigId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/portalconfig/method_get_autorest.go deleted file mode 100644 index 499483dec16..00000000000 --- a/resource-manager/apimanagement/2022-08-01/portalconfig/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package portalconfig - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PortalConfigContract -} - -// Get ... -func (c PortalConfigClient) Get(ctx context.Context, id PortalConfigId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c PortalConfigClient) preparerForGet(ctx context.Context, id PortalConfigId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c PortalConfigClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/portalconfig/method_getentitytag.go new file mode 100644 index 00000000000..72fdc64bba5 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/portalconfig/method_getentitytag.go @@ -0,0 +1,46 @@ +package portalconfig + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c PortalConfigClient) GetEntityTag(ctx context.Context, id PortalConfigId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/portalconfig/method_getentitytag_autorest.go deleted file mode 100644 index 2a5b8158e77..00000000000 --- a/resource-manager/apimanagement/2022-08-01/portalconfig/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package portalconfig - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c PortalConfigClient) GetEntityTag(ctx context.Context, id PortalConfigId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c PortalConfigClient) preparerForGetEntityTag(ctx context.Context, id PortalConfigId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c PortalConfigClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/portalconfig/method_listbyservice.go new file mode 100644 index 00000000000..c3452f50639 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/portalconfig/method_listbyservice.go @@ -0,0 +1,52 @@ +package portalconfig + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalConfigCollection +} + +// ListByService ... +func (c PortalConfigClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalConfigs", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/portalconfig/method_listbyservice_autorest.go deleted file mode 100644 index 8cd1fbe6e9c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/portalconfig/method_listbyservice_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package portalconfig - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *PortalConfigCollection -} - -// ListByService ... -func (c PortalConfigClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c PortalConfigClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalConfigs", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c PortalConfigClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/method_update.go b/resource-manager/apimanagement/2022-08-01/portalconfig/method_update.go new file mode 100644 index 00000000000..6543c107ba9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/portalconfig/method_update.go @@ -0,0 +1,84 @@ +package portalconfig + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalConfigContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c PortalConfigClient) Update(ctx context.Context, id PortalConfigId, input PortalConfigContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/portalconfig/method_update_autorest.go deleted file mode 100644 index 8d818a308e6..00000000000 --- a/resource-manager/apimanagement/2022-08-01/portalconfig/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package portalconfig - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *PortalConfigContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c PortalConfigClient) Update(ctx context.Context, id PortalConfigId, input PortalConfigContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalconfig.PortalConfigClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c PortalConfigClient) preparerForUpdate(ctx context.Context, id PortalConfigId, input PortalConfigContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c PortalConfigClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/client.go b/resource-manager/apimanagement/2022-08-01/portalrevision/client.go index b6215519652..98c00ef362f 100644 --- a/resource-manager/apimanagement/2022-08-01/portalrevision/client.go +++ b/resource-manager/apimanagement/2022-08-01/portalrevision/client.go @@ -1,18 +1,26 @@ package portalrevision -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PortalRevisionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPortalRevisionClientWithBaseURI(endpoint string) PortalRevisionClient { - return PortalRevisionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPortalRevisionClientWithBaseURI(api sdkEnv.Api) (*PortalRevisionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "portalrevision", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PortalRevisionClient: %+v", err) } + + return &PortalRevisionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/constants.go b/resource-manager/apimanagement/2022-08-01/portalrevision/constants.go index aa2001884d8..721b9d119dc 100644 --- a/resource-manager/apimanagement/2022-08-01/portalrevision/constants.go +++ b/resource-manager/apimanagement/2022-08-01/portalrevision/constants.go @@ -1,6 +1,10 @@ package portalrevision -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPortalRevisionStatus() []string { } } +func (s *PortalRevisionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePortalRevisionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePortalRevisionStatus(input string) (*PortalRevisionStatus, error) { vals := map[string]PortalRevisionStatus{ "completed": PortalRevisionStatusCompleted, diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/portalrevision/method_createorupdate.go new file mode 100644 index 00000000000..a28f2755f5b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/portalrevision/method_createorupdate.go @@ -0,0 +1,74 @@ +package portalrevision + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c PortalRevisionClient) CreateOrUpdate(ctx context.Context, id PortalRevisionId, input PortalRevisionContract) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PortalRevisionClient) CreateOrUpdateThenPoll(ctx context.Context, id PortalRevisionId, input PortalRevisionContract) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/portalrevision/method_createorupdate_autorest.go deleted file mode 100644 index e674d1c6391..00000000000 --- a/resource-manager/apimanagement/2022-08-01/portalrevision/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package portalrevision - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c PortalRevisionClient) CreateOrUpdate(ctx context.Context, id PortalRevisionId, input PortalRevisionContract) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c PortalRevisionClient) CreateOrUpdateThenPoll(ctx context.Context, id PortalRevisionId, input PortalRevisionContract) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c PortalRevisionClient) preparerForCreateOrUpdate(ctx context.Context, id PortalRevisionId, input PortalRevisionContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c PortalRevisionClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/method_get.go b/resource-manager/apimanagement/2022-08-01/portalrevision/method_get.go new file mode 100644 index 00000000000..ebc6cd16a57 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/portalrevision/method_get.go @@ -0,0 +1,51 @@ +package portalrevision + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalRevisionContract +} + +// Get ... +func (c PortalRevisionClient) Get(ctx context.Context, id PortalRevisionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/portalrevision/method_get_autorest.go deleted file mode 100644 index 2c81b2f3322..00000000000 --- a/resource-manager/apimanagement/2022-08-01/portalrevision/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package portalrevision - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PortalRevisionContract -} - -// Get ... -func (c PortalRevisionClient) Get(ctx context.Context, id PortalRevisionId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c PortalRevisionClient) preparerForGet(ctx context.Context, id PortalRevisionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c PortalRevisionClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/portalrevision/method_getentitytag.go new file mode 100644 index 00000000000..c29d462fb8e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/portalrevision/method_getentitytag.go @@ -0,0 +1,46 @@ +package portalrevision + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c PortalRevisionClient) GetEntityTag(ctx context.Context, id PortalRevisionId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/portalrevision/method_getentitytag_autorest.go deleted file mode 100644 index 673f88eb7c5..00000000000 --- a/resource-manager/apimanagement/2022-08-01/portalrevision/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package portalrevision - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c PortalRevisionClient) GetEntityTag(ctx context.Context, id PortalRevisionId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c PortalRevisionClient) preparerForGetEntityTag(ctx context.Context, id PortalRevisionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c PortalRevisionClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/portalrevision/method_listbyservice.go new file mode 100644 index 00000000000..367a0040241 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/portalrevision/method_listbyservice.go @@ -0,0 +1,125 @@ +package portalrevision + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PortalRevisionContract +} + +type ListByServiceCompleteResult struct { + Items []PortalRevisionContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c PortalRevisionClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalRevisions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]PortalRevisionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c PortalRevisionClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, PortalRevisionContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PortalRevisionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate PortalRevisionContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]PortalRevisionContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/portalrevision/method_listbyservice_autorest.go deleted file mode 100644 index e804ebd138b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/portalrevision/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package portalrevision - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]PortalRevisionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []PortalRevisionContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c PortalRevisionClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c PortalRevisionClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalRevisions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c PortalRevisionClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c PortalRevisionClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []PortalRevisionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c PortalRevisionClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, PortalRevisionContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c PortalRevisionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate PortalRevisionContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]PortalRevisionContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/method_update.go b/resource-manager/apimanagement/2022-08-01/portalrevision/method_update.go new file mode 100644 index 00000000000..d9b47a64729 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/portalrevision/method_update.go @@ -0,0 +1,102 @@ +package portalrevision + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c PortalRevisionClient) Update(ctx context.Context, id PortalRevisionId, input PortalRevisionContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c PortalRevisionClient) UpdateThenPoll(ctx context.Context, id PortalRevisionId, input PortalRevisionContract, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/portalrevision/method_update_autorest.go deleted file mode 100644 index e6c980e81fa..00000000000 --- a/resource-manager/apimanagement/2022-08-01/portalrevision/method_update_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package portalrevision - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c PortalRevisionClient) Update(ctx context.Context, id PortalRevisionId, input PortalRevisionContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "portalrevision.PortalRevisionClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c PortalRevisionClient) UpdateThenPoll(ctx context.Context, id PortalRevisionId, input PortalRevisionContract, options UpdateOperationOptions) error { - result, err := c.Update(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c PortalRevisionClient) preparerForUpdate(ctx context.Context, id PortalRevisionId, input PortalRevisionContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c PortalRevisionClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/portalsettings/client.go b/resource-manager/apimanagement/2022-08-01/portalsettings/client.go index 7f256742d89..c51b0c431f7 100644 --- a/resource-manager/apimanagement/2022-08-01/portalsettings/client.go +++ b/resource-manager/apimanagement/2022-08-01/portalsettings/client.go @@ -1,18 +1,26 @@ package portalsettings -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PortalSettingsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPortalSettingsClientWithBaseURI(endpoint string) PortalSettingsClient { - return PortalSettingsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPortalSettingsClientWithBaseURI(api sdkEnv.Api) (*PortalSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "portalsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PortalSettingsClient: %+v", err) } + + return &PortalSettingsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/portalsettings/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/portalsettings/method_listbyservice.go new file mode 100644 index 00000000000..5f25ab8003b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/portalsettings/method_listbyservice.go @@ -0,0 +1,52 @@ +package portalsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSettingsCollection +} + +// ListByService ... +func (c PortalSettingsClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalsettings", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/portalsettings/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/portalsettings/method_listbyservice_autorest.go deleted file mode 100644 index d9168eff5c9..00000000000 --- a/resource-manager/apimanagement/2022-08-01/portalsettings/method_listbyservice_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package portalsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *PortalSettingsCollection -} - -// ListByService ... -func (c PortalSettingsClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "portalsettings.PortalSettingsClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "portalsettings.PortalSettingsClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "portalsettings.PortalSettingsClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c PortalSettingsClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c PortalSettingsClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/client.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/client.go index 1de584406fe..869f8329c9a 100644 --- a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/client.go +++ b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/client.go @@ -1,18 +1,26 @@ package privateendpointconnections -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type PrivateEndpointConnectionsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(endpoint string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) } + + return &PrivateEndpointConnectionsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/constants.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/constants.go index b6aed9e880a..c5850609650 100644 --- a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/constants.go +++ b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/constants.go @@ -1,6 +1,10 @@ package privateendpointconnections -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { } } +func (s *PrivateEndpointConnectionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { vals := map[string]PrivateEndpointConnectionProvisioningState{ "creating": PrivateEndpointConnectionProvisioningStateCreating, @@ -55,6 +72,19 @@ func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { } } +func (s *PrivateEndpointServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { vals := map[string]PrivateEndpointServiceConnectionStatus{ "approved": PrivateEndpointServiceConnectionStatusApproved, diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate.go new file mode 100644 index 00000000000..f348834c3ca --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate.go @@ -0,0 +1,74 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PrivateEndpointConnectionCreateOrUpdate ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionRequest) (result PrivateEndpointConnectionCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PrivateEndpointConnectionCreateOrUpdateThenPoll performs PrivateEndpointConnectionCreateOrUpdate then polls until it's completed +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionCreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionRequest) error { + result, err := c.PrivateEndpointConnectionCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PrivateEndpointConnectionCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PrivateEndpointConnectionCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate_autorest.go deleted file mode 100644 index f890917081c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectioncreateorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionCreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// PrivateEndpointConnectionCreateOrUpdate ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionRequest) (result PrivateEndpointConnectionCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionCreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForPrivateEndpointConnectionCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// PrivateEndpointConnectionCreateOrUpdateThenPoll performs PrivateEndpointConnectionCreateOrUpdate then polls until it's completed -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionCreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionRequest) error { - result, err := c.PrivateEndpointConnectionCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing PrivateEndpointConnectionCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after PrivateEndpointConnectionCreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForPrivateEndpointConnectionCreateOrUpdate prepares the PrivateEndpointConnectionCreateOrUpdate request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionRequest) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForPrivateEndpointConnectionCreateOrUpdate sends the PrivateEndpointConnectionCreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateEndpointConnectionsClient) senderForPrivateEndpointConnectionCreateOrUpdate(ctx context.Context, req *http.Request) (future PrivateEndpointConnectionCreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiondelete.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiondelete.go new file mode 100644 index 00000000000..3dea5aca1b3 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiondelete.go @@ -0,0 +1,71 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PrivateEndpointConnectionDelete ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionDelete(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PrivateEndpointConnectionDeleteThenPoll performs PrivateEndpointConnectionDelete then polls until it's completed +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionDeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { + result, err := c.PrivateEndpointConnectionDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing PrivateEndpointConnectionDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PrivateEndpointConnectionDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiondelete_autorest.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiondelete_autorest.go deleted file mode 100644 index 6c53edbf85b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiondelete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionDeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// PrivateEndpointConnectionDelete ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionDelete(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionDeleteOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionDelete", nil, "Failure preparing request") - return - } - - result, err = c.senderForPrivateEndpointConnectionDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionDelete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// PrivateEndpointConnectionDeleteThenPoll performs PrivateEndpointConnectionDelete then polls until it's completed -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionDeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { - result, err := c.PrivateEndpointConnectionDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing PrivateEndpointConnectionDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after PrivateEndpointConnectionDelete: %+v", err) - } - - return nil -} - -// preparerForPrivateEndpointConnectionDelete prepares the PrivateEndpointConnectionDelete request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionDelete(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForPrivateEndpointConnectionDelete sends the PrivateEndpointConnectionDelete request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateEndpointConnectionsClient) senderForPrivateEndpointConnectionDelete(ctx context.Context, req *http.Request) (future PrivateEndpointConnectionDeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname.go new file mode 100644 index 00000000000..51d57d4f314 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname.go @@ -0,0 +1,51 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionGetByNameOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnection +} + +// PrivateEndpointConnectionGetByName ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionGetByName(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionGetByNameOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname_autorest.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname_autorest.go deleted file mode 100644 index 88167729441..00000000000 --- a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetbyname_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionGetByNameOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnection -} - -// PrivateEndpointConnectionGetByName ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionGetByName(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionGetByNameOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionGetByName(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetByName", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetByName", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionGetByName(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetByName", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionGetByName prepares the PrivateEndpointConnectionGetByName request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionGetByName(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionGetByName handles the response to the PrivateEndpointConnectionGetByName request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForPrivateEndpointConnectionGetByName(resp *http.Response) (result PrivateEndpointConnectionGetByNameOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource.go new file mode 100644 index 00000000000..fd334bbacc0 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource.go @@ -0,0 +1,51 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionGetPrivateLinkResourceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkResource +} + +// PrivateEndpointConnectionGetPrivateLinkResource ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionGetPrivateLinkResource(ctx context.Context, id PrivateLinkResourceId) (result PrivateEndpointConnectionGetPrivateLinkResourceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource_autorest.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource_autorest.go deleted file mode 100644 index 511f46e493e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectiongetprivatelinkresource_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionGetPrivateLinkResourceOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkResource -} - -// PrivateEndpointConnectionGetPrivateLinkResource ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionGetPrivateLinkResource(ctx context.Context, id PrivateLinkResourceId) (result PrivateEndpointConnectionGetPrivateLinkResourceOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionGetPrivateLinkResource(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetPrivateLinkResource", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetPrivateLinkResource", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionGetPrivateLinkResource(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionGetPrivateLinkResource", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionGetPrivateLinkResource prepares the PrivateEndpointConnectionGetPrivateLinkResource request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionGetPrivateLinkResource(ctx context.Context, id PrivateLinkResourceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionGetPrivateLinkResource handles the response to the PrivateEndpointConnectionGetPrivateLinkResource request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForPrivateEndpointConnectionGetPrivateLinkResource(resp *http.Response) (result PrivateEndpointConnectionGetPrivateLinkResourceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice.go new file mode 100644 index 00000000000..7ac03e3c251 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice.go @@ -0,0 +1,52 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionListByService ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionListByService(ctx context.Context, id ServiceId) (result PrivateEndpointConnectionListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/privateEndpointConnections", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice_autorest.go deleted file mode 100644 index a3878a76021..00000000000 --- a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistbyservice_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnectionListResult -} - -// PrivateEndpointConnectionListByService ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionListByService(ctx context.Context, id ServiceId) (result PrivateEndpointConnectionListByServiceOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionListByService prepares the PrivateEndpointConnectionListByService request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/privateEndpointConnections", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionListByService handles the response to the PrivateEndpointConnectionListByService request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForPrivateEndpointConnectionListByService(resp *http.Response) (result PrivateEndpointConnectionListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources.go new file mode 100644 index 00000000000..5d2881f7c92 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources.go @@ -0,0 +1,52 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionListPrivateLinkResourcesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkResourceListResult +} + +// PrivateEndpointConnectionListPrivateLinkResources ... +func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionListPrivateLinkResources(ctx context.Context, id ServiceId) (result PrivateEndpointConnectionListPrivateLinkResourcesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/privateLinkResources", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources_autorest.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources_autorest.go deleted file mode 100644 index 2a3bdcb3962..00000000000 --- a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/method_privateendpointconnectionlistprivatelinkresources_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package privateendpointconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionListPrivateLinkResourcesOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkResourceListResult -} - -// PrivateEndpointConnectionListPrivateLinkResources ... -func (c PrivateEndpointConnectionsClient) PrivateEndpointConnectionListPrivateLinkResources(ctx context.Context, id ServiceId) (result PrivateEndpointConnectionListPrivateLinkResourcesOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionListPrivateLinkResources(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListPrivateLinkResources", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListPrivateLinkResources", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionListPrivateLinkResources(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "PrivateEndpointConnectionListPrivateLinkResources", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionListPrivateLinkResources prepares the PrivateEndpointConnectionListPrivateLinkResources request. -func (c PrivateEndpointConnectionsClient) preparerForPrivateEndpointConnectionListPrivateLinkResources(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/privateLinkResources", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionListPrivateLinkResources handles the response to the PrivateEndpointConnectionListPrivateLinkResources request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionsClient) responderForPrivateEndpointConnectionListPrivateLinkResources(resp *http.Response) (result PrivateEndpointConnectionListPrivateLinkResourcesOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/product/client.go b/resource-manager/apimanagement/2022-08-01/product/client.go index 964cb7131cc..f935e2591bc 100644 --- a/resource-manager/apimanagement/2022-08-01/product/client.go +++ b/resource-manager/apimanagement/2022-08-01/product/client.go @@ -1,18 +1,26 @@ package product -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductClientWithBaseURI(endpoint string) ProductClient { - return ProductClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductClientWithBaseURI(api sdkEnv.Api) (*ProductClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "product", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductClient: %+v", err) } + + return &ProductClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/product/constants.go b/resource-manager/apimanagement/2022-08-01/product/constants.go index d9ad59725fd..b1aa827fdb2 100644 --- a/resource-manager/apimanagement/2022-08-01/product/constants.go +++ b/resource-manager/apimanagement/2022-08-01/product/constants.go @@ -1,6 +1,10 @@ package product -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, diff --git a/resource-manager/apimanagement/2022-08-01/product/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/product/method_createorupdate.go new file mode 100644 index 00000000000..dc69508e31c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/product/method_createorupdate.go @@ -0,0 +1,85 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProductContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ProductClient) CreateOrUpdate(ctx context.Context, id ProductId, input ProductContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/product/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/product/method_createorupdate_autorest.go deleted file mode 100644 index 22bfb9119bf..00000000000 --- a/resource-manager/apimanagement/2022-08-01/product/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package product - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ProductContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ProductClient) CreateOrUpdate(ctx context.Context, id ProductId, input ProductContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ProductClient) preparerForCreateOrUpdate(ctx context.Context, id ProductId, input ProductContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/product/method_delete.go b/resource-manager/apimanagement/2022-08-01/product/method_delete.go new file mode 100644 index 00000000000..a2aebab1182 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/product/method_delete.go @@ -0,0 +1,79 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + DeleteSubscriptions *bool + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.DeleteSubscriptions != nil { + out.Append("deleteSubscriptions", fmt.Sprintf("%v", *o.DeleteSubscriptions)) + } + return &out +} + +// Delete ... +func (c ProductClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/product/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/product/method_delete_autorest.go deleted file mode 100644 index 6646be8a32f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/product/method_delete_autorest.go +++ /dev/null @@ -1,100 +0,0 @@ -package product - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - DeleteSubscriptions *bool - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.DeleteSubscriptions != nil { - out["deleteSubscriptions"] = *o.DeleteSubscriptions - } - - return out -} - -// Delete ... -func (c ProductClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ProductClient) preparerForDelete(ctx context.Context, id ProductId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/product/method_get.go b/resource-manager/apimanagement/2022-08-01/product/method_get.go new file mode 100644 index 00000000000..41152aebc0a --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/product/method_get.go @@ -0,0 +1,51 @@ +package product + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProductContract +} + +// Get ... +func (c ProductClient) Get(ctx context.Context, id ProductId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/product/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/product/method_get_autorest.go deleted file mode 100644 index 42680f3af9f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/product/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package product - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ProductContract -} - -// Get ... -func (c ProductClient) Get(ctx context.Context, id ProductId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ProductClient) preparerForGet(ctx context.Context, id ProductId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/product/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/product/method_getentitytag.go new file mode 100644 index 00000000000..667f4afad59 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/product/method_getentitytag.go @@ -0,0 +1,46 @@ +package product + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ProductClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/product/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/product/method_getentitytag_autorest.go deleted file mode 100644 index b25eb533c2c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/product/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package product - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ProductClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ProductClient) preparerForGetEntityTag(ctx context.Context, id ProductId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/product/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/product/method_listbyservice.go new file mode 100644 index 00000000000..66a835096aa --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/product/method_listbyservice.go @@ -0,0 +1,133 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ProductContract +} + +type ListByServiceCompleteResult struct { + Items []ProductContract +} + +type ListByServiceOperationOptions struct { + ExpandGroups *bool + Filter *string + Skip *int64 + Tags *string + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandGroups != nil { + out.Append("expandGroups", fmt.Sprintf("%v", *o.ExpandGroups)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Tags != nil { + out.Append("tags", fmt.Sprintf("%v", *o.Tags)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c ProductClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/products", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ProductContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c ProductClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ProductContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ProductContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]ProductContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/product/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/product/method_listbyservice_autorest.go deleted file mode 100644 index 5187a25caa7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/product/method_listbyservice_autorest.go +++ /dev/null @@ -1,235 +0,0 @@ -package product - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]ProductContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []ProductContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - ExpandGroups *bool - Filter *string - Skip *int64 - Tags *string - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ExpandGroups != nil { - out["expandGroups"] = *o.ExpandGroups - } - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Tags != nil { - out["tags"] = *o.Tags - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c ProductClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c ProductClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/products", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c ProductClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []ProductContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c ProductClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, ProductContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate ProductContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]ProductContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/product/method_update.go b/resource-manager/apimanagement/2022-08-01/product/method_update.go new file mode 100644 index 00000000000..a9a59bd595e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/product/method_update.go @@ -0,0 +1,84 @@ +package product + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProductContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ProductClient) Update(ctx context.Context, id ProductId, input ProductUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/product/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/product/method_update_autorest.go deleted file mode 100644 index d0fbe1007f8..00000000000 --- a/resource-manager/apimanagement/2022-08-01/product/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package product - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *ProductContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ProductClient) Update(ctx context.Context, id ProductId, input ProductUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "product.ProductClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ProductClient) preparerForUpdate(ctx context.Context, id ProductId, input ProductUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ProductClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productapi/client.go b/resource-manager/apimanagement/2022-08-01/productapi/client.go index 5241293a527..a3437408d7d 100644 --- a/resource-manager/apimanagement/2022-08-01/productapi/client.go +++ b/resource-manager/apimanagement/2022-08-01/productapi/client.go @@ -1,18 +1,26 @@ package productapi -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductApiClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductApiClientWithBaseURI(endpoint string) ProductApiClient { - return ProductApiClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductApiClientWithBaseURI(api sdkEnv.Api) (*ProductApiClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "productapi", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductApiClient: %+v", err) } + + return &ProductApiClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/productapi/constants.go b/resource-manager/apimanagement/2022-08-01/productapi/constants.go index 0b289271d26..a2efe7f0641 100644 --- a/resource-manager/apimanagement/2022-08-01/productapi/constants.go +++ b/resource-manager/apimanagement/2022-08-01/productapi/constants.go @@ -1,6 +1,10 @@ package productapi -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -85,6 +115,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, @@ -117,6 +160,19 @@ func PossibleValuesForVersioningScheme() []string { } } +func (s *VersioningScheme) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVersioningScheme(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVersioningScheme(input string) (*VersioningScheme, error) { vals := map[string]VersioningScheme{ "header": VersioningSchemeHeader, diff --git a/resource-manager/apimanagement/2022-08-01/productapi/method_checkentityexists.go b/resource-manager/apimanagement/2022-08-01/productapi/method_checkentityexists.go new file mode 100644 index 00000000000..69d91adfcef --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productapi/method_checkentityexists.go @@ -0,0 +1,46 @@ +package productapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c ProductApiClient) CheckEntityExists(ctx context.Context, id ProductApiId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productapi/method_checkentityexists_autorest.go b/resource-manager/apimanagement/2022-08-01/productapi/method_checkentityexists_autorest.go deleted file mode 100644 index 37008921ef3..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productapi/method_checkentityexists_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package productapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckEntityExistsOperationResponse struct { - HttpResponse *http.Response -} - -// CheckEntityExists ... -func (c ProductApiClient) CheckEntityExists(ctx context.Context, id ProductApiId) (result CheckEntityExistsOperationResponse, err error) { - req, err := c.preparerForCheckEntityExists(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CheckEntityExists", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckEntityExists(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CheckEntityExists", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckEntityExists prepares the CheckEntityExists request. -func (c ProductApiClient) preparerForCheckEntityExists(ctx context.Context, id ProductApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckEntityExists handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (c ProductApiClient) responderForCheckEntityExists(resp *http.Response) (result CheckEntityExistsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productapi/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/productapi/method_createorupdate.go new file mode 100644 index 00000000000..cfa64d59695 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productapi/method_createorupdate.go @@ -0,0 +1,52 @@ +package productapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApiContract +} + +// CreateOrUpdate ... +func (c ProductApiClient) CreateOrUpdate(ctx context.Context, id ProductApiId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productapi/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/productapi/method_createorupdate_autorest.go deleted file mode 100644 index 1df50bc936d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productapi/method_createorupdate_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package productapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiContract -} - -// CreateOrUpdate ... -func (c ProductApiClient) CreateOrUpdate(ctx context.Context, id ProductApiId) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ProductApiClient) preparerForCreateOrUpdate(ctx context.Context, id ProductApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ProductApiClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productapi/method_delete.go b/resource-manager/apimanagement/2022-08-01/productapi/method_delete.go new file mode 100644 index 00000000000..da188ce2e72 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productapi/method_delete.go @@ -0,0 +1,47 @@ +package productapi + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ProductApiClient) Delete(ctx context.Context, id ProductApiId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productapi/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/productapi/method_delete_autorest.go deleted file mode 100644 index b31ea2b6eef..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productapi/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package productapi - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c ProductApiClient) Delete(ctx context.Context, id ProductApiId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ProductApiClient) preparerForDelete(ctx context.Context, id ProductApiId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ProductApiClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productapi/method_listbyproduct.go b/resource-manager/apimanagement/2022-08-01/productapi/method_listbyproduct.go new file mode 100644 index 00000000000..fbe56652d12 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productapi/method_listbyproduct.go @@ -0,0 +1,125 @@ +package productapi + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiContract +} + +type ListByProductCompleteResult struct { + Items []ApiContract +} + +type ListByProductOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByProductOperationOptions() ListByProductOperationOptions { + return ListByProductOperationOptions{} +} + +func (o ListByProductOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByProductOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByProductOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByProduct ... +func (c ProductApiClient) ListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (result ListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apis", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByProductComplete retrieves all the results into a single object +func (c ProductApiClient) ListByProductComplete(ctx context.Context, id ProductId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { + return c.ListByProductCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) +} + +// ListByProductCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductApiClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListByProductOperationOptions, predicate ApiContractOperationPredicate) (result ListByProductCompleteResult, err error) { + items := make([]ApiContract, 0) + + resp, err := c.ListByProduct(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByProductCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productapi/method_listbyproduct_autorest.go b/resource-manager/apimanagement/2022-08-01/productapi/method_listbyproduct_autorest.go deleted file mode 100644 index 5a0bdb0c971..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productapi/method_listbyproduct_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package productapi - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByProductOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByProductOperationResponse, error) -} - -type ListByProductCompleteResult struct { - Items []ApiContract -} - -func (r ListByProductOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByProductOperationResponse) LoadMore(ctx context.Context) (resp ListByProductOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByProductOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByProductOperationOptions() ListByProductOperationOptions { - return ListByProductOperationOptions{} -} - -func (o ListByProductOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByProductOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByProduct ... -func (c ProductApiClient) ListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (resp ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProduct(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByProduct(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByProduct prepares the ListByProduct request. -func (c ProductApiClient) preparerForListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/apis", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByProductWithNextLink prepares the ListByProduct request with the given nextLink token. -func (c ProductApiClient) preparerForListByProductWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByProduct handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (c ProductApiClient) responderForListByProduct(resp *http.Response) (result ListByProductOperationResponse, err error) { - type page struct { - Values []ApiContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProductWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productapi.ProductApiClient", "ListByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByProductComplete retrieves all of the results into a single object -func (c ProductApiClient) ListByProductComplete(ctx context.Context, id ProductId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { - return c.ListByProductCompleteMatchingPredicate(ctx, id, options, ApiContractOperationPredicate{}) -} - -// ListByProductCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductApiClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListByProductOperationOptions, predicate ApiContractOperationPredicate) (resp ListByProductCompleteResult, err error) { - items := make([]ApiContract, 0) - - page, err := c.ListByProduct(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByProductCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/client.go b/resource-manager/apimanagement/2022-08-01/productgroup/client.go index 08ea091f6e7..d5a21f3aa0e 100644 --- a/resource-manager/apimanagement/2022-08-01/productgroup/client.go +++ b/resource-manager/apimanagement/2022-08-01/productgroup/client.go @@ -1,18 +1,26 @@ package productgroup -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductGroupClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductGroupClientWithBaseURI(endpoint string) ProductGroupClient { - return ProductGroupClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductGroupClientWithBaseURI(api sdkEnv.Api) (*ProductGroupClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "productgroup", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductGroupClient: %+v", err) } + + return &ProductGroupClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/constants.go b/resource-manager/apimanagement/2022-08-01/productgroup/constants.go index 07ce1de89e9..6ff85f660bd 100644 --- a/resource-manager/apimanagement/2022-08-01/productgroup/constants.go +++ b/resource-manager/apimanagement/2022-08-01/productgroup/constants.go @@ -1,6 +1,10 @@ package productgroup -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForGroupType() []string { } } +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGroupType(input string) (*GroupType, error) { vals := map[string]GroupType{ "custom": GroupTypeCustom, diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/method_checkentityexists.go b/resource-manager/apimanagement/2022-08-01/productgroup/method_checkentityexists.go new file mode 100644 index 00000000000..fd90f4c41cf --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productgroup/method_checkentityexists.go @@ -0,0 +1,46 @@ +package productgroup + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckEntityExistsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CheckEntityExists ... +func (c ProductGroupClient) CheckEntityExists(ctx context.Context, id ProductGroupId) (result CheckEntityExistsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/method_checkentityexists_autorest.go b/resource-manager/apimanagement/2022-08-01/productgroup/method_checkentityexists_autorest.go deleted file mode 100644 index 034a222674f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productgroup/method_checkentityexists_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package productgroup - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckEntityExistsOperationResponse struct { - HttpResponse *http.Response -} - -// CheckEntityExists ... -func (c ProductGroupClient) CheckEntityExists(ctx context.Context, id ProductGroupId) (result CheckEntityExistsOperationResponse, err error) { - req, err := c.preparerForCheckEntityExists(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CheckEntityExists", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckEntityExists(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CheckEntityExists", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckEntityExists prepares the CheckEntityExists request. -func (c ProductGroupClient) preparerForCheckEntityExists(ctx context.Context, id ProductGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckEntityExists handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (c ProductGroupClient) responderForCheckEntityExists(resp *http.Response) (result CheckEntityExistsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/productgroup/method_createorupdate.go new file mode 100644 index 00000000000..20656a3ff19 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productgroup/method_createorupdate.go @@ -0,0 +1,52 @@ +package productgroup + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GroupContract +} + +// CreateOrUpdate ... +func (c ProductGroupClient) CreateOrUpdate(ctx context.Context, id ProductGroupId) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/productgroup/method_createorupdate_autorest.go deleted file mode 100644 index 578f327aa82..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productgroup/method_createorupdate_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package productgroup - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *GroupContract -} - -// CreateOrUpdate ... -func (c ProductGroupClient) CreateOrUpdate(ctx context.Context, id ProductGroupId) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ProductGroupClient) preparerForCreateOrUpdate(ctx context.Context, id ProductGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ProductGroupClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/method_delete.go b/resource-manager/apimanagement/2022-08-01/productgroup/method_delete.go new file mode 100644 index 00000000000..3f6b1c8820e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productgroup/method_delete.go @@ -0,0 +1,47 @@ +package productgroup + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ProductGroupClient) Delete(ctx context.Context, id ProductGroupId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/productgroup/method_delete_autorest.go deleted file mode 100644 index 0bc4bd9be4c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productgroup/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package productgroup - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c ProductGroupClient) Delete(ctx context.Context, id ProductGroupId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ProductGroupClient) preparerForDelete(ctx context.Context, id ProductGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ProductGroupClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/method_listbyproduct.go b/resource-manager/apimanagement/2022-08-01/productgroup/method_listbyproduct.go new file mode 100644 index 00000000000..483d84c6da7 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productgroup/method_listbyproduct.go @@ -0,0 +1,125 @@ +package productgroup + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GroupContract +} + +type ListByProductCompleteResult struct { + Items []GroupContract +} + +type ListByProductOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByProductOperationOptions() ListByProductOperationOptions { + return ListByProductOperationOptions{} +} + +func (o ListByProductOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByProductOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByProductOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByProduct ... +func (c ProductGroupClient) ListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (result ListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/groups", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GroupContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByProductComplete retrieves all the results into a single object +func (c ProductGroupClient) ListByProductComplete(ctx context.Context, id ProductId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { + return c.ListByProductCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) +} + +// ListByProductCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductGroupClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListByProductOperationOptions, predicate GroupContractOperationPredicate) (result ListByProductCompleteResult, err error) { + items := make([]GroupContract, 0) + + resp, err := c.ListByProduct(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByProductCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/method_listbyproduct_autorest.go b/resource-manager/apimanagement/2022-08-01/productgroup/method_listbyproduct_autorest.go deleted file mode 100644 index f5f186c5b31..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productgroup/method_listbyproduct_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package productgroup - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByProductOperationResponse struct { - HttpResponse *http.Response - Model *[]GroupContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByProductOperationResponse, error) -} - -type ListByProductCompleteResult struct { - Items []GroupContract -} - -func (r ListByProductOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByProductOperationResponse) LoadMore(ctx context.Context) (resp ListByProductOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByProductOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByProductOperationOptions() ListByProductOperationOptions { - return ListByProductOperationOptions{} -} - -func (o ListByProductOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByProductOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByProduct ... -func (c ProductGroupClient) ListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (resp ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProduct(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByProduct(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByProduct prepares the ListByProduct request. -func (c ProductGroupClient) preparerForListByProduct(ctx context.Context, id ProductId, options ListByProductOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/groups", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByProductWithNextLink prepares the ListByProduct request with the given nextLink token. -func (c ProductGroupClient) preparerForListByProductWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByProduct handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (c ProductGroupClient) responderForListByProduct(resp *http.Response) (result ListByProductOperationResponse, err error) { - type page struct { - Values []GroupContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProductWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productgroup.ProductGroupClient", "ListByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByProductComplete retrieves all of the results into a single object -func (c ProductGroupClient) ListByProductComplete(ctx context.Context, id ProductId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { - return c.ListByProductCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) -} - -// ListByProductCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductGroupClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListByProductOperationOptions, predicate GroupContractOperationPredicate) (resp ListByProductCompleteResult, err error) { - items := make([]GroupContract, 0) - - page, err := c.ListByProduct(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByProductCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/client.go b/resource-manager/apimanagement/2022-08-01/productpolicy/client.go index dfce4d67a5d..329f197dd22 100644 --- a/resource-manager/apimanagement/2022-08-01/productpolicy/client.go +++ b/resource-manager/apimanagement/2022-08-01/productpolicy/client.go @@ -1,18 +1,26 @@ package productpolicy -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductPolicyClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductPolicyClientWithBaseURI(endpoint string) ProductPolicyClient { - return ProductPolicyClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductPolicyClientWithBaseURI(api sdkEnv.Api) (*ProductPolicyClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "productpolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductPolicyClient: %+v", err) } + + return &ProductPolicyClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/constants.go b/resource-manager/apimanagement/2022-08-01/productpolicy/constants.go index 9408a1eb3a8..196b57d596f 100644 --- a/resource-manager/apimanagement/2022-08-01/productpolicy/constants.go +++ b/resource-manager/apimanagement/2022-08-01/productpolicy/constants.go @@ -1,6 +1,10 @@ package productpolicy -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForPolicyContentFormat() []string { } } +func (s *PolicyContentFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyContentFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyContentFormat(input string) (*PolicyContentFormat, error) { vals := map[string]PolicyContentFormat{ "rawxml": PolicyContentFormatRawxml, @@ -53,6 +70,19 @@ func PossibleValuesForPolicyExportFormat() []string { } } +func (s *PolicyExportFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePolicyExportFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePolicyExportFormat(input string) (*PolicyExportFormat, error) { vals := map[string]PolicyExportFormat{ "rawxml": PolicyExportFormatRawxml, diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/productpolicy/method_createorupdate.go new file mode 100644 index 00000000000..0471e0e461f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productpolicy/method_createorupdate.go @@ -0,0 +1,85 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ProductPolicyClient) CreateOrUpdate(ctx context.Context, id ProductId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/productpolicy/method_createorupdate_autorest.go deleted file mode 100644 index 43f5c165d57..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productpolicy/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package productpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ProductPolicyClient) CreateOrUpdate(ctx context.Context, id ProductId, input PolicyContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ProductPolicyClient) preparerForCreateOrUpdate(ctx context.Context, id ProductId, input PolicyContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ProductPolicyClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/method_delete.go b/resource-manager/apimanagement/2022-08-01/productpolicy/method_delete.go new file mode 100644 index 00000000000..09bc23bd22e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productpolicy/method_delete.go @@ -0,0 +1,76 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ProductPolicyClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/productpolicy/method_delete_autorest.go deleted file mode 100644 index d18f700767f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productpolicy/method_delete_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package productpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ProductPolicyClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ProductPolicyClient) preparerForDelete(ctx context.Context, id ProductId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ProductPolicyClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/method_get.go b/resource-manager/apimanagement/2022-08-01/productpolicy/method_get.go new file mode 100644 index 00000000000..46284c64c32 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productpolicy/method_get.go @@ -0,0 +1,80 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyContract +} + +type GetOperationOptions struct { + Format *PolicyExportFormat +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Format != nil { + out.Append("format", fmt.Sprintf("%v", *o.Format)) + } + return &out +} + +// Get ... +func (c ProductPolicyClient) Get(ctx context.Context, id ProductId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/productpolicy/method_get_autorest.go deleted file mode 100644 index b2933e55f93..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productpolicy/method_get_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package productpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PolicyContract -} - -type GetOperationOptions struct { - Format *PolicyExportFormat -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Format != nil { - out["format"] = *o.Format - } - - return out -} - -// Get ... -func (c ProductPolicyClient) Get(ctx context.Context, id ProductId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ProductPolicyClient) preparerForGet(ctx context.Context, id ProductId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ProductPolicyClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/productpolicy/method_getentitytag.go new file mode 100644 index 00000000000..3e3787982d6 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productpolicy/method_getentitytag.go @@ -0,0 +1,47 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ProductPolicyClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/policies/policy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/productpolicy/method_getentitytag_autorest.go deleted file mode 100644 index f446b88fb66..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productpolicy/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package productpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ProductPolicyClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ProductPolicyClient) preparerForGetEntityTag(ctx context.Context, id ProductId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies/policy", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ProductPolicyClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/method_listbyproduct.go b/resource-manager/apimanagement/2022-08-01/productpolicy/method_listbyproduct.go new file mode 100644 index 00000000000..d9cbc9812e4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productpolicy/method_listbyproduct.go @@ -0,0 +1,52 @@ +package productpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PolicyCollection +} + +// ListByProduct ... +func (c ProductPolicyClient) ListByProduct(ctx context.Context, id ProductId) (result ListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/policies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/method_listbyproduct_autorest.go b/resource-manager/apimanagement/2022-08-01/productpolicy/method_listbyproduct_autorest.go deleted file mode 100644 index 40fab3bcf62..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productpolicy/method_listbyproduct_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package productpolicy - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByProductOperationResponse struct { - HttpResponse *http.Response - Model *PolicyCollection -} - -// ListByProduct ... -func (c ProductPolicyClient) ListByProduct(ctx context.Context, id ProductId) (result ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProduct(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "ListByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "ListByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productpolicy.ProductPolicyClient", "ListByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByProduct prepares the ListByProduct request. -func (c ProductPolicyClient) preparerForListByProduct(ctx context.Context, id ProductId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/policies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByProduct handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (c ProductPolicyClient) responderForListByProduct(resp *http.Response) (result ListByProductOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productsbytag/client.go b/resource-manager/apimanagement/2022-08-01/productsbytag/client.go index 819f4c151ff..fd8812ebfff 100644 --- a/resource-manager/apimanagement/2022-08-01/productsbytag/client.go +++ b/resource-manager/apimanagement/2022-08-01/productsbytag/client.go @@ -1,18 +1,26 @@ package productsbytag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductsByTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductsByTagClientWithBaseURI(endpoint string) ProductsByTagClient { - return ProductsByTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductsByTagClientWithBaseURI(api sdkEnv.Api) (*ProductsByTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "productsbytag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductsByTagClient: %+v", err) } + + return &ProductsByTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/productsbytag/constants.go b/resource-manager/apimanagement/2022-08-01/productsbytag/constants.go index a3a2af687c4..6380c578cd4 100644 --- a/resource-manager/apimanagement/2022-08-01/productsbytag/constants.go +++ b/resource-manager/apimanagement/2022-08-01/productsbytag/constants.go @@ -1,6 +1,10 @@ package productsbytag -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -81,6 +111,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, @@ -113,6 +156,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, diff --git a/resource-manager/apimanagement/2022-08-01/productsbytag/method_productlistbytags.go b/resource-manager/apimanagement/2022-08-01/productsbytag/method_productlistbytags.go new file mode 100644 index 00000000000..bd145c12a02 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productsbytag/method_productlistbytags.go @@ -0,0 +1,129 @@ +package productsbytag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProductListByTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagResourceContract +} + +type ProductListByTagsCompleteResult struct { + Items []TagResourceContract +} + +type ProductListByTagsOperationOptions struct { + Filter *string + IncludeNotTaggedProducts *bool + Skip *int64 + Top *int64 +} + +func DefaultProductListByTagsOperationOptions() ProductListByTagsOperationOptions { + return ProductListByTagsOperationOptions{} +} + +func (o ProductListByTagsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ProductListByTagsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ProductListByTagsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.IncludeNotTaggedProducts != nil { + out.Append("includeNotTaggedProducts", fmt.Sprintf("%v", *o.IncludeNotTaggedProducts)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ProductListByTags ... +func (c ProductsByTagClient) ProductListByTags(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions) (result ProductListByTagsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/productsByTags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagResourceContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ProductListByTagsComplete retrieves all the results into a single object +func (c ProductsByTagClient) ProductListByTagsComplete(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions) (ProductListByTagsCompleteResult, error) { + return c.ProductListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) +} + +// ProductListByTagsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductsByTagClient) ProductListByTagsCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (result ProductListByTagsCompleteResult, err error) { + items := make([]TagResourceContract, 0) + + resp, err := c.ProductListByTags(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ProductListByTagsCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productsbytag/method_productlistbytags_autorest.go b/resource-manager/apimanagement/2022-08-01/productsbytag/method_productlistbytags_autorest.go deleted file mode 100644 index 2cff77a5a10..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productsbytag/method_productlistbytags_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package productsbytag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ProductListByTagsOperationResponse struct { - HttpResponse *http.Response - Model *[]TagResourceContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ProductListByTagsOperationResponse, error) -} - -type ProductListByTagsCompleteResult struct { - Items []TagResourceContract -} - -func (r ProductListByTagsOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ProductListByTagsOperationResponse) LoadMore(ctx context.Context) (resp ProductListByTagsOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ProductListByTagsOperationOptions struct { - Filter *string - IncludeNotTaggedProducts *bool - Skip *int64 - Top *int64 -} - -func DefaultProductListByTagsOperationOptions() ProductListByTagsOperationOptions { - return ProductListByTagsOperationOptions{} -} - -func (o ProductListByTagsOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ProductListByTagsOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.IncludeNotTaggedProducts != nil { - out["includeNotTaggedProducts"] = *o.IncludeNotTaggedProducts - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ProductListByTags ... -func (c ProductsByTagClient) ProductListByTags(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions) (resp ProductListByTagsOperationResponse, err error) { - req, err := c.preparerForProductListByTags(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForProductListByTags(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForProductListByTags prepares the ProductListByTags request. -func (c ProductsByTagClient) preparerForProductListByTags(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/productsByTags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForProductListByTagsWithNextLink prepares the ProductListByTags request with the given nextLink token. -func (c ProductsByTagClient) preparerForProductListByTagsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForProductListByTags handles the response to the ProductListByTags request. The method always -// closes the http.Response Body. -func (c ProductsByTagClient) responderForProductListByTags(resp *http.Response) (result ProductListByTagsOperationResponse, err error) { - type page struct { - Values []TagResourceContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ProductListByTagsOperationResponse, err error) { - req, err := c.preparerForProductListByTagsWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForProductListByTags(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productsbytag.ProductsByTagClient", "ProductListByTags", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ProductListByTagsComplete retrieves all of the results into a single object -func (c ProductsByTagClient) ProductListByTagsComplete(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions) (ProductListByTagsCompleteResult, error) { - return c.ProductListByTagsCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) -} - -// ProductListByTagsCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductsByTagClient) ProductListByTagsCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ProductListByTagsOperationOptions, predicate TagResourceContractOperationPredicate) (resp ProductListByTagsCompleteResult, err error) { - items := make([]TagResourceContract, 0) - - page, err := c.ProductListByTags(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ProductListByTagsCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/productsubscription/client.go b/resource-manager/apimanagement/2022-08-01/productsubscription/client.go index e6fc998ab6f..12d5d6aa707 100644 --- a/resource-manager/apimanagement/2022-08-01/productsubscription/client.go +++ b/resource-manager/apimanagement/2022-08-01/productsubscription/client.go @@ -1,18 +1,26 @@ package productsubscription -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductSubscriptionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductSubscriptionClientWithBaseURI(endpoint string) ProductSubscriptionClient { - return ProductSubscriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductSubscriptionClientWithBaseURI(api sdkEnv.Api) (*ProductSubscriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "productsubscription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductSubscriptionClient: %+v", err) } + + return &ProductSubscriptionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/productsubscription/constants.go b/resource-manager/apimanagement/2022-08-01/productsubscription/constants.go index 3d9bc9cb116..b701ce04fea 100644 --- a/resource-manager/apimanagement/2022-08-01/productsubscription/constants.go +++ b/resource-manager/apimanagement/2022-08-01/productsubscription/constants.go @@ -1,6 +1,10 @@ package productsubscription -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -27,6 +31,19 @@ func PossibleValuesForSubscriptionState() []string { } } +func (s *SubscriptionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSubscriptionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSubscriptionState(input string) (*SubscriptionState, error) { vals := map[string]SubscriptionState{ "active": SubscriptionStateActive, diff --git a/resource-manager/apimanagement/2022-08-01/productsubscription/method_list.go b/resource-manager/apimanagement/2022-08-01/productsubscription/method_list.go new file mode 100644 index 00000000000..6e4d8a7a32c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productsubscription/method_list.go @@ -0,0 +1,125 @@ +package productsubscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SubscriptionContract +} + +type ListCompleteResult struct { + Items []SubscriptionContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c ProductSubscriptionClient) List(ctx context.Context, id ProductId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/subscriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SubscriptionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ProductSubscriptionClient) ListComplete(ctx context.Context, id ProductId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductSubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]SubscriptionContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productsubscription/method_list_autorest.go b/resource-manager/apimanagement/2022-08-01/productsubscription/method_list_autorest.go deleted file mode 100644 index c90464fedfa..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productsubscription/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package productsubscription - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]SubscriptionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []SubscriptionContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c ProductSubscriptionClient) List(ctx context.Context, id ProductId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ProductSubscriptionClient) preparerForList(ctx context.Context, id ProductId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/subscriptions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ProductSubscriptionClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ProductSubscriptionClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []SubscriptionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productsubscription.ProductSubscriptionClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ProductSubscriptionClient) ListComplete(ctx context.Context, id ProductId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductSubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]SubscriptionContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/producttag/client.go b/resource-manager/apimanagement/2022-08-01/producttag/client.go index 852ad05f1e6..543b28deb80 100644 --- a/resource-manager/apimanagement/2022-08-01/producttag/client.go +++ b/resource-manager/apimanagement/2022-08-01/producttag/client.go @@ -1,18 +1,26 @@ package producttag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductTagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductTagClientWithBaseURI(endpoint string) ProductTagClient { - return ProductTagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductTagClientWithBaseURI(api sdkEnv.Api) (*ProductTagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "producttag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductTagClient: %+v", err) } + + return &ProductTagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/producttag/method_tagassigntoproduct.go b/resource-manager/apimanagement/2022-08-01/producttag/method_tagassigntoproduct.go new file mode 100644 index 00000000000..55885dbd935 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/producttag/method_tagassigntoproduct.go @@ -0,0 +1,52 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagAssignToProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagAssignToProduct ... +func (c ProductTagClient) TagAssignToProduct(ctx context.Context, id ProductTagId) (result TagAssignToProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/producttag/method_tagassigntoproduct_autorest.go b/resource-manager/apimanagement/2022-08-01/producttag/method_tagassigntoproduct_autorest.go deleted file mode 100644 index 6a0b20cfc9a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/producttag/method_tagassigntoproduct_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package producttag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagAssignToProductOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagAssignToProduct ... -func (c ProductTagClient) TagAssignToProduct(ctx context.Context, id ProductTagId) (result TagAssignToProductOperationResponse, err error) { - req, err := c.preparerForTagAssignToProduct(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagAssignToProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagAssignToProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagAssignToProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagAssignToProduct", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagAssignToProduct prepares the TagAssignToProduct request. -func (c ProductTagClient) preparerForTagAssignToProduct(ctx context.Context, id ProductTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagAssignToProduct handles the response to the TagAssignToProduct request. The method always -// closes the http.Response Body. -func (c ProductTagClient) responderForTagAssignToProduct(resp *http.Response) (result TagAssignToProductOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/producttag/method_tagdetachfromproduct.go b/resource-manager/apimanagement/2022-08-01/producttag/method_tagdetachfromproduct.go new file mode 100644 index 00000000000..9564ceb67e1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/producttag/method_tagdetachfromproduct.go @@ -0,0 +1,47 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagDetachFromProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagDetachFromProduct ... +func (c ProductTagClient) TagDetachFromProduct(ctx context.Context, id ProductTagId) (result TagDetachFromProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/producttag/method_tagdetachfromproduct_autorest.go b/resource-manager/apimanagement/2022-08-01/producttag/method_tagdetachfromproduct_autorest.go deleted file mode 100644 index de37a803293..00000000000 --- a/resource-manager/apimanagement/2022-08-01/producttag/method_tagdetachfromproduct_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package producttag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagDetachFromProductOperationResponse struct { - HttpResponse *http.Response -} - -// TagDetachFromProduct ... -func (c ProductTagClient) TagDetachFromProduct(ctx context.Context, id ProductTagId) (result TagDetachFromProductOperationResponse, err error) { - req, err := c.preparerForTagDetachFromProduct(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagDetachFromProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagDetachFromProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagDetachFromProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagDetachFromProduct", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagDetachFromProduct prepares the TagDetachFromProduct request. -func (c ProductTagClient) preparerForTagDetachFromProduct(ctx context.Context, id ProductTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagDetachFromProduct handles the response to the TagDetachFromProduct request. The method always -// closes the http.Response Body. -func (c ProductTagClient) responderForTagDetachFromProduct(resp *http.Response) (result TagDetachFromProductOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/producttag/method_taggetbyproduct.go b/resource-manager/apimanagement/2022-08-01/producttag/method_taggetbyproduct.go new file mode 100644 index 00000000000..413a4b52b72 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/producttag/method_taggetbyproduct.go @@ -0,0 +1,51 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// TagGetByProduct ... +func (c ProductTagClient) TagGetByProduct(ctx context.Context, id ProductTagId) (result TagGetByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/producttag/method_taggetbyproduct_autorest.go b/resource-manager/apimanagement/2022-08-01/producttag/method_taggetbyproduct_autorest.go deleted file mode 100644 index beb3693330c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/producttag/method_taggetbyproduct_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package producttag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetByProductOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// TagGetByProduct ... -func (c ProductTagClient) TagGetByProduct(ctx context.Context, id ProductTagId) (result TagGetByProductOperationResponse, err error) { - req, err := c.preparerForTagGetByProduct(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetByProduct prepares the TagGetByProduct request. -func (c ProductTagClient) preparerForTagGetByProduct(ctx context.Context, id ProductTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetByProduct handles the response to the TagGetByProduct request. The method always -// closes the http.Response Body. -func (c ProductTagClient) responderForTagGetByProduct(resp *http.Response) (result TagGetByProductOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/producttag/method_taggetentitystatebyproduct.go b/resource-manager/apimanagement/2022-08-01/producttag/method_taggetentitystatebyproduct.go new file mode 100644 index 00000000000..8f023009406 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/producttag/method_taggetentitystatebyproduct.go @@ -0,0 +1,46 @@ +package producttag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagGetEntityStateByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// TagGetEntityStateByProduct ... +func (c ProductTagClient) TagGetEntityStateByProduct(ctx context.Context, id ProductTagId) (result TagGetEntityStateByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/producttag/method_taggetentitystatebyproduct_autorest.go b/resource-manager/apimanagement/2022-08-01/producttag/method_taggetentitystatebyproduct_autorest.go deleted file mode 100644 index ba4e65f8cd1..00000000000 --- a/resource-manager/apimanagement/2022-08-01/producttag/method_taggetentitystatebyproduct_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package producttag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagGetEntityStateByProductOperationResponse struct { - HttpResponse *http.Response -} - -// TagGetEntityStateByProduct ... -func (c ProductTagClient) TagGetEntityStateByProduct(ctx context.Context, id ProductTagId) (result TagGetEntityStateByProductOperationResponse, err error) { - req, err := c.preparerForTagGetEntityStateByProduct(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetEntityStateByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetEntityStateByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagGetEntityStateByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagGetEntityStateByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTagGetEntityStateByProduct prepares the TagGetEntityStateByProduct request. -func (c ProductTagClient) preparerForTagGetEntityStateByProduct(ctx context.Context, id ProductTagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagGetEntityStateByProduct handles the response to the TagGetEntityStateByProduct request. The method always -// closes the http.Response Body. -func (c ProductTagClient) responderForTagGetEntityStateByProduct(resp *http.Response) (result TagGetEntityStateByProductOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/producttag/method_taglistbyproduct.go b/resource-manager/apimanagement/2022-08-01/producttag/method_taglistbyproduct.go new file mode 100644 index 00000000000..0b73c472a25 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/producttag/method_taglistbyproduct.go @@ -0,0 +1,125 @@ +package producttag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type TagListByProductCompleteResult struct { + Items []TagContract +} + +type TagListByProductOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultTagListByProductOperationOptions() TagListByProductOperationOptions { + return TagListByProductOperationOptions{} +} + +func (o TagListByProductOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o TagListByProductOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o TagListByProductOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// TagListByProduct ... +func (c ProductTagClient) TagListByProduct(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (result TagListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// TagListByProductComplete retrieves all the results into a single object +func (c ProductTagClient) TagListByProductComplete(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (TagListByProductCompleteResult, error) { + return c.TagListByProductCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// TagListByProductCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductTagClient) TagListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options TagListByProductOperationOptions, predicate TagContractOperationPredicate) (result TagListByProductCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.TagListByProduct(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = TagListByProductCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/producttag/method_taglistbyproduct_autorest.go b/resource-manager/apimanagement/2022-08-01/producttag/method_taglistbyproduct_autorest.go deleted file mode 100644 index f0717ee0f77..00000000000 --- a/resource-manager/apimanagement/2022-08-01/producttag/method_taglistbyproduct_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package producttag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TagListByProductOperationResponse struct { - HttpResponse *http.Response - Model *[]TagContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (TagListByProductOperationResponse, error) -} - -type TagListByProductCompleteResult struct { - Items []TagContract -} - -func (r TagListByProductOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r TagListByProductOperationResponse) LoadMore(ctx context.Context) (resp TagListByProductOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type TagListByProductOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultTagListByProductOperationOptions() TagListByProductOperationOptions { - return TagListByProductOperationOptions{} -} - -func (o TagListByProductOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o TagListByProductOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// TagListByProduct ... -func (c ProductTagClient) TagListByProduct(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (resp TagListByProductOperationResponse, err error) { - req, err := c.preparerForTagListByProduct(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForTagListByProduct(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForTagListByProduct prepares the TagListByProduct request. -func (c ProductTagClient) preparerForTagListByProduct(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForTagListByProductWithNextLink prepares the TagListByProduct request with the given nextLink token. -func (c ProductTagClient) preparerForTagListByProductWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTagListByProduct handles the response to the TagListByProduct request. The method always -// closes the http.Response Body. -func (c ProductTagClient) responderForTagListByProduct(resp *http.Response) (result TagListByProductOperationResponse, err error) { - type page struct { - Values []TagContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result TagListByProductOperationResponse, err error) { - req, err := c.preparerForTagListByProductWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTagListByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "producttag.ProductTagClient", "TagListByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// TagListByProductComplete retrieves all of the results into a single object -func (c ProductTagClient) TagListByProductComplete(ctx context.Context, id ProductId, options TagListByProductOperationOptions) (TagListByProductCompleteResult, error) { - return c.TagListByProductCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) -} - -// TagListByProductCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductTagClient) TagListByProductCompleteMatchingPredicate(ctx context.Context, id ProductId, options TagListByProductOperationOptions, predicate TagContractOperationPredicate) (resp TagListByProductCompleteResult, err error) { - items := make([]TagContract, 0) - - page, err := c.TagListByProduct(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := TagListByProductCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/client.go b/resource-manager/apimanagement/2022-08-01/productwiki/client.go index 675bec67e09..736998c740d 100644 --- a/resource-manager/apimanagement/2022-08-01/productwiki/client.go +++ b/resource-manager/apimanagement/2022-08-01/productwiki/client.go @@ -1,18 +1,26 @@ package productwiki -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProductWikiClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewProductWikiClientWithBaseURI(endpoint string) ProductWikiClient { - return ProductWikiClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewProductWikiClientWithBaseURI(api sdkEnv.Api) (*ProductWikiClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "productwiki", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProductWikiClient: %+v", err) } + + return &ProductWikiClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_createorupdate.go new file mode 100644 index 00000000000..18ccc4803c6 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productwiki/method_createorupdate.go @@ -0,0 +1,85 @@ +package productwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *WikiContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ProductWikiClient) CreateOrUpdate(ctx context.Context, id ProductId, input WikiContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/wikis/default", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_createorupdate_autorest.go deleted file mode 100644 index 1ae89a8a3ec..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productwiki/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package productwiki - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *WikiContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ProductWikiClient) CreateOrUpdate(ctx context.Context, id ProductId, input WikiContract, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ProductWikiClient) preparerForCreateOrUpdate(ctx context.Context, id ProductId, input WikiContract, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/wikis/default", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ProductWikiClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_delete.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_delete.go new file mode 100644 index 00000000000..f2b6e116ed7 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productwiki/method_delete.go @@ -0,0 +1,76 @@ +package productwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c ProductWikiClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/wikis/default", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_delete_autorest.go deleted file mode 100644 index 7a6351db182..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productwiki/method_delete_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package productwiki - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ProductWikiClient) Delete(ctx context.Context, id ProductId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ProductWikiClient) preparerForDelete(ctx context.Context, id ProductId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/wikis/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ProductWikiClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_get.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_get.go new file mode 100644 index 00000000000..3caa860baa9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productwiki/method_get.go @@ -0,0 +1,52 @@ +package productwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *WikiContract +} + +// Get ... +func (c ProductWikiClient) Get(ctx context.Context, id ProductId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/wikis/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_get_autorest.go deleted file mode 100644 index 2845aa8b36a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productwiki/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package productwiki - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *WikiContract -} - -// Get ... -func (c ProductWikiClient) Get(ctx context.Context, id ProductId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ProductWikiClient) preparerForGet(ctx context.Context, id ProductId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/wikis/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ProductWikiClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_getentitytag.go new file mode 100644 index 00000000000..ddec183a011 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productwiki/method_getentitytag.go @@ -0,0 +1,47 @@ +package productwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c ProductWikiClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/wikis/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_getentitytag_autorest.go deleted file mode 100644 index b09360c8742..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productwiki/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package productwiki - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c ProductWikiClient) GetEntityTag(ctx context.Context, id ProductId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c ProductWikiClient) preparerForGetEntityTag(ctx context.Context, id ProductId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/wikis/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c ProductWikiClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_list.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_list.go new file mode 100644 index 00000000000..d5eef04fbff --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productwiki/method_list.go @@ -0,0 +1,125 @@ +package productwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]WikiContract +} + +type ListCompleteResult struct { + Items []WikiContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c ProductWikiClient) List(ctx context.Context, id ProductId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/wikis", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]WikiContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ProductWikiClient) ListComplete(ctx context.Context, id ProductId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, WikiContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProductWikiClient) ListCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListOperationOptions, predicate WikiContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]WikiContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_list_autorest.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_list_autorest.go deleted file mode 100644 index 3bbef9a5aa7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productwiki/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package productwiki - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]WikiContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []WikiContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c ProductWikiClient) List(ctx context.Context, id ProductId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ProductWikiClient) preparerForList(ctx context.Context, id ProductId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/wikis", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ProductWikiClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ProductWikiClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []WikiContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ProductWikiClient) ListComplete(ctx context.Context, id ProductId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, WikiContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProductWikiClient) ListCompleteMatchingPredicate(ctx context.Context, id ProductId, options ListOperationOptions, predicate WikiContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]WikiContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_update.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_update.go new file mode 100644 index 00000000000..742d965ee39 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/productwiki/method_update.go @@ -0,0 +1,84 @@ +package productwiki + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *WikiContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ProductWikiClient) Update(ctx context.Context, id ProductId, input WikiUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/wikis/default", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/productwiki/method_update_autorest.go deleted file mode 100644 index 67def99260e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/productwiki/method_update_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package productwiki - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *WikiContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ProductWikiClient) Update(ctx context.Context, id ProductId, input WikiUpdateContract, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "productwiki.ProductWikiClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ProductWikiClient) preparerForUpdate(ctx context.Context, id ProductId, input WikiUpdateContract, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/wikis/default", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ProductWikiClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/client.go b/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/client.go index 2671480732c..1e508477264 100644 --- a/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/client.go +++ b/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/client.go @@ -1,18 +1,26 @@ package quotabycounterkeys -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type QuotaByCounterKeysClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewQuotaByCounterKeysClientWithBaseURI(endpoint string) QuotaByCounterKeysClient { - return QuotaByCounterKeysClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewQuotaByCounterKeysClientWithBaseURI(api sdkEnv.Api) (*QuotaByCounterKeysClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "quotabycounterkeys", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating QuotaByCounterKeysClient: %+v", err) } + + return &QuotaByCounterKeysClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_listbyservice.go new file mode 100644 index 00000000000..dea7040ba8b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_listbyservice.go @@ -0,0 +1,51 @@ +package quotabycounterkeys + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *QuotaCounterCollection +} + +// ListByService ... +func (c QuotaByCounterKeysClient) ListByService(ctx context.Context, id QuotaId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_listbyservice_autorest.go deleted file mode 100644 index bc4c2e7a4c2..00000000000 --- a/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_listbyservice_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package quotabycounterkeys - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *QuotaCounterCollection -} - -// ListByService ... -func (c QuotaByCounterKeysClient) ListByService(ctx context.Context, id QuotaId) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByService prepares the ListByService request. -func (c QuotaByCounterKeysClient) preparerForListByService(ctx context.Context, id QuotaId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c QuotaByCounterKeysClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_update.go b/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_update.go new file mode 100644 index 00000000000..f9bc3fcc0d4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_update.go @@ -0,0 +1,55 @@ +package quotabycounterkeys + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *QuotaCounterCollection +} + +// Update ... +func (c QuotaByCounterKeysClient) Update(ctx context.Context, id QuotaId, input QuotaCounterValueUpdateContract) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_update_autorest.go deleted file mode 100644 index 4acf4507ad4..00000000000 --- a/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/method_update_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package quotabycounterkeys - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *QuotaCounterCollection -} - -// Update ... -func (c QuotaByCounterKeysClient) Update(ctx context.Context, id QuotaId, input QuotaCounterValueUpdateContract) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabycounterkeys.QuotaByCounterKeysClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c QuotaByCounterKeysClient) preparerForUpdate(ctx context.Context, id QuotaId, input QuotaCounterValueUpdateContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c QuotaByCounterKeysClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/client.go b/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/client.go index 09577f5147f..d102ff247cf 100644 --- a/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/client.go +++ b/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/client.go @@ -1,18 +1,26 @@ package quotabyperiodkeys -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type QuotaByPeriodKeysClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewQuotaByPeriodKeysClientWithBaseURI(endpoint string) QuotaByPeriodKeysClient { - return QuotaByPeriodKeysClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewQuotaByPeriodKeysClientWithBaseURI(api sdkEnv.Api) (*QuotaByPeriodKeysClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "quotabyperiodkeys", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating QuotaByPeriodKeysClient: %+v", err) } + + return &QuotaByPeriodKeysClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_get.go b/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_get.go new file mode 100644 index 00000000000..d5d20c15b6f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_get.go @@ -0,0 +1,51 @@ +package quotabyperiodkeys + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *QuotaCounterContract +} + +// Get ... +func (c QuotaByPeriodKeysClient) Get(ctx context.Context, id PeriodId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_get_autorest.go deleted file mode 100644 index 01ee60c2d53..00000000000 --- a/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package quotabyperiodkeys - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *QuotaCounterContract -} - -// Get ... -func (c QuotaByPeriodKeysClient) Get(ctx context.Context, id PeriodId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c QuotaByPeriodKeysClient) preparerForGet(ctx context.Context, id PeriodId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c QuotaByPeriodKeysClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_update.go b/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_update.go new file mode 100644 index 00000000000..0d078a397a0 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_update.go @@ -0,0 +1,55 @@ +package quotabyperiodkeys + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *QuotaCounterContract +} + +// Update ... +func (c QuotaByPeriodKeysClient) Update(ctx context.Context, id PeriodId, input QuotaCounterValueUpdateContract) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_update_autorest.go deleted file mode 100644 index 40b49856a3c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/method_update_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package quotabyperiodkeys - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *QuotaCounterContract -} - -// Update ... -func (c QuotaByPeriodKeysClient) Update(ctx context.Context, id PeriodId, input QuotaCounterValueUpdateContract) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "quotabyperiodkeys.QuotaByPeriodKeysClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c QuotaByPeriodKeysClient) preparerForUpdate(ctx context.Context, id PeriodId, input QuotaCounterValueUpdateContract) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c QuotaByPeriodKeysClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/region/client.go b/resource-manager/apimanagement/2022-08-01/region/client.go index 68b48c48347..3cea33f9d0f 100644 --- a/resource-manager/apimanagement/2022-08-01/region/client.go +++ b/resource-manager/apimanagement/2022-08-01/region/client.go @@ -1,18 +1,26 @@ package region -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type RegionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewRegionClientWithBaseURI(endpoint string) RegionClient { - return RegionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewRegionClientWithBaseURI(api sdkEnv.Api) (*RegionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "region", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RegionClient: %+v", err) } + + return &RegionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/region/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/region/method_listbyservice.go new file mode 100644 index 00000000000..5969f7e8fea --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/region/method_listbyservice.go @@ -0,0 +1,89 @@ +package region + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]RegionContract +} + +type ListByServiceCompleteResult struct { + Items []RegionContract +} + +// ListByService ... +func (c RegionClient) ListByService(ctx context.Context, id ServiceId) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/regions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]RegionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c RegionClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, RegionContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RegionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate RegionContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]RegionContract, 0) + + resp, err := c.ListByService(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/region/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/region/method_listbyservice_autorest.go deleted file mode 100644 index f1bc29a5de4..00000000000 --- a/resource-manager/apimanagement/2022-08-01/region/method_listbyservice_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package region - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]RegionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []RegionContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByService ... -func (c RegionClient) ListByService(ctx context.Context, id ServiceId) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c RegionClient) preparerForListByService(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c RegionClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c RegionClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []RegionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "region.RegionClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c RegionClient) ListByServiceComplete(ctx context.Context, id ServiceId) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, RegionContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c RegionClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate RegionContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]RegionContract, 0) - - page, err := c.ListByService(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/reports/client.go b/resource-manager/apimanagement/2022-08-01/reports/client.go index 605c74c6124..ffc51ba0d7a 100644 --- a/resource-manager/apimanagement/2022-08-01/reports/client.go +++ b/resource-manager/apimanagement/2022-08-01/reports/client.go @@ -1,18 +1,26 @@ package reports -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ReportsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewReportsClientWithBaseURI(endpoint string) ReportsClient { - return ReportsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewReportsClientWithBaseURI(api sdkEnv.Api) (*ReportsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "reports", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ReportsClient: %+v", err) } + + return &ReportsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbyapi.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbyapi.go new file mode 100644 index 00000000000..06522bae2a6 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/reports/method_listbyapi.go @@ -0,0 +1,129 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByApiOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByApiCompleteResult struct { + Items []ReportRecordContract +} + +type ListByApiOperationOptions struct { + Filter *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListByApiOperationOptions() ListByApiOperationOptions { + return ListByApiOperationOptions{} +} + +func (o ListByApiOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByApiOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByApiOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByApi ... +func (c ReportsClient) ListByApi(ctx context.Context, id ServiceId, options ListByApiOperationOptions) (result ListByApiOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byApi", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByApiComplete retrieves all the results into a single object +func (c ReportsClient) ListByApiComplete(ctx context.Context, id ServiceId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { + return c.ListByApiCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByApiCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByApiOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByApiCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByApi(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByApiCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbyapi_autorest.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbyapi_autorest.go deleted file mode 100644 index 61513c4e70d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/reports/method_listbyapi_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByApiOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByApiOperationResponse, error) -} - -type ListByApiCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByApiOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByApiOperationResponse) LoadMore(ctx context.Context) (resp ListByApiOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByApiOperationOptions struct { - Filter *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListByApiOperationOptions() ListByApiOperationOptions { - return ListByApiOperationOptions{} -} - -func (o ListByApiOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByApiOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByApi ... -func (c ReportsClient) ListByApi(ctx context.Context, id ServiceId, options ListByApiOperationOptions) (resp ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApi(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByApi(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByApi prepares the ListByApi request. -func (c ReportsClient) preparerForListByApi(ctx context.Context, id ServiceId, options ListByApiOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byApi", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByApiWithNextLink prepares the ListByApi request with the given nextLink token. -func (c ReportsClient) preparerForListByApiWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByApi handles the response to the ListByApi request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByApi(resp *http.Response) (result ListByApiOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByApiOperationResponse, err error) { - req, err := c.preparerForListByApiWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByApi(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByApi", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByApiComplete retrieves all of the results into a single object -func (c ReportsClient) ListByApiComplete(ctx context.Context, id ServiceId, options ListByApiOperationOptions) (ListByApiCompleteResult, error) { - return c.ListByApiCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByApiCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByApiCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByApiOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByApiCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByApi(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByApiCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbygeo.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbygeo.go new file mode 100644 index 00000000000..2532e17d25b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/reports/method_listbygeo.go @@ -0,0 +1,125 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByGeoOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByGeoCompleteResult struct { + Items []ReportRecordContract +} + +type ListByGeoOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByGeoOperationOptions() ListByGeoOperationOptions { + return ListByGeoOperationOptions{} +} + +func (o ListByGeoOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByGeoOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByGeoOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByGeo ... +func (c ReportsClient) ListByGeo(ctx context.Context, id ServiceId, options ListByGeoOperationOptions) (result ListByGeoOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byGeo", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByGeoComplete retrieves all the results into a single object +func (c ReportsClient) ListByGeoComplete(ctx context.Context, id ServiceId, options ListByGeoOperationOptions) (ListByGeoCompleteResult, error) { + return c.ListByGeoCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByGeoCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByGeoCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByGeoOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByGeoCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByGeo(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByGeoCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbygeo_autorest.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbygeo_autorest.go deleted file mode 100644 index 946c693c961..00000000000 --- a/resource-manager/apimanagement/2022-08-01/reports/method_listbygeo_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByGeoOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByGeoOperationResponse, error) -} - -type ListByGeoCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByGeoOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByGeoOperationResponse) LoadMore(ctx context.Context) (resp ListByGeoOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByGeoOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByGeoOperationOptions() ListByGeoOperationOptions { - return ListByGeoOperationOptions{} -} - -func (o ListByGeoOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByGeoOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByGeo ... -func (c ReportsClient) ListByGeo(ctx context.Context, id ServiceId, options ListByGeoOperationOptions) (resp ListByGeoOperationResponse, err error) { - req, err := c.preparerForListByGeo(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByGeo(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByGeo prepares the ListByGeo request. -func (c ReportsClient) preparerForListByGeo(ctx context.Context, id ServiceId, options ListByGeoOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byGeo", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByGeoWithNextLink prepares the ListByGeo request with the given nextLink token. -func (c ReportsClient) preparerForListByGeoWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByGeo handles the response to the ListByGeo request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByGeo(resp *http.Response) (result ListByGeoOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByGeoOperationResponse, err error) { - req, err := c.preparerForListByGeoWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByGeo(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByGeo", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByGeoComplete retrieves all of the results into a single object -func (c ReportsClient) ListByGeoComplete(ctx context.Context, id ServiceId, options ListByGeoOperationOptions) (ListByGeoCompleteResult, error) { - return c.ListByGeoCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByGeoCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByGeoCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByGeoOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByGeoCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByGeo(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByGeoCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbyoperation.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbyoperation.go new file mode 100644 index 00000000000..80567e9f209 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/reports/method_listbyoperation.go @@ -0,0 +1,129 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByOperationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByOperationCompleteResult struct { + Items []ReportRecordContract +} + +type ListByOperationOperationOptions struct { + Filter *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListByOperationOperationOptions() ListByOperationOperationOptions { + return ListByOperationOperationOptions{} +} + +func (o ListByOperationOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByOperationOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByOperationOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByOperation ... +func (c ReportsClient) ListByOperation(ctx context.Context, id ServiceId, options ListByOperationOperationOptions) (result ListByOperationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byOperation", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByOperationComplete retrieves all the results into a single object +func (c ReportsClient) ListByOperationComplete(ctx context.Context, id ServiceId, options ListByOperationOperationOptions) (ListByOperationCompleteResult, error) { + return c.ListByOperationCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByOperationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByOperationCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByOperationOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByOperationCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByOperation(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByOperationCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbyoperation_autorest.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbyoperation_autorest.go deleted file mode 100644 index 3aa660eb04c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/reports/method_listbyoperation_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByOperationOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByOperationOperationResponse, error) -} - -type ListByOperationCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByOperationOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByOperationOperationResponse) LoadMore(ctx context.Context) (resp ListByOperationOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByOperationOperationOptions struct { - Filter *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListByOperationOperationOptions() ListByOperationOperationOptions { - return ListByOperationOperationOptions{} -} - -func (o ListByOperationOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByOperationOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByOperation ... -func (c ReportsClient) ListByOperation(ctx context.Context, id ServiceId, options ListByOperationOperationOptions) (resp ListByOperationOperationResponse, err error) { - req, err := c.preparerForListByOperation(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByOperation(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByOperation prepares the ListByOperation request. -func (c ReportsClient) preparerForListByOperation(ctx context.Context, id ServiceId, options ListByOperationOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byOperation", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByOperationWithNextLink prepares the ListByOperation request with the given nextLink token. -func (c ReportsClient) preparerForListByOperationWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByOperation handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByOperation(resp *http.Response) (result ListByOperationOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByOperationOperationResponse, err error) { - req, err := c.preparerForListByOperationWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByOperation(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByOperation", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByOperationComplete retrieves all of the results into a single object -func (c ReportsClient) ListByOperationComplete(ctx context.Context, id ServiceId, options ListByOperationOperationOptions) (ListByOperationCompleteResult, error) { - return c.ListByOperationCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByOperationCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByOperationCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByOperationOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByOperationCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByOperation(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByOperationCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbyproduct.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbyproduct.go new file mode 100644 index 00000000000..de187303948 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/reports/method_listbyproduct.go @@ -0,0 +1,129 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByProductOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByProductCompleteResult struct { + Items []ReportRecordContract +} + +type ListByProductOperationOptions struct { + Filter *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListByProductOperationOptions() ListByProductOperationOptions { + return ListByProductOperationOptions{} +} + +func (o ListByProductOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByProductOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByProductOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByProduct ... +func (c ReportsClient) ListByProduct(ctx context.Context, id ServiceId, options ListByProductOperationOptions) (result ListByProductOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byProduct", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByProductComplete retrieves all the results into a single object +func (c ReportsClient) ListByProductComplete(ctx context.Context, id ServiceId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { + return c.ListByProductCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByProductCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByProductOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByProductCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByProduct(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByProductCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbyproduct_autorest.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbyproduct_autorest.go deleted file mode 100644 index 507a05240b8..00000000000 --- a/resource-manager/apimanagement/2022-08-01/reports/method_listbyproduct_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByProductOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByProductOperationResponse, error) -} - -type ListByProductCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByProductOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByProductOperationResponse) LoadMore(ctx context.Context) (resp ListByProductOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByProductOperationOptions struct { - Filter *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListByProductOperationOptions() ListByProductOperationOptions { - return ListByProductOperationOptions{} -} - -func (o ListByProductOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByProductOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByProduct ... -func (c ReportsClient) ListByProduct(ctx context.Context, id ServiceId, options ListByProductOperationOptions) (resp ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProduct(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByProduct(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByProduct prepares the ListByProduct request. -func (c ReportsClient) preparerForListByProduct(ctx context.Context, id ServiceId, options ListByProductOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byProduct", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByProductWithNextLink prepares the ListByProduct request with the given nextLink token. -func (c ReportsClient) preparerForListByProductWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByProduct handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByProduct(resp *http.Response) (result ListByProductOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByProductOperationResponse, err error) { - req, err := c.preparerForListByProductWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByProduct(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByProduct", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByProductComplete retrieves all of the results into a single object -func (c ReportsClient) ListByProductComplete(ctx context.Context, id ServiceId, options ListByProductOperationOptions) (ListByProductCompleteResult, error) { - return c.ListByProductCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByProductCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByProductCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByProductOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByProductCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByProduct(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByProductCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbyrequest.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbyrequest.go new file mode 100644 index 00000000000..bd4c8b54a0d --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/reports/method_listbyrequest.go @@ -0,0 +1,88 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByRequestOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RequestReportCollection +} + +type ListByRequestOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByRequestOperationOptions() ListByRequestOperationOptions { + return ListByRequestOperationOptions{} +} + +func (o ListByRequestOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByRequestOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByRequestOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByRequest ... +func (c ReportsClient) ListByRequest(ctx context.Context, id ServiceId, options ListByRequestOperationOptions) (result ListByRequestOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byRequest", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbyrequest_autorest.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbyrequest_autorest.go deleted file mode 100644 index 27f2a2395ef..00000000000 --- a/resource-manager/apimanagement/2022-08-01/reports/method_listbyrequest_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByRequestOperationResponse struct { - HttpResponse *http.Response - Model *RequestReportCollection -} - -type ListByRequestOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByRequestOperationOptions() ListByRequestOperationOptions { - return ListByRequestOperationOptions{} -} - -func (o ListByRequestOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByRequestOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByRequest ... -func (c ReportsClient) ListByRequest(ctx context.Context, id ServiceId, options ListByRequestOperationOptions) (result ListByRequestOperationResponse, err error) { - req, err := c.preparerForListByRequest(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByRequest", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByRequest", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByRequest(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByRequest", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByRequest prepares the ListByRequest request. -func (c ReportsClient) preparerForListByRequest(ctx context.Context, id ServiceId, options ListByRequestOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byRequest", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByRequest handles the response to the ListByRequest request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByRequest(resp *http.Response) (result ListByRequestOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbysubscription.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbysubscription.go new file mode 100644 index 00000000000..22df641c1c4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/reports/method_listbysubscription.go @@ -0,0 +1,129 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListBySubscriptionCompleteResult struct { + Items []ReportRecordContract +} + +type ListBySubscriptionOperationOptions struct { + Filter *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListBySubscriptionOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListBySubscriptionOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListBySubscription ... +func (c ReportsClient) ListBySubscription(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/bySubscription", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c ReportsClient) ListBySubscriptionComplete(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbysubscription_autorest.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbysubscription_autorest.go deleted file mode 100644 index e0c5065d369..00000000000 --- a/resource-manager/apimanagement/2022-08-01/reports/method_listbysubscription_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListBySubscriptionOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListBySubscriptionOperationOptions struct { - Filter *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { - return ListBySubscriptionOperationOptions{} -} - -func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListBySubscription ... -func (c ReportsClient) ListBySubscription(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c ReportsClient) preparerForListBySubscription(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/bySubscription", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c ReportsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c ReportsClient) ListBySubscriptionComplete(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListBySubscriptionOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListBySubscription(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbytime.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbytime.go new file mode 100644 index 00000000000..7667748e6bb --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/reports/method_listbytime.go @@ -0,0 +1,133 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByTimeOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByTimeCompleteResult struct { + Items []ReportRecordContract +} + +type ListByTimeOperationOptions struct { + Filter *string + Interval *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListByTimeOperationOptions() ListByTimeOperationOptions { + return ListByTimeOperationOptions{} +} + +func (o ListByTimeOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByTimeOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByTimeOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Interval != nil { + out.Append("interval", fmt.Sprintf("%v", *o.Interval)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByTime ... +func (c ReportsClient) ListByTime(ctx context.Context, id ServiceId, options ListByTimeOperationOptions) (result ListByTimeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byTime", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByTimeComplete retrieves all the results into a single object +func (c ReportsClient) ListByTimeComplete(ctx context.Context, id ServiceId, options ListByTimeOperationOptions) (ListByTimeCompleteResult, error) { + return c.ListByTimeCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByTimeCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByTimeCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByTimeOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByTimeCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByTime(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByTimeCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbytime_autorest.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbytime_autorest.go deleted file mode 100644 index b13857ba750..00000000000 --- a/resource-manager/apimanagement/2022-08-01/reports/method_listbytime_autorest.go +++ /dev/null @@ -1,235 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByTimeOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByTimeOperationResponse, error) -} - -type ListByTimeCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByTimeOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByTimeOperationResponse) LoadMore(ctx context.Context) (resp ListByTimeOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByTimeOperationOptions struct { - Filter *string - Interval *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListByTimeOperationOptions() ListByTimeOperationOptions { - return ListByTimeOperationOptions{} -} - -func (o ListByTimeOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByTimeOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Interval != nil { - out["interval"] = *o.Interval - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByTime ... -func (c ReportsClient) ListByTime(ctx context.Context, id ServiceId, options ListByTimeOperationOptions) (resp ListByTimeOperationResponse, err error) { - req, err := c.preparerForListByTime(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByTime(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByTime prepares the ListByTime request. -func (c ReportsClient) preparerForListByTime(ctx context.Context, id ServiceId, options ListByTimeOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byTime", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByTimeWithNextLink prepares the ListByTime request with the given nextLink token. -func (c ReportsClient) preparerForListByTimeWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByTime handles the response to the ListByTime request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByTime(resp *http.Response) (result ListByTimeOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByTimeOperationResponse, err error) { - req, err := c.preparerForListByTimeWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByTime(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByTime", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByTimeComplete retrieves all of the results into a single object -func (c ReportsClient) ListByTimeComplete(ctx context.Context, id ServiceId, options ListByTimeOperationOptions) (ListByTimeCompleteResult, error) { - return c.ListByTimeCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByTimeCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByTimeCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByTimeOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByTimeCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByTime(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByTimeCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbyuser.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbyuser.go new file mode 100644 index 00000000000..66a39254bdc --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/reports/method_listbyuser.go @@ -0,0 +1,129 @@ +package reports + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByUserOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReportRecordContract +} + +type ListByUserCompleteResult struct { + Items []ReportRecordContract +} + +type ListByUserOperationOptions struct { + Filter *string + Orderby *string + Skip *int64 + Top *int64 +} + +func DefaultListByUserOperationOptions() ListByUserOperationOptions { + return ListByUserOperationOptions{} +} + +func (o ListByUserOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByUserOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByUserOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByUser ... +func (c ReportsClient) ListByUser(ctx context.Context, id ServiceId, options ListByUserOperationOptions) (result ListByUserOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/reports/byUser", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ReportRecordContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByUserComplete retrieves all the results into a single object +func (c ReportsClient) ListByUserComplete(ctx context.Context, id ServiceId, options ListByUserOperationOptions) (ListByUserCompleteResult, error) { + return c.ListByUserCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) +} + +// ListByUserCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReportsClient) ListByUserCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByUserOperationOptions, predicate ReportRecordContractOperationPredicate) (result ListByUserCompleteResult, err error) { + items := make([]ReportRecordContract, 0) + + resp, err := c.ListByUser(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByUserCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/reports/method_listbyuser_autorest.go b/resource-manager/apimanagement/2022-08-01/reports/method_listbyuser_autorest.go deleted file mode 100644 index 2bd9f434043..00000000000 --- a/resource-manager/apimanagement/2022-08-01/reports/method_listbyuser_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package reports - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByUserOperationResponse struct { - HttpResponse *http.Response - Model *[]ReportRecordContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByUserOperationResponse, error) -} - -type ListByUserCompleteResult struct { - Items []ReportRecordContract -} - -func (r ListByUserOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByUserOperationResponse) LoadMore(ctx context.Context) (resp ListByUserOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByUserOperationOptions struct { - Filter *string - Orderby *string - Skip *int64 - Top *int64 -} - -func DefaultListByUserOperationOptions() ListByUserOperationOptions { - return ListByUserOperationOptions{} -} - -func (o ListByUserOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByUserOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByUser ... -func (c ReportsClient) ListByUser(ctx context.Context, id ServiceId, options ListByUserOperationOptions) (resp ListByUserOperationResponse, err error) { - req, err := c.preparerForListByUser(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByUser(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByUser prepares the ListByUser request. -func (c ReportsClient) preparerForListByUser(ctx context.Context, id ServiceId, options ListByUserOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/reports/byUser", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByUserWithNextLink prepares the ListByUser request with the given nextLink token. -func (c ReportsClient) preparerForListByUserWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByUser handles the response to the ListByUser request. The method always -// closes the http.Response Body. -func (c ReportsClient) responderForListByUser(resp *http.Response) (result ListByUserOperationResponse, err error) { - type page struct { - Values []ReportRecordContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByUserOperationResponse, err error) { - req, err := c.preparerForListByUserWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByUser(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "reports.ReportsClient", "ListByUser", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByUserComplete retrieves all of the results into a single object -func (c ReportsClient) ListByUserComplete(ctx context.Context, id ServiceId, options ListByUserOperationOptions) (ListByUserCompleteResult, error) { - return c.ListByUserCompleteMatchingPredicate(ctx, id, options, ReportRecordContractOperationPredicate{}) -} - -// ListByUserCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReportsClient) ListByUserCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByUserOperationOptions, predicate ReportRecordContractOperationPredicate) (resp ListByUserCompleteResult, err error) { - items := make([]ReportRecordContract, 0) - - page, err := c.ListByUser(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByUserCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/schema/client.go b/resource-manager/apimanagement/2022-08-01/schema/client.go index 8905f2ce375..15ce21e01f4 100644 --- a/resource-manager/apimanagement/2022-08-01/schema/client.go +++ b/resource-manager/apimanagement/2022-08-01/schema/client.go @@ -1,18 +1,26 @@ package schema -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SchemaClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSchemaClientWithBaseURI(endpoint string) SchemaClient { - return SchemaClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSchemaClientWithBaseURI(api sdkEnv.Api) (*SchemaClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "schema", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SchemaClient: %+v", err) } + + return &SchemaClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/schema/constants.go b/resource-manager/apimanagement/2022-08-01/schema/constants.go index ab4513e2c37..fc6c0c9faf6 100644 --- a/resource-manager/apimanagement/2022-08-01/schema/constants.go +++ b/resource-manager/apimanagement/2022-08-01/schema/constants.go @@ -1,6 +1,10 @@ package schema -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForSchemaType() []string { } } +func (s *SchemaType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSchemaType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSchemaType(input string) (*SchemaType, error) { vals := map[string]SchemaType{ "json": SchemaTypeJson, diff --git a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemacreateorupdate.go b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemacreateorupdate.go new file mode 100644 index 00000000000..3e9e658a682 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemacreateorupdate.go @@ -0,0 +1,103 @@ +package schema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GlobalSchemaCreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type GlobalSchemaCreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultGlobalSchemaCreateOrUpdateOperationOptions() GlobalSchemaCreateOrUpdateOperationOptions { + return GlobalSchemaCreateOrUpdateOperationOptions{} +} + +func (o GlobalSchemaCreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o GlobalSchemaCreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GlobalSchemaCreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// GlobalSchemaCreateOrUpdate ... +func (c SchemaClient) GlobalSchemaCreateOrUpdate(ctx context.Context, id SchemaId, input GlobalSchemaContract, options GlobalSchemaCreateOrUpdateOperationOptions) (result GlobalSchemaCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// GlobalSchemaCreateOrUpdateThenPoll performs GlobalSchemaCreateOrUpdate then polls until it's completed +func (c SchemaClient) GlobalSchemaCreateOrUpdateThenPoll(ctx context.Context, id SchemaId, input GlobalSchemaContract, options GlobalSchemaCreateOrUpdateOperationOptions) error { + result, err := c.GlobalSchemaCreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing GlobalSchemaCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after GlobalSchemaCreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemacreateorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemacreateorupdate_autorest.go deleted file mode 100644 index 169dc63374e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemacreateorupdate_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package schema - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GlobalSchemaCreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type GlobalSchemaCreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultGlobalSchemaCreateOrUpdateOperationOptions() GlobalSchemaCreateOrUpdateOperationOptions { - return GlobalSchemaCreateOrUpdateOperationOptions{} -} - -func (o GlobalSchemaCreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o GlobalSchemaCreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// GlobalSchemaCreateOrUpdate ... -func (c SchemaClient) GlobalSchemaCreateOrUpdate(ctx context.Context, id SchemaId, input GlobalSchemaContract, options GlobalSchemaCreateOrUpdateOperationOptions) (result GlobalSchemaCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaCreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForGlobalSchemaCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// GlobalSchemaCreateOrUpdateThenPoll performs GlobalSchemaCreateOrUpdate then polls until it's completed -func (c SchemaClient) GlobalSchemaCreateOrUpdateThenPoll(ctx context.Context, id SchemaId, input GlobalSchemaContract, options GlobalSchemaCreateOrUpdateOperationOptions) error { - result, err := c.GlobalSchemaCreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing GlobalSchemaCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after GlobalSchemaCreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForGlobalSchemaCreateOrUpdate prepares the GlobalSchemaCreateOrUpdate request. -func (c SchemaClient) preparerForGlobalSchemaCreateOrUpdate(ctx context.Context, id SchemaId, input GlobalSchemaContract, options GlobalSchemaCreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForGlobalSchemaCreateOrUpdate sends the GlobalSchemaCreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c SchemaClient) senderForGlobalSchemaCreateOrUpdate(ctx context.Context, req *http.Request) (future GlobalSchemaCreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemadelete.go b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemadelete.go new file mode 100644 index 00000000000..f7169489c2b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemadelete.go @@ -0,0 +1,76 @@ +package schema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GlobalSchemaDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type GlobalSchemaDeleteOperationOptions struct { + IfMatch *string +} + +func DefaultGlobalSchemaDeleteOperationOptions() GlobalSchemaDeleteOperationOptions { + return GlobalSchemaDeleteOperationOptions{} +} + +func (o GlobalSchemaDeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o GlobalSchemaDeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GlobalSchemaDeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// GlobalSchemaDelete ... +func (c SchemaClient) GlobalSchemaDelete(ctx context.Context, id SchemaId, options GlobalSchemaDeleteOperationOptions) (result GlobalSchemaDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemadelete_autorest.go b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemadelete_autorest.go deleted file mode 100644 index ec3f0417e40..00000000000 --- a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemadelete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package schema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GlobalSchemaDeleteOperationResponse struct { - HttpResponse *http.Response -} - -type GlobalSchemaDeleteOperationOptions struct { - IfMatch *string -} - -func DefaultGlobalSchemaDeleteOperationOptions() GlobalSchemaDeleteOperationOptions { - return GlobalSchemaDeleteOperationOptions{} -} - -func (o GlobalSchemaDeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o GlobalSchemaDeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// GlobalSchemaDelete ... -func (c SchemaClient) GlobalSchemaDelete(ctx context.Context, id SchemaId, options GlobalSchemaDeleteOperationOptions) (result GlobalSchemaDeleteOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGlobalSchemaDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGlobalSchemaDelete prepares the GlobalSchemaDelete request. -func (c SchemaClient) preparerForGlobalSchemaDelete(ctx context.Context, id SchemaId, options GlobalSchemaDeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGlobalSchemaDelete handles the response to the GlobalSchemaDelete request. The method always -// closes the http.Response Body. -func (c SchemaClient) responderForGlobalSchemaDelete(resp *http.Response) (result GlobalSchemaDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemaget.go b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemaget.go new file mode 100644 index 00000000000..3d7e9fd46ef --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemaget.go @@ -0,0 +1,51 @@ +package schema + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GlobalSchemaGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GlobalSchemaContract +} + +// GlobalSchemaGet ... +func (c SchemaClient) GlobalSchemaGet(ctx context.Context, id SchemaId) (result GlobalSchemaGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemaget_autorest.go b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemaget_autorest.go deleted file mode 100644 index d87e67a9d30..00000000000 --- a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemaget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package schema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GlobalSchemaGetOperationResponse struct { - HttpResponse *http.Response - Model *GlobalSchemaContract -} - -// GlobalSchemaGet ... -func (c SchemaClient) GlobalSchemaGet(ctx context.Context, id SchemaId) (result GlobalSchemaGetOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGlobalSchemaGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGlobalSchemaGet prepares the GlobalSchemaGet request. -func (c SchemaClient) preparerForGlobalSchemaGet(ctx context.Context, id SchemaId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGlobalSchemaGet handles the response to the GlobalSchemaGet request. The method always -// closes the http.Response Body. -func (c SchemaClient) responderForGlobalSchemaGet(resp *http.Response) (result GlobalSchemaGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemagetentitytag.go b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemagetentitytag.go new file mode 100644 index 00000000000..b62a3956afc --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemagetentitytag.go @@ -0,0 +1,46 @@ +package schema + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GlobalSchemaGetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GlobalSchemaGetEntityTag ... +func (c SchemaClient) GlobalSchemaGetEntityTag(ctx context.Context, id SchemaId) (result GlobalSchemaGetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemagetentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemagetentitytag_autorest.go deleted file mode 100644 index a02a95a3402..00000000000 --- a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemagetentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package schema - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GlobalSchemaGetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GlobalSchemaGetEntityTag ... -func (c SchemaClient) GlobalSchemaGetEntityTag(ctx context.Context, id SchemaId) (result GlobalSchemaGetEntityTagOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGlobalSchemaGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaGetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGlobalSchemaGetEntityTag prepares the GlobalSchemaGetEntityTag request. -func (c SchemaClient) preparerForGlobalSchemaGetEntityTag(ctx context.Context, id SchemaId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGlobalSchemaGetEntityTag handles the response to the GlobalSchemaGetEntityTag request. The method always -// closes the http.Response Body. -func (c SchemaClient) responderForGlobalSchemaGetEntityTag(resp *http.Response) (result GlobalSchemaGetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemalistbyservice.go b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemalistbyservice.go new file mode 100644 index 00000000000..739c27caee5 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemalistbyservice.go @@ -0,0 +1,125 @@ +package schema + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GlobalSchemaListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GlobalSchemaContract +} + +type GlobalSchemaListByServiceCompleteResult struct { + Items []GlobalSchemaContract +} + +type GlobalSchemaListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultGlobalSchemaListByServiceOperationOptions() GlobalSchemaListByServiceOperationOptions { + return GlobalSchemaListByServiceOperationOptions{} +} + +func (o GlobalSchemaListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GlobalSchemaListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o GlobalSchemaListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// GlobalSchemaListByService ... +func (c SchemaClient) GlobalSchemaListByService(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions) (result GlobalSchemaListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/schemas", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GlobalSchemaContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// GlobalSchemaListByServiceComplete retrieves all the results into a single object +func (c SchemaClient) GlobalSchemaListByServiceComplete(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions) (GlobalSchemaListByServiceCompleteResult, error) { + return c.GlobalSchemaListByServiceCompleteMatchingPredicate(ctx, id, options, GlobalSchemaContractOperationPredicate{}) +} + +// GlobalSchemaListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SchemaClient) GlobalSchemaListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions, predicate GlobalSchemaContractOperationPredicate) (result GlobalSchemaListByServiceCompleteResult, err error) { + items := make([]GlobalSchemaContract, 0) + + resp, err := c.GlobalSchemaListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = GlobalSchemaListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemalistbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/schema/method_globalschemalistbyservice_autorest.go deleted file mode 100644 index f69bb14a594..00000000000 --- a/resource-manager/apimanagement/2022-08-01/schema/method_globalschemalistbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package schema - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GlobalSchemaListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]GlobalSchemaContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (GlobalSchemaListByServiceOperationResponse, error) -} - -type GlobalSchemaListByServiceCompleteResult struct { - Items []GlobalSchemaContract -} - -func (r GlobalSchemaListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r GlobalSchemaListByServiceOperationResponse) LoadMore(ctx context.Context) (resp GlobalSchemaListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type GlobalSchemaListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultGlobalSchemaListByServiceOperationOptions() GlobalSchemaListByServiceOperationOptions { - return GlobalSchemaListByServiceOperationOptions{} -} - -func (o GlobalSchemaListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o GlobalSchemaListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// GlobalSchemaListByService ... -func (c SchemaClient) GlobalSchemaListByService(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions) (resp GlobalSchemaListByServiceOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForGlobalSchemaListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForGlobalSchemaListByService prepares the GlobalSchemaListByService request. -func (c SchemaClient) preparerForGlobalSchemaListByService(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/schemas", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForGlobalSchemaListByServiceWithNextLink prepares the GlobalSchemaListByService request with the given nextLink token. -func (c SchemaClient) preparerForGlobalSchemaListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGlobalSchemaListByService handles the response to the GlobalSchemaListByService request. The method always -// closes the http.Response Body. -func (c SchemaClient) responderForGlobalSchemaListByService(resp *http.Response) (result GlobalSchemaListByServiceOperationResponse, err error) { - type page struct { - Values []GlobalSchemaContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result GlobalSchemaListByServiceOperationResponse, err error) { - req, err := c.preparerForGlobalSchemaListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGlobalSchemaListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "schema.SchemaClient", "GlobalSchemaListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// GlobalSchemaListByServiceComplete retrieves all of the results into a single object -func (c SchemaClient) GlobalSchemaListByServiceComplete(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions) (GlobalSchemaListByServiceCompleteResult, error) { - return c.GlobalSchemaListByServiceCompleteMatchingPredicate(ctx, id, options, GlobalSchemaContractOperationPredicate{}) -} - -// GlobalSchemaListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SchemaClient) GlobalSchemaListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options GlobalSchemaListByServiceOperationOptions, predicate GlobalSchemaContractOperationPredicate) (resp GlobalSchemaListByServiceCompleteResult, err error) { - items := make([]GlobalSchemaContract, 0) - - page, err := c.GlobalSchemaListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := GlobalSchemaListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/signinsettings/client.go b/resource-manager/apimanagement/2022-08-01/signinsettings/client.go index b4213de27ba..c2b9d49feb7 100644 --- a/resource-manager/apimanagement/2022-08-01/signinsettings/client.go +++ b/resource-manager/apimanagement/2022-08-01/signinsettings/client.go @@ -1,18 +1,26 @@ package signinsettings -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SignInSettingsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSignInSettingsClientWithBaseURI(endpoint string) SignInSettingsClient { - return SignInSettingsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSignInSettingsClientWithBaseURI(api sdkEnv.Api) (*SignInSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "signinsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SignInSettingsClient: %+v", err) } + + return &SignInSettingsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/signinsettings/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/signinsettings/method_createorupdate.go new file mode 100644 index 00000000000..7b9767c2fbe --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/signinsettings/method_createorupdate.go @@ -0,0 +1,84 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSigninSettings +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c SignInSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalSigninSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/signinsettings/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/signinsettings/method_createorupdate_autorest.go deleted file mode 100644 index b4f0296beba..00000000000 --- a/resource-manager/apimanagement/2022-08-01/signinsettings/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package signinsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PortalSigninSettings -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c SignInSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalSigninSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c SignInSettingsClient) preparerForCreateOrUpdate(ctx context.Context, id ServiceId, input PortalSigninSettings, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signin", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c SignInSettingsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/signinsettings/method_get.go b/resource-manager/apimanagement/2022-08-01/signinsettings/method_get.go new file mode 100644 index 00000000000..173524f6cc7 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/signinsettings/method_get.go @@ -0,0 +1,52 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSigninSettings +} + +// Get ... +func (c SignInSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/signinsettings/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/signinsettings/method_get_autorest.go deleted file mode 100644 index 3ac4891a75c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/signinsettings/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package signinsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PortalSigninSettings -} - -// Get ... -func (c SignInSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c SignInSettingsClient) preparerForGet(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signin", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c SignInSettingsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/signinsettings/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/signinsettings/method_getentitytag.go new file mode 100644 index 00000000000..25861ccf2a4 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/signinsettings/method_getentitytag.go @@ -0,0 +1,47 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c SignInSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/signinsettings/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/signinsettings/method_getentitytag_autorest.go deleted file mode 100644 index 1209ff66c99..00000000000 --- a/resource-manager/apimanagement/2022-08-01/signinsettings/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package signinsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c SignInSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c SignInSettingsClient) preparerForGetEntityTag(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signin", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c SignInSettingsClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/signinsettings/method_update.go b/resource-manager/apimanagement/2022-08-01/signinsettings/method_update.go new file mode 100644 index 00000000000..cdef3702ed0 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/signinsettings/method_update.go @@ -0,0 +1,79 @@ +package signinsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c SignInSettingsClient) Update(ctx context.Context, id ServiceId, input PortalSigninSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/portalsettings/signin", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/signinsettings/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/signinsettings/method_update_autorest.go deleted file mode 100644 index 0a95b9f7fa1..00000000000 --- a/resource-manager/apimanagement/2022-08-01/signinsettings/method_update_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package signinsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c SignInSettingsClient) Update(ctx context.Context, id ServiceId, input PortalSigninSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signinsettings.SignInSettingsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c SignInSettingsClient) preparerForUpdate(ctx context.Context, id ServiceId, input PortalSigninSettings, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signin", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c SignInSettingsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/signupsettings/client.go b/resource-manager/apimanagement/2022-08-01/signupsettings/client.go index 539431c37b7..0d30a04c8e6 100644 --- a/resource-manager/apimanagement/2022-08-01/signupsettings/client.go +++ b/resource-manager/apimanagement/2022-08-01/signupsettings/client.go @@ -1,18 +1,26 @@ package signupsettings -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SignUpSettingsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSignUpSettingsClientWithBaseURI(endpoint string) SignUpSettingsClient { - return SignUpSettingsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSignUpSettingsClientWithBaseURI(api sdkEnv.Api) (*SignUpSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "signupsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SignUpSettingsClient: %+v", err) } + + return &SignUpSettingsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/signupsettings/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/signupsettings/method_createorupdate.go new file mode 100644 index 00000000000..7269ad66a33 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/signupsettings/method_createorupdate.go @@ -0,0 +1,84 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSignupSettings +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c SignUpSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalSignupSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/signupsettings/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/signupsettings/method_createorupdate_autorest.go deleted file mode 100644 index 096041ff364..00000000000 --- a/resource-manager/apimanagement/2022-08-01/signupsettings/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package signupsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PortalSignupSettings -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c SignUpSettingsClient) CreateOrUpdate(ctx context.Context, id ServiceId, input PortalSignupSettings, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c SignUpSettingsClient) preparerForCreateOrUpdate(ctx context.Context, id ServiceId, input PortalSignupSettings, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signup", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c SignUpSettingsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/signupsettings/method_get.go b/resource-manager/apimanagement/2022-08-01/signupsettings/method_get.go new file mode 100644 index 00000000000..9c83e5e83ec --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/signupsettings/method_get.go @@ -0,0 +1,52 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PortalSignupSettings +} + +// Get ... +func (c SignUpSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/signupsettings/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/signupsettings/method_get_autorest.go deleted file mode 100644 index 0f67ad8685a..00000000000 --- a/resource-manager/apimanagement/2022-08-01/signupsettings/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package signupsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PortalSignupSettings -} - -// Get ... -func (c SignUpSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c SignUpSettingsClient) preparerForGet(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signup", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c SignUpSettingsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/signupsettings/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/signupsettings/method_getentitytag.go new file mode 100644 index 00000000000..c664f2c2ea8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/signupsettings/method_getentitytag.go @@ -0,0 +1,47 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c SignUpSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/signupsettings/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/signupsettings/method_getentitytag_autorest.go deleted file mode 100644 index 3fa59c81432..00000000000 --- a/resource-manager/apimanagement/2022-08-01/signupsettings/method_getentitytag_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package signupsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c SignUpSettingsClient) GetEntityTag(ctx context.Context, id ServiceId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c SignUpSettingsClient) preparerForGetEntityTag(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signup", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c SignUpSettingsClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/signupsettings/method_update.go b/resource-manager/apimanagement/2022-08-01/signupsettings/method_update.go new file mode 100644 index 00000000000..fd56de21870 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/signupsettings/method_update.go @@ -0,0 +1,79 @@ +package signupsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c SignUpSettingsClient) Update(ctx context.Context, id ServiceId, input PortalSignupSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/portalsettings/signup", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/signupsettings/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/signupsettings/method_update_autorest.go deleted file mode 100644 index 6ab1c8cf856..00000000000 --- a/resource-manager/apimanagement/2022-08-01/signupsettings/method_update_autorest.go +++ /dev/null @@ -1,97 +0,0 @@ -package signupsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c SignUpSettingsClient) Update(ctx context.Context, id ServiceId, input PortalSignupSettings, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signupsettings.SignUpSettingsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c SignUpSettingsClient) preparerForUpdate(ctx context.Context, id ServiceId, input PortalSignupSettings, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/portalsettings/signup", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c SignUpSettingsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/skus/client.go b/resource-manager/apimanagement/2022-08-01/skus/client.go index bb4f8409006..ee82463b163 100644 --- a/resource-manager/apimanagement/2022-08-01/skus/client.go +++ b/resource-manager/apimanagement/2022-08-01/skus/client.go @@ -1,18 +1,26 @@ package skus -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SkusClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSkusClientWithBaseURI(endpoint string) SkusClient { - return SkusClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSkusClientWithBaseURI(api sdkEnv.Api) (*SkusClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "skus", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SkusClient: %+v", err) } + + return &SkusClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/skus/constants.go b/resource-manager/apimanagement/2022-08-01/skus/constants.go index 0e5b4b734b7..97daf30eeec 100644 --- a/resource-manager/apimanagement/2022-08-01/skus/constants.go +++ b/resource-manager/apimanagement/2022-08-01/skus/constants.go @@ -1,6 +1,10 @@ package skus -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForApiManagementSkuCapacityScaleType() []string { } } +func (s *ApiManagementSkuCapacityScaleType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiManagementSkuCapacityScaleType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiManagementSkuCapacityScaleType(input string) (*ApiManagementSkuCapacityScaleType, error) { vals := map[string]ApiManagementSkuCapacityScaleType{ "automatic": ApiManagementSkuCapacityScaleTypeAutomatic, @@ -50,6 +67,19 @@ func PossibleValuesForApiManagementSkuRestrictionsReasonCode() []string { } } +func (s *ApiManagementSkuRestrictionsReasonCode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiManagementSkuRestrictionsReasonCode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiManagementSkuRestrictionsReasonCode(input string) (*ApiManagementSkuRestrictionsReasonCode, error) { vals := map[string]ApiManagementSkuRestrictionsReasonCode{ "notavailableforsubscription": ApiManagementSkuRestrictionsReasonCodeNotAvailableForSubscription, @@ -78,6 +108,19 @@ func PossibleValuesForApiManagementSkuRestrictionsType() []string { } } +func (s *ApiManagementSkuRestrictionsType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiManagementSkuRestrictionsType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiManagementSkuRestrictionsType(input string) (*ApiManagementSkuRestrictionsType, error) { vals := map[string]ApiManagementSkuRestrictionsType{ "location": ApiManagementSkuRestrictionsTypeLocation, diff --git a/resource-manager/apimanagement/2022-08-01/skus/method_apimanagementskuslist.go b/resource-manager/apimanagement/2022-08-01/skus/method_apimanagementskuslist.go new file mode 100644 index 00000000000..4818d802b31 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/skus/method_apimanagementskuslist.go @@ -0,0 +1,90 @@ +package skus + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiManagementSkusListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApiManagementSku +} + +type ApiManagementSkusListCompleteResult struct { + Items []ApiManagementSku +} + +// ApiManagementSkusList ... +func (c SkusClient) ApiManagementSkusList(ctx context.Context, id commonids.SubscriptionId) (result ApiManagementSkusListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ApiManagement/skus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApiManagementSku `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ApiManagementSkusListComplete retrieves all the results into a single object +func (c SkusClient) ApiManagementSkusListComplete(ctx context.Context, id commonids.SubscriptionId) (ApiManagementSkusListCompleteResult, error) { + return c.ApiManagementSkusListCompleteMatchingPredicate(ctx, id, ApiManagementSkuOperationPredicate{}) +} + +// ApiManagementSkusListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SkusClient) ApiManagementSkusListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApiManagementSkuOperationPredicate) (result ApiManagementSkusListCompleteResult, err error) { + items := make([]ApiManagementSku, 0) + + resp, err := c.ApiManagementSkusList(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ApiManagementSkusListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/skus/method_apimanagementskuslist_autorest.go b/resource-manager/apimanagement/2022-08-01/skus/method_apimanagementskuslist_autorest.go deleted file mode 100644 index d9bb79afd90..00000000000 --- a/resource-manager/apimanagement/2022-08-01/skus/method_apimanagementskuslist_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package skus - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ApiManagementSkusListOperationResponse struct { - HttpResponse *http.Response - Model *[]ApiManagementSku - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ApiManagementSkusListOperationResponse, error) -} - -type ApiManagementSkusListCompleteResult struct { - Items []ApiManagementSku -} - -func (r ApiManagementSkusListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ApiManagementSkusListOperationResponse) LoadMore(ctx context.Context) (resp ApiManagementSkusListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ApiManagementSkusList ... -func (c SkusClient) ApiManagementSkusList(ctx context.Context, id commonids.SubscriptionId) (resp ApiManagementSkusListOperationResponse, err error) { - req, err := c.preparerForApiManagementSkusList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForApiManagementSkusList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForApiManagementSkusList prepares the ApiManagementSkusList request. -func (c SkusClient) preparerForApiManagementSkusList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ApiManagement/skus", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForApiManagementSkusListWithNextLink prepares the ApiManagementSkusList request with the given nextLink token. -func (c SkusClient) preparerForApiManagementSkusListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForApiManagementSkusList handles the response to the ApiManagementSkusList request. The method always -// closes the http.Response Body. -func (c SkusClient) responderForApiManagementSkusList(resp *http.Response) (result ApiManagementSkusListOperationResponse, err error) { - type page struct { - Values []ApiManagementSku `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ApiManagementSkusListOperationResponse, err error) { - req, err := c.preparerForApiManagementSkusListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForApiManagementSkusList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "skus.SkusClient", "ApiManagementSkusList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ApiManagementSkusListComplete retrieves all of the results into a single object -func (c SkusClient) ApiManagementSkusListComplete(ctx context.Context, id commonids.SubscriptionId) (ApiManagementSkusListCompleteResult, error) { - return c.ApiManagementSkusListCompleteMatchingPredicate(ctx, id, ApiManagementSkuOperationPredicate{}) -} - -// ApiManagementSkusListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SkusClient) ApiManagementSkusListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApiManagementSkuOperationPredicate) (resp ApiManagementSkusListCompleteResult, err error) { - items := make([]ApiManagementSku, 0) - - page, err := c.ApiManagementSkusList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ApiManagementSkusListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/client.go b/resource-manager/apimanagement/2022-08-01/subscription/client.go index 9b6b77e38d7..e39cec765af 100644 --- a/resource-manager/apimanagement/2022-08-01/subscription/client.go +++ b/resource-manager/apimanagement/2022-08-01/subscription/client.go @@ -1,18 +1,26 @@ package subscription -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SubscriptionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewSubscriptionClientWithBaseURI(endpoint string) SubscriptionClient { - return SubscriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewSubscriptionClientWithBaseURI(api sdkEnv.Api) (*SubscriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "subscription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SubscriptionClient: %+v", err) } + + return &SubscriptionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/subscription/constants.go b/resource-manager/apimanagement/2022-08-01/subscription/constants.go index 720ab13b7df..71ac415eaca 100644 --- a/resource-manager/apimanagement/2022-08-01/subscription/constants.go +++ b/resource-manager/apimanagement/2022-08-01/subscription/constants.go @@ -1,6 +1,10 @@ package subscription -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAppType() []string { } } +func (s *AppType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAppType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAppType(input string) (*AppType, error) { vals := map[string]AppType{ "developerportal": AppTypeDeveloperPortal, @@ -55,6 +72,19 @@ func PossibleValuesForSubscriptionState() []string { } } +func (s *SubscriptionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSubscriptionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSubscriptionState(input string) (*SubscriptionState, error) { vals := map[string]SubscriptionState{ "active": SubscriptionStateActive, diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/subscription/method_createorupdate.go new file mode 100644 index 00000000000..d69e1efca03 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/subscription/method_createorupdate.go @@ -0,0 +1,92 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +type CreateOrUpdateOperationOptions struct { + AppType *AppType + IfMatch *string + Notify *bool +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.AppType != nil { + out.Append("appType", fmt.Sprintf("%v", *o.AppType)) + } + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// CreateOrUpdate ... +func (c SubscriptionClient) CreateOrUpdate(ctx context.Context, id Subscriptions2Id, input SubscriptionCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/subscription/method_createorupdate_autorest.go deleted file mode 100644 index a0ed6895a04..00000000000 --- a/resource-manager/apimanagement/2022-08-01/subscription/method_createorupdate_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *SubscriptionContract -} - -type CreateOrUpdateOperationOptions struct { - AppType *AppType - IfMatch *string - Notify *bool -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.AppType != nil { - out["appType"] = *o.AppType - } - - if o.Notify != nil { - out["notify"] = *o.Notify - } - - return out -} - -// CreateOrUpdate ... -func (c SubscriptionClient) CreateOrUpdate(ctx context.Context, id Subscriptions2Id, input SubscriptionCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c SubscriptionClient) preparerForCreateOrUpdate(ctx context.Context, id Subscriptions2Id, input SubscriptionCreateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_delete.go b/resource-manager/apimanagement/2022-08-01/subscription/method_delete.go new file mode 100644 index 00000000000..a14c0ad04e1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/subscription/method_delete.go @@ -0,0 +1,76 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c SubscriptionClient) Delete(ctx context.Context, id Subscriptions2Id, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/subscription/method_delete_autorest.go deleted file mode 100644 index e9f7fe282a7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/subscription/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c SubscriptionClient) Delete(ctx context.Context, id Subscriptions2Id, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c SubscriptionClient) preparerForDelete(ctx context.Context, id Subscriptions2Id, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_get.go b/resource-manager/apimanagement/2022-08-01/subscription/method_get.go new file mode 100644 index 00000000000..8aabef6e59e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/subscription/method_get.go @@ -0,0 +1,51 @@ +package subscription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +// Get ... +func (c SubscriptionClient) Get(ctx context.Context, id Subscriptions2Id) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/subscription/method_get_autorest.go deleted file mode 100644 index 5c650032d00..00000000000 --- a/resource-manager/apimanagement/2022-08-01/subscription/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *SubscriptionContract -} - -// Get ... -func (c SubscriptionClient) Get(ctx context.Context, id Subscriptions2Id) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c SubscriptionClient) preparerForGet(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/subscription/method_getentitytag.go new file mode 100644 index 00000000000..70173b87ce1 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/subscription/method_getentitytag.go @@ -0,0 +1,46 @@ +package subscription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c SubscriptionClient) GetEntityTag(ctx context.Context, id Subscriptions2Id) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/subscription/method_getentitytag_autorest.go deleted file mode 100644 index e088e054ada..00000000000 --- a/resource-manager/apimanagement/2022-08-01/subscription/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c SubscriptionClient) GetEntityTag(ctx context.Context, id Subscriptions2Id) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c SubscriptionClient) preparerForGetEntityTag(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_list.go b/resource-manager/apimanagement/2022-08-01/subscription/method_list.go new file mode 100644 index 00000000000..5a583cace4b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/subscription/method_list.go @@ -0,0 +1,125 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SubscriptionContract +} + +type ListCompleteResult struct { + Items []SubscriptionContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c SubscriptionClient) List(ctx context.Context, id ServiceId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/subscriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SubscriptionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c SubscriptionClient) ListComplete(ctx context.Context, id ServiceId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]SubscriptionContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_list_autorest.go b/resource-manager/apimanagement/2022-08-01/subscription/method_list_autorest.go deleted file mode 100644 index 7cf7939d59c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/subscription/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package subscription - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]SubscriptionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []SubscriptionContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c SubscriptionClient) List(ctx context.Context, id ServiceId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c SubscriptionClient) preparerForList(ctx context.Context, id ServiceId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/subscriptions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c SubscriptionClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []SubscriptionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c SubscriptionClient) ListComplete(ctx context.Context, id ServiceId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]SubscriptionContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_listsecrets.go b/resource-manager/apimanagement/2022-08-01/subscription/method_listsecrets.go new file mode 100644 index 00000000000..f204e457940 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/subscription/method_listsecrets.go @@ -0,0 +1,52 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionKeysContract +} + +// ListSecrets ... +func (c SubscriptionClient) ListSecrets(ctx context.Context, id Subscriptions2Id) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_listsecrets_autorest.go b/resource-manager/apimanagement/2022-08-01/subscription/method_listsecrets_autorest.go deleted file mode 100644 index 0e76aeca560..00000000000 --- a/resource-manager/apimanagement/2022-08-01/subscription/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package subscription - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *SubscriptionKeysContract -} - -// ListSecrets ... -func (c SubscriptionClient) ListSecrets(ctx context.Context, id Subscriptions2Id) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c SubscriptionClient) preparerForListSecrets(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_regenerateprimarykey.go b/resource-manager/apimanagement/2022-08-01/subscription/method_regenerateprimarykey.go new file mode 100644 index 00000000000..d2ae52bbb7c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/subscription/method_regenerateprimarykey.go @@ -0,0 +1,47 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegeneratePrimaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegeneratePrimaryKey ... +func (c SubscriptionClient) RegeneratePrimaryKey(ctx context.Context, id Subscriptions2Id) (result RegeneratePrimaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regeneratePrimaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_regenerateprimarykey_autorest.go b/resource-manager/apimanagement/2022-08-01/subscription/method_regenerateprimarykey_autorest.go deleted file mode 100644 index 846602df9ec..00000000000 --- a/resource-manager/apimanagement/2022-08-01/subscription/method_regenerateprimarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package subscription - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegeneratePrimaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegeneratePrimaryKey ... -func (c SubscriptionClient) RegeneratePrimaryKey(ctx context.Context, id Subscriptions2Id) (result RegeneratePrimaryKeyOperationResponse, err error) { - req, err := c.preparerForRegeneratePrimaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegeneratePrimaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegeneratePrimaryKey prepares the RegeneratePrimaryKey request. -func (c SubscriptionClient) preparerForRegeneratePrimaryKey(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regeneratePrimaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegeneratePrimaryKey handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForRegeneratePrimaryKey(resp *http.Response) (result RegeneratePrimaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_regeneratesecondarykey.go b/resource-manager/apimanagement/2022-08-01/subscription/method_regeneratesecondarykey.go new file mode 100644 index 00000000000..7e3998ced00 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/subscription/method_regeneratesecondarykey.go @@ -0,0 +1,47 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateSecondaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegenerateSecondaryKey ... +func (c SubscriptionClient) RegenerateSecondaryKey(ctx context.Context, id Subscriptions2Id) (result RegenerateSecondaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateSecondaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_regeneratesecondarykey_autorest.go b/resource-manager/apimanagement/2022-08-01/subscription/method_regeneratesecondarykey_autorest.go deleted file mode 100644 index 44faa9e3409..00000000000 --- a/resource-manager/apimanagement/2022-08-01/subscription/method_regeneratesecondarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package subscription - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegenerateSecondaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegenerateSecondaryKey ... -func (c SubscriptionClient) RegenerateSecondaryKey(ctx context.Context, id Subscriptions2Id) (result RegenerateSecondaryKeyOperationResponse, err error) { - req, err := c.preparerForRegenerateSecondaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegenerateSecondaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegenerateSecondaryKey prepares the RegenerateSecondaryKey request. -func (c SubscriptionClient) preparerForRegenerateSecondaryKey(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateSecondaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegenerateSecondaryKey handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForRegenerateSecondaryKey(resp *http.Response) (result RegenerateSecondaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_update.go b/resource-manager/apimanagement/2022-08-01/subscription/method_update.go new file mode 100644 index 00000000000..f01dc48db34 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/subscription/method_update.go @@ -0,0 +1,91 @@ +package subscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +type UpdateOperationOptions struct { + AppType *AppType + IfMatch *string + Notify *bool +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.AppType != nil { + out.Append("appType", fmt.Sprintf("%v", *o.AppType)) + } + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// Update ... +func (c SubscriptionClient) Update(ctx context.Context, id Subscriptions2Id, input SubscriptionUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/subscription/method_update_autorest.go deleted file mode 100644 index 000a788ba77..00000000000 --- a/resource-manager/apimanagement/2022-08-01/subscription/method_update_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *SubscriptionContract -} - -type UpdateOperationOptions struct { - AppType *AppType - IfMatch *string - Notify *bool -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.AppType != nil { - out["appType"] = *o.AppType - } - - if o.Notify != nil { - out["notify"] = *o.Notify - } - - return out -} - -// Update ... -func (c SubscriptionClient) Update(ctx context.Context, id Subscriptions2Id, input SubscriptionUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c SubscriptionClient) preparerForUpdate(ctx context.Context, id Subscriptions2Id, input SubscriptionUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_usersubscriptionget.go b/resource-manager/apimanagement/2022-08-01/subscription/method_usersubscriptionget.go new file mode 100644 index 00000000000..7553f7391d9 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/subscription/method_usersubscriptionget.go @@ -0,0 +1,51 @@ +package subscription + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserSubscriptionGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SubscriptionContract +} + +// UserSubscriptionGet ... +func (c SubscriptionClient) UserSubscriptionGet(ctx context.Context, id UserSubscriptions2Id) (result UserSubscriptionGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/subscription/method_usersubscriptionget_autorest.go b/resource-manager/apimanagement/2022-08-01/subscription/method_usersubscriptionget_autorest.go deleted file mode 100644 index cc4667c6c9c..00000000000 --- a/resource-manager/apimanagement/2022-08-01/subscription/method_usersubscriptionget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package subscription - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserSubscriptionGetOperationResponse struct { - HttpResponse *http.Response - Model *SubscriptionContract -} - -// UserSubscriptionGet ... -func (c SubscriptionClient) UserSubscriptionGet(ctx context.Context, id UserSubscriptions2Id) (result UserSubscriptionGetOperationResponse, err error) { - req, err := c.preparerForUserSubscriptionGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "UserSubscriptionGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "UserSubscriptionGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserSubscriptionGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "subscription.SubscriptionClient", "UserSubscriptionGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserSubscriptionGet prepares the UserSubscriptionGet request. -func (c SubscriptionClient) preparerForUserSubscriptionGet(ctx context.Context, id UserSubscriptions2Id) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserSubscriptionGet handles the response to the UserSubscriptionGet request. The method always -// closes the http.Response Body. -func (c SubscriptionClient) responderForUserSubscriptionGet(resp *http.Response) (result UserSubscriptionGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tag/client.go b/resource-manager/apimanagement/2022-08-01/tag/client.go index 859dfa3f85e..18edf105ea7 100644 --- a/resource-manager/apimanagement/2022-08-01/tag/client.go +++ b/resource-manager/apimanagement/2022-08-01/tag/client.go @@ -1,18 +1,26 @@ package tag -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TagClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTagClientWithBaseURI(endpoint string) TagClient { - return TagClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTagClientWithBaseURI(api sdkEnv.Api) (*TagClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tag", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TagClient: %+v", err) } + + return &TagClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/tag/method_createorupdate.go new file mode 100644 index 00000000000..b7c955b4480 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tag/method_createorupdate.go @@ -0,0 +1,85 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c TagClient) CreateOrUpdate(ctx context.Context, id TagId, input TagCreateUpdateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/tag/method_createorupdate_autorest.go deleted file mode 100644 index 48f02bbd515..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tag/method_createorupdate_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package tag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c TagClient) CreateOrUpdate(ctx context.Context, id TagId, input TagCreateUpdateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c TagClient) preparerForCreateOrUpdate(ctx context.Context, id TagId, input TagCreateUpdateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c TagClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_delete.go b/resource-manager/apimanagement/2022-08-01/tag/method_delete.go new file mode 100644 index 00000000000..01b72128471 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tag/method_delete.go @@ -0,0 +1,76 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Delete ... +func (c TagClient) Delete(ctx context.Context, id TagId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/tag/method_delete_autorest.go deleted file mode 100644 index fad1b450db3..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tag/method_delete_autorest.go +++ /dev/null @@ -1,95 +0,0 @@ -package tag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c TagClient) Delete(ctx context.Context, id TagId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c TagClient) preparerForDelete(ctx context.Context, id TagId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c TagClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_get.go b/resource-manager/apimanagement/2022-08-01/tag/method_get.go new file mode 100644 index 00000000000..340922be21e --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tag/method_get.go @@ -0,0 +1,51 @@ +package tag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +// Get ... +func (c TagClient) Get(ctx context.Context, id TagId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/tag/method_get_autorest.go deleted file mode 100644 index 0a9cd67ede7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tag/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package tag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -// Get ... -func (c TagClient) Get(ctx context.Context, id TagId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c TagClient) preparerForGet(ctx context.Context, id TagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c TagClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_getentitystate.go b/resource-manager/apimanagement/2022-08-01/tag/method_getentitystate.go new file mode 100644 index 00000000000..b56c0026a99 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tag/method_getentitystate.go @@ -0,0 +1,46 @@ +package tag + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityStateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityState ... +func (c TagClient) GetEntityState(ctx context.Context, id TagId) (result GetEntityStateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_getentitystate_autorest.go b/resource-manager/apimanagement/2022-08-01/tag/method_getentitystate_autorest.go deleted file mode 100644 index a058ebd7e9b..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tag/method_getentitystate_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package tag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityStateOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityState ... -func (c TagClient) GetEntityState(ctx context.Context, id TagId) (result GetEntityStateOperationResponse, err error) { - req, err := c.preparerForGetEntityState(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "GetEntityState", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "GetEntityState", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityState(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "GetEntityState", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityState prepares the GetEntityState request. -func (c TagClient) preparerForGetEntityState(ctx context.Context, id TagId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityState handles the response to the GetEntityState request. The method always -// closes the http.Response Body. -func (c TagClient) responderForGetEntityState(resp *http.Response) (result GetEntityStateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/tag/method_listbyservice.go new file mode 100644 index 00000000000..110e8d13d3c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tag/method_listbyservice.go @@ -0,0 +1,129 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagContract +} + +type ListByServiceCompleteResult struct { + Items []TagContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Scope *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Scope != nil { + out.Append("scope", fmt.Sprintf("%v", *o.Scope)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c TagClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tags", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c TagClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TagClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TagContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]TagContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/tag/method_listbyservice_autorest.go deleted file mode 100644 index 1e241c14508..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tag/method_listbyservice_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package tag - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]TagContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []TagContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Scope *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Scope != nil { - out["scope"] = *o.Scope - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c TagClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c TagClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tags", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c TagClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c TagClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []TagContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c TagClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TagClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TagContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]TagContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_update.go b/resource-manager/apimanagement/2022-08-01/tag/method_update.go new file mode 100644 index 00000000000..a301e054137 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tag/method_update.go @@ -0,0 +1,84 @@ +package tag + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TagContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c TagClient) Update(ctx context.Context, id TagId, input TagCreateUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tag/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/tag/method_update_autorest.go deleted file mode 100644 index 6a13a61027d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tag/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package tag - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *TagContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c TagClient) Update(ctx context.Context, id TagId, input TagCreateUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tag.TagClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c TagClient) preparerForUpdate(ctx context.Context, id TagId, input TagCreateUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c TagClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tagresource/client.go b/resource-manager/apimanagement/2022-08-01/tagresource/client.go index 10f42e3996e..7e160526668 100644 --- a/resource-manager/apimanagement/2022-08-01/tagresource/client.go +++ b/resource-manager/apimanagement/2022-08-01/tagresource/client.go @@ -1,18 +1,26 @@ package tagresource -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TagResourceClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTagResourceClientWithBaseURI(endpoint string) TagResourceClient { - return TagResourceClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTagResourceClientWithBaseURI(api sdkEnv.Api) (*TagResourceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tagresource", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TagResourceClient: %+v", err) } + + return &TagResourceClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/tagresource/constants.go b/resource-manager/apimanagement/2022-08-01/tagresource/constants.go index 97e2cdd7620..93cbbc002a0 100644 --- a/resource-manager/apimanagement/2022-08-01/tagresource/constants.go +++ b/resource-manager/apimanagement/2022-08-01/tagresource/constants.go @@ -1,6 +1,10 @@ package tagresource -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForApiType() []string { } } +func (s *ApiType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApiType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseApiType(input string) (*ApiType, error) { vals := map[string]ApiType{ "graphql": ApiTypeGraphql, @@ -53,6 +70,19 @@ func PossibleValuesForBearerTokenSendingMethods() []string { } } +func (s *BearerTokenSendingMethods) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBearerTokenSendingMethods(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBearerTokenSendingMethods(input string) (*BearerTokenSendingMethods, error) { vals := map[string]BearerTokenSendingMethods{ "authorizationheader": BearerTokenSendingMethodsAuthorizationHeader, @@ -81,6 +111,19 @@ func PossibleValuesForProductState() []string { } } +func (s *ProductState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProductState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProductState(input string) (*ProductState, error) { vals := map[string]ProductState{ "notpublished": ProductStateNotPublished, @@ -113,6 +156,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "http": ProtocolHTTP, diff --git a/resource-manager/apimanagement/2022-08-01/tagresource/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/tagresource/method_listbyservice.go new file mode 100644 index 00000000000..c896fcb2dfc --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tagresource/method_listbyservice.go @@ -0,0 +1,125 @@ +package tagresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TagResourceContract +} + +type ListByServiceCompleteResult struct { + Items []TagResourceContract +} + +type ListByServiceOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c TagResourceClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tagResources", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TagResourceContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c TagResourceClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TagResourceClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TagResourceContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]TagResourceContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tagresource/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/tagresource/method_listbyservice_autorest.go deleted file mode 100644 index b86fedc24e7..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tagresource/method_listbyservice_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package tagresource - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]TagResourceContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []TagResourceContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c TagResourceClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c TagResourceClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tagResources", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c TagResourceClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c TagResourceClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []TagResourceContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tagresource.TagResourceClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c TagResourceClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TagResourceContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TagResourceClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TagResourceContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]TagResourceContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/client.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/client.go index 7a6208f3d69..cd60e8064da 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/client.go +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/client.go @@ -1,18 +1,26 @@ package tenantaccess -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TenantAccessClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTenantAccessClientWithBaseURI(endpoint string) TenantAccessClient { - return TenantAccessClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTenantAccessClientWithBaseURI(api sdkEnv.Api) (*TenantAccessClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tenantaccess", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TenantAccessClient: %+v", err) } + + return &TenantAccessClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/constants.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/constants.go index 3fe8372dbcb..0a9a890aae2 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/constants.go +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/constants.go @@ -1,6 +1,10 @@ package tenantaccess -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAccessIdName() []string { } } +func (s *AccessIdName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessIdName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAccessIdName(input string) (*AccessIdName, error) { vals := map[string]AccessIdName{ "access": AccessIdNameAccess, diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_create.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_create.go new file mode 100644 index 00000000000..cf2902da389 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_create.go @@ -0,0 +1,84 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationContract +} + +type CreateOperationOptions struct { + IfMatch *string +} + +func DefaultCreateOperationOptions() CreateOperationOptions { + return CreateOperationOptions{} +} + +func (o CreateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Create ... +func (c TenantAccessClient) Create(ctx context.Context, id AccessId, input AccessInformationCreateParameters, options CreateOperationOptions) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_create_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_create_autorest.go deleted file mode 100644 index cc2d34137c2..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_create_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package tenantaccess - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOperationResponse struct { - HttpResponse *http.Response - Model *AccessInformationContract -} - -type CreateOperationOptions struct { - IfMatch *string -} - -func DefaultCreateOperationOptions() CreateOperationOptions { - return CreateOperationOptions{} -} - -func (o CreateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Create ... -func (c TenantAccessClient) Create(ctx context.Context, id AccessId, input AccessInformationCreateParameters, options CreateOperationOptions) (result CreateOperationResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Create", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Create", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreate prepares the Create request. -func (c TenantAccessClient) preparerForCreate(ctx context.Context, id AccessId, input AccessInformationCreateParameters, options CreateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreate handles the response to the Create request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_get.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_get.go new file mode 100644 index 00000000000..b1f7d18cc3b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_get.go @@ -0,0 +1,51 @@ +package tenantaccess + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationContract +} + +// Get ... +func (c TenantAccessClient) Get(ctx context.Context, id AccessId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_get_autorest.go deleted file mode 100644 index 3a070ae9892..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package tenantaccess - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *AccessInformationContract -} - -// Get ... -func (c TenantAccessClient) Get(ctx context.Context, id AccessId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c TenantAccessClient) preparerForGet(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_getentitytag.go new file mode 100644 index 00000000000..d1d42ee00fd --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_getentitytag.go @@ -0,0 +1,46 @@ +package tenantaccess + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c TenantAccessClient) GetEntityTag(ctx context.Context, id AccessId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_getentitytag_autorest.go deleted file mode 100644 index 8300d23c3f6..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package tenantaccess - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c TenantAccessClient) GetEntityTag(ctx context.Context, id AccessId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c TenantAccessClient) preparerForGetEntityTag(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listbyservice.go new file mode 100644 index 00000000000..d332a10b9d5 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listbyservice.go @@ -0,0 +1,117 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AccessInformationContract +} + +type ListByServiceCompleteResult struct { + Items []AccessInformationContract +} + +type ListByServiceOperationOptions struct { + Filter *string +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + return &out +} + +// ListByService ... +func (c TenantAccessClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tenant", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AccessInformationContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c TenantAccessClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AccessInformationContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TenantAccessClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AccessInformationContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]AccessInformationContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listbyservice_autorest.go deleted file mode 100644 index 8e83891260f..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listbyservice_autorest.go +++ /dev/null @@ -1,215 +0,0 @@ -package tenantaccess - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]AccessInformationContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []AccessInformationContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// ListByService ... -func (c TenantAccessClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c TenantAccessClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/tenant", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c TenantAccessClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []AccessInformationContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c TenantAccessClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, AccessInformationContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TenantAccessClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate AccessInformationContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]AccessInformationContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listsecrets.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listsecrets.go new file mode 100644 index 00000000000..67b0b5f3a0b --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listsecrets.go @@ -0,0 +1,52 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationSecretsContract +} + +// ListSecrets ... +func (c TenantAccessClient) ListSecrets(ctx context.Context, id AccessId) (result ListSecretsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSecrets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listsecrets_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listsecrets_autorest.go deleted file mode 100644 index 2a1515ff216..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_listsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package tenantaccess - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListSecretsOperationResponse struct { - HttpResponse *http.Response - Model *AccessInformationSecretsContract -} - -// ListSecrets ... -func (c TenantAccessClient) ListSecrets(ctx context.Context, id AccessId) (result ListSecretsOperationResponse, err error) { - req, err := c.preparerForListSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "ListSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSecrets prepares the ListSecrets request. -func (c TenantAccessClient) preparerForListSecrets(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSecrets handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regenerateprimarykey.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regenerateprimarykey.go new file mode 100644 index 00000000000..6d6aa0f1ccf --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regenerateprimarykey.go @@ -0,0 +1,47 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegeneratePrimaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegeneratePrimaryKey ... +func (c TenantAccessClient) RegeneratePrimaryKey(ctx context.Context, id AccessId) (result RegeneratePrimaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regeneratePrimaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regenerateprimarykey_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regenerateprimarykey_autorest.go deleted file mode 100644 index 18cb875e657..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regenerateprimarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package tenantaccess - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegeneratePrimaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegeneratePrimaryKey ... -func (c TenantAccessClient) RegeneratePrimaryKey(ctx context.Context, id AccessId) (result RegeneratePrimaryKeyOperationResponse, err error) { - req, err := c.preparerForRegeneratePrimaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegeneratePrimaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegeneratePrimaryKey prepares the RegeneratePrimaryKey request. -func (c TenantAccessClient) preparerForRegeneratePrimaryKey(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regeneratePrimaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegeneratePrimaryKey handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForRegeneratePrimaryKey(resp *http.Response) (result RegeneratePrimaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regeneratesecondarykey.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regeneratesecondarykey.go new file mode 100644 index 00000000000..0fd0b8fd296 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regeneratesecondarykey.go @@ -0,0 +1,47 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateSecondaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegenerateSecondaryKey ... +func (c TenantAccessClient) RegenerateSecondaryKey(ctx context.Context, id AccessId) (result RegenerateSecondaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateSecondaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regeneratesecondarykey_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regeneratesecondarykey_autorest.go deleted file mode 100644 index 60839456731..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_regeneratesecondarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package tenantaccess - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegenerateSecondaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegenerateSecondaryKey ... -func (c TenantAccessClient) RegenerateSecondaryKey(ctx context.Context, id AccessId) (result RegenerateSecondaryKeyOperationResponse, err error) { - req, err := c.preparerForRegenerateSecondaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegenerateSecondaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegenerateSecondaryKey prepares the RegenerateSecondaryKey request. -func (c TenantAccessClient) preparerForRegenerateSecondaryKey(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateSecondaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegenerateSecondaryKey handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForRegenerateSecondaryKey(resp *http.Response) (result RegenerateSecondaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_update.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_update.go new file mode 100644 index 00000000000..255888180b3 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_update.go @@ -0,0 +1,84 @@ +package tenantaccess + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessInformationContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c TenantAccessClient) Update(ctx context.Context, id AccessId, input AccessInformationUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/method_update_autorest.go deleted file mode 100644 index 87eb5439426..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package tenantaccess - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *AccessInformationContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c TenantAccessClient) Update(ctx context.Context, id AccessId, input AccessInformationUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccess.TenantAccessClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c TenantAccessClient) preparerForUpdate(ctx context.Context, id AccessId, input AccessInformationUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c TenantAccessClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/client.go b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/client.go index 015bab0d24f..a466ef34ccf 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/client.go +++ b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/client.go @@ -1,18 +1,26 @@ package tenantaccessgit -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TenantAccessGitClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTenantAccessGitClientWithBaseURI(endpoint string) TenantAccessGitClient { - return TenantAccessGitClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTenantAccessGitClientWithBaseURI(api sdkEnv.Api) (*TenantAccessGitClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tenantaccessgit", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TenantAccessGitClient: %+v", err) } + + return &TenantAccessGitClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/constants.go b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/constants.go index b35272377f3..0423218f1c5 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/constants.go +++ b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/constants.go @@ -1,6 +1,10 @@ package tenantaccessgit -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAccessIdName() []string { } } +func (s *AccessIdName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessIdName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAccessIdName(input string) (*AccessIdName, error) { vals := map[string]AccessIdName{ "access": AccessIdNameAccess, diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regenerateprimarykey.go b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regenerateprimarykey.go new file mode 100644 index 00000000000..5b6c503576f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regenerateprimarykey.go @@ -0,0 +1,47 @@ +package tenantaccessgit + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegeneratePrimaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegeneratePrimaryKey ... +func (c TenantAccessGitClient) RegeneratePrimaryKey(ctx context.Context, id AccessId) (result RegeneratePrimaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/git/regeneratePrimaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regenerateprimarykey_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regenerateprimarykey_autorest.go deleted file mode 100644 index 4783b820c9d..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regenerateprimarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package tenantaccessgit - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegeneratePrimaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegeneratePrimaryKey ... -func (c TenantAccessGitClient) RegeneratePrimaryKey(ctx context.Context, id AccessId) (result RegeneratePrimaryKeyOperationResponse, err error) { - req, err := c.preparerForRegeneratePrimaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegeneratePrimaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegeneratePrimaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegeneratePrimaryKey prepares the RegeneratePrimaryKey request. -func (c TenantAccessGitClient) preparerForRegeneratePrimaryKey(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/git/regeneratePrimaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegeneratePrimaryKey handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (c TenantAccessGitClient) responderForRegeneratePrimaryKey(resp *http.Response) (result RegeneratePrimaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regeneratesecondarykey.go b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regeneratesecondarykey.go new file mode 100644 index 00000000000..fa55bca8deb --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regeneratesecondarykey.go @@ -0,0 +1,47 @@ +package tenantaccessgit + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateSecondaryKeyOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegenerateSecondaryKey ... +func (c TenantAccessGitClient) RegenerateSecondaryKey(ctx context.Context, id AccessId) (result RegenerateSecondaryKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/git/regenerateSecondaryKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regeneratesecondarykey_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regeneratesecondarykey_autorest.go deleted file mode 100644 index d0375fcb447..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/method_regeneratesecondarykey_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package tenantaccessgit - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegenerateSecondaryKeyOperationResponse struct { - HttpResponse *http.Response -} - -// RegenerateSecondaryKey ... -func (c TenantAccessGitClient) RegenerateSecondaryKey(ctx context.Context, id AccessId) (result RegenerateSecondaryKeyOperationResponse, err error) { - req, err := c.preparerForRegenerateSecondaryKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegenerateSecondaryKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantaccessgit.TenantAccessGitClient", "RegenerateSecondaryKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegenerateSecondaryKey prepares the RegenerateSecondaryKey request. -func (c TenantAccessGitClient) preparerForRegenerateSecondaryKey(ctx context.Context, id AccessId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/git/regenerateSecondaryKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegenerateSecondaryKey handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (c TenantAccessGitClient) responderForRegenerateSecondaryKey(resp *http.Response) (result RegenerateSecondaryKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/client.go b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/client.go index b4cf4a17cf2..1c9a2f1304b 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/client.go +++ b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/client.go @@ -1,18 +1,26 @@ package tenantconfiguration -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TenantConfigurationClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTenantConfigurationClientWithBaseURI(endpoint string) TenantConfigurationClient { - return TenantConfigurationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTenantConfigurationClientWithBaseURI(api sdkEnv.Api) (*TenantConfigurationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tenantconfiguration", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TenantConfigurationClient: %+v", err) } + + return &TenantConfigurationClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/constants.go b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/constants.go index 68f7b36814f..c896fa35bce 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/constants.go +++ b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/constants.go @@ -1,6 +1,10 @@ package tenantconfiguration -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -23,6 +27,19 @@ func PossibleValuesForAsyncOperationStatus() []string { } } +func (s *AsyncOperationStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAsyncOperationStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAsyncOperationStatus(input string) (*AsyncOperationStatus, error) { vals := map[string]AsyncOperationStatus{ "failed": AsyncOperationStatusFailed, diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_deploy.go b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_deploy.go new file mode 100644 index 00000000000..e71bf7ad1b6 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_deploy.go @@ -0,0 +1,74 @@ +package tenantconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeployOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Deploy ... +func (c TenantConfigurationClient) Deploy(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (result DeployOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/tenant/configuration/deploy", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeployThenPoll performs Deploy then polls until it's completed +func (c TenantConfigurationClient) DeployThenPoll(ctx context.Context, id ServiceId, input DeployConfigurationParameters) error { + result, err := c.Deploy(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Deploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Deploy: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_deploy_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_deploy_autorest.go deleted file mode 100644 index 659a8ef5465..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_deploy_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package tenantconfiguration - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeployOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Deploy ... -func (c TenantConfigurationClient) Deploy(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (result DeployOperationResponse, err error) { - req, err := c.preparerForDeploy(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Deploy", nil, "Failure preparing request") - return - } - - result, err = c.senderForDeploy(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Deploy", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeployThenPoll performs Deploy then polls until it's completed -func (c TenantConfigurationClient) DeployThenPoll(ctx context.Context, id ServiceId, input DeployConfigurationParameters) error { - result, err := c.Deploy(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Deploy: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Deploy: %+v", err) - } - - return nil -} - -// preparerForDeploy prepares the Deploy request. -func (c TenantConfigurationClient) preparerForDeploy(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/tenant/configuration/deploy", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDeploy sends the Deploy request. The method will close the -// http.Response Body if it receives an error. -func (c TenantConfigurationClient) senderForDeploy(ctx context.Context, req *http.Request) (future DeployOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_save.go b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_save.go new file mode 100644 index 00000000000..c261c455120 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_save.go @@ -0,0 +1,74 @@ +package tenantconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SaveOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Save ... +func (c TenantConfigurationClient) Save(ctx context.Context, id ServiceId, input SaveConfigurationParameter) (result SaveOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/tenant/configuration/save", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// SaveThenPoll performs Save then polls until it's completed +func (c TenantConfigurationClient) SaveThenPoll(ctx context.Context, id ServiceId, input SaveConfigurationParameter) error { + result, err := c.Save(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Save: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Save: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_save_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_save_autorest.go deleted file mode 100644 index 989e1db8216..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_save_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package tenantconfiguration - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SaveOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Save ... -func (c TenantConfigurationClient) Save(ctx context.Context, id ServiceId, input SaveConfigurationParameter) (result SaveOperationResponse, err error) { - req, err := c.preparerForSave(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Save", nil, "Failure preparing request") - return - } - - result, err = c.senderForSave(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Save", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// SaveThenPoll performs Save then polls until it's completed -func (c TenantConfigurationClient) SaveThenPoll(ctx context.Context, id ServiceId, input SaveConfigurationParameter) error { - result, err := c.Save(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Save: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Save: %+v", err) - } - - return nil -} - -// preparerForSave prepares the Save request. -func (c TenantConfigurationClient) preparerForSave(ctx context.Context, id ServiceId, input SaveConfigurationParameter) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/tenant/configuration/save", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForSave sends the Save request. The method will close the -// http.Response Body if it receives an error. -func (c TenantConfigurationClient) senderForSave(ctx context.Context, req *http.Request) (future SaveOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_validate.go b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_validate.go new file mode 100644 index 00000000000..26401e0e77f --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_validate.go @@ -0,0 +1,74 @@ +package tenantconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Validate ... +func (c TenantConfigurationClient) Validate(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (result ValidateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/tenant/configuration/validate", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ValidateThenPoll performs Validate then polls until it's completed +func (c TenantConfigurationClient) ValidateThenPoll(ctx context.Context, id ServiceId, input DeployConfigurationParameters) error { + result, err := c.Validate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Validate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Validate: %+v", err) + } + + return nil +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_validate_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_validate_autorest.go deleted file mode 100644 index 64e2904b423..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/method_validate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package tenantconfiguration - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ValidateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Validate ... -func (c TenantConfigurationClient) Validate(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (result ValidateOperationResponse, err error) { - req, err := c.preparerForValidate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Validate", nil, "Failure preparing request") - return - } - - result, err = c.senderForValidate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "Validate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ValidateThenPoll performs Validate then polls until it's completed -func (c TenantConfigurationClient) ValidateThenPoll(ctx context.Context, id ServiceId, input DeployConfigurationParameters) error { - result, err := c.Validate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Validate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Validate: %+v", err) - } - - return nil -} - -// preparerForValidate prepares the Validate request. -func (c TenantConfigurationClient) preparerForValidate(ctx context.Context, id ServiceId, input DeployConfigurationParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/tenant/configuration/validate", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForValidate sends the Validate request. The method will close the -// http.Response Body if it receives an error. -func (c TenantConfigurationClient) senderForValidate(ctx context.Context, req *http.Request) (future ValidateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/client.go b/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/client.go index b005ecbaebc..5f4816a7f3c 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/client.go +++ b/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/client.go @@ -1,18 +1,26 @@ package tenantconfigurationsyncstate -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TenantConfigurationSyncStateClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTenantConfigurationSyncStateClientWithBaseURI(endpoint string) TenantConfigurationSyncStateClient { - return TenantConfigurationSyncStateClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTenantConfigurationSyncStateClientWithBaseURI(api sdkEnv.Api) (*TenantConfigurationSyncStateClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tenantconfigurationsyncstate", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TenantConfigurationSyncStateClient: %+v", err) } + + return &TenantConfigurationSyncStateClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate.go b/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate.go new file mode 100644 index 00000000000..4ea64f710b0 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate.go @@ -0,0 +1,52 @@ +package tenantconfigurationsyncstate + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TenantConfigurationGetSyncStateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TenantConfigurationSyncStateContract +} + +// TenantConfigurationGetSyncState ... +func (c TenantConfigurationSyncStateClient) TenantConfigurationGetSyncState(ctx context.Context, id ServiceId) (result TenantConfigurationGetSyncStateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/tenant/configuration/syncState", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate_autorest.go deleted file mode 100644 index 8761b63aaa1..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/method_tenantconfigurationgetsyncstate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package tenantconfigurationsyncstate - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TenantConfigurationGetSyncStateOperationResponse struct { - HttpResponse *http.Response - Model *TenantConfigurationSyncStateContract -} - -// TenantConfigurationGetSyncState ... -func (c TenantConfigurationSyncStateClient) TenantConfigurationGetSyncState(ctx context.Context, id ServiceId) (result TenantConfigurationGetSyncStateOperationResponse, err error) { - req, err := c.preparerForTenantConfigurationGetSyncState(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfigurationsyncstate.TenantConfigurationSyncStateClient", "TenantConfigurationGetSyncState", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfigurationsyncstate.TenantConfigurationSyncStateClient", "TenantConfigurationGetSyncState", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTenantConfigurationGetSyncState(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantconfigurationsyncstate.TenantConfigurationSyncStateClient", "TenantConfigurationGetSyncState", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTenantConfigurationGetSyncState prepares the TenantConfigurationGetSyncState request. -func (c TenantConfigurationSyncStateClient) preparerForTenantConfigurationGetSyncState(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/tenant/configuration/syncState", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTenantConfigurationGetSyncState handles the response to the TenantConfigurationGetSyncState request. The method always -// closes the http.Response Body. -func (c TenantConfigurationSyncStateClient) responderForTenantConfigurationGetSyncState(resp *http.Response) (result TenantConfigurationGetSyncStateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantsettings/client.go b/resource-manager/apimanagement/2022-08-01/tenantsettings/client.go index 1e3e819d2fe..bf14c2adc9f 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantsettings/client.go +++ b/resource-manager/apimanagement/2022-08-01/tenantsettings/client.go @@ -1,18 +1,26 @@ package tenantsettings -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type TenantSettingsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewTenantSettingsClientWithBaseURI(endpoint string) TenantSettingsClient { - return TenantSettingsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewTenantSettingsClientWithBaseURI(api sdkEnv.Api) (*TenantSettingsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "tenantsettings", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TenantSettingsClient: %+v", err) } + + return &TenantSettingsClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/tenantsettings/method_get.go b/resource-manager/apimanagement/2022-08-01/tenantsettings/method_get.go new file mode 100644 index 00000000000..9f42162d776 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantsettings/method_get.go @@ -0,0 +1,52 @@ +package tenantsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TenantSettingsContract +} + +// Get ... +func (c TenantSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/settings/public", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantsettings/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantsettings/method_get_autorest.go deleted file mode 100644 index 5fe75ae615e..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantsettings/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package tenantsettings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *TenantSettingsContract -} - -// Get ... -func (c TenantSettingsClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c TenantSettingsClient) preparerForGet(ctx context.Context, id ServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/settings/public", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c TenantSettingsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/tenantsettings/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/tenantsettings/method_listbyservice.go new file mode 100644 index 00000000000..6d94b36d733 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/tenantsettings/method_listbyservice.go @@ -0,0 +1,117 @@ +package tenantsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TenantSettingsContract +} + +type ListByServiceCompleteResult struct { + Items []TenantSettingsContract +} + +type ListByServiceOperationOptions struct { + Filter *string +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + return &out +} + +// ListByService ... +func (c TenantSettingsClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/settings", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TenantSettingsContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c TenantSettingsClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TenantSettingsContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TenantSettingsClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TenantSettingsContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]TenantSettingsContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/tenantsettings/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/tenantsettings/method_listbyservice_autorest.go deleted file mode 100644 index 1514f996e50..00000000000 --- a/resource-manager/apimanagement/2022-08-01/tenantsettings/method_listbyservice_autorest.go +++ /dev/null @@ -1,215 +0,0 @@ -package tenantsettings - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]TenantSettingsContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []TenantSettingsContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - Filter *string -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// ListByService ... -func (c TenantSettingsClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c TenantSettingsClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/settings", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c TenantSettingsClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c TenantSettingsClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []TenantSettingsContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenantsettings.TenantSettingsClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c TenantSettingsClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, TenantSettingsContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TenantSettingsClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate TenantSettingsContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]TenantSettingsContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/user/client.go b/resource-manager/apimanagement/2022-08-01/user/client.go index edf5ba84ceb..35a8027a782 100644 --- a/resource-manager/apimanagement/2022-08-01/user/client.go +++ b/resource-manager/apimanagement/2022-08-01/user/client.go @@ -1,18 +1,26 @@ package user -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserClientWithBaseURI(endpoint string) UserClient { - return UserClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserClientWithBaseURI(api sdkEnv.Api) (*UserClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "user", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserClient: %+v", err) } + + return &UserClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/user/constants.go b/resource-manager/apimanagement/2022-08-01/user/constants.go index e5b9de9b614..83573cf87af 100644 --- a/resource-manager/apimanagement/2022-08-01/user/constants.go +++ b/resource-manager/apimanagement/2022-08-01/user/constants.go @@ -1,6 +1,10 @@ package user -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAppType() []string { } } +func (s *AppType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAppType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAppType(input string) (*AppType, error) { vals := map[string]AppType{ "developerportal": AppTypeDeveloperPortal, @@ -47,6 +64,19 @@ func PossibleValuesForConfirmation() []string { } } +func (s *Confirmation) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConfirmation(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseConfirmation(input string) (*Confirmation, error) { vals := map[string]Confirmation{ "invite": ConfirmationInvite, @@ -77,6 +107,19 @@ func PossibleValuesForGroupType() []string { } } +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGroupType(input string) (*GroupType, error) { vals := map[string]GroupType{ "custom": GroupTypeCustom, @@ -110,6 +153,19 @@ func PossibleValuesForUserState() []string { } } +func (s *UserState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUserState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseUserState(input string) (*UserState, error) { vals := map[string]UserState{ "active": UserStateActive, diff --git a/resource-manager/apimanagement/2022-08-01/user/method_createorupdate.go b/resource-manager/apimanagement/2022-08-01/user/method_createorupdate.go new file mode 100644 index 00000000000..6ff0ddbf251 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/user/method_createorupdate.go @@ -0,0 +1,88 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + Notify *bool +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// CreateOrUpdate ... +func (c UserClient) CreateOrUpdate(ctx context.Context, id UserId, input UserCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/user/method_createorupdate_autorest.go b/resource-manager/apimanagement/2022-08-01/user/method_createorupdate_autorest.go deleted file mode 100644 index 2d354273eac..00000000000 --- a/resource-manager/apimanagement/2022-08-01/user/method_createorupdate_autorest.go +++ /dev/null @@ -1,103 +0,0 @@ -package user - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *UserContract -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string - Notify *bool -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Notify != nil { - out["notify"] = *o.Notify - } - - return out -} - -// CreateOrUpdate ... -func (c UserClient) CreateOrUpdate(ctx context.Context, id UserId, input UserCreateParameters, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c UserClient) preparerForCreateOrUpdate(ctx context.Context, id UserId, input UserCreateParameters, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c UserClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/user/method_delete.go b/resource-manager/apimanagement/2022-08-01/user/method_delete.go new file mode 100644 index 00000000000..fd6b3518902 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/user/method_delete.go @@ -0,0 +1,87 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteOperationOptions struct { + AppType *AppType + DeleteSubscriptions *bool + IfMatch *string + Notify *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.AppType != nil { + out.Append("appType", fmt.Sprintf("%v", *o.AppType)) + } + if o.DeleteSubscriptions != nil { + out.Append("deleteSubscriptions", fmt.Sprintf("%v", *o.DeleteSubscriptions)) + } + if o.Notify != nil { + out.Append("notify", fmt.Sprintf("%v", *o.Notify)) + } + return &out +} + +// Delete ... +func (c UserClient) Delete(ctx context.Context, id UserId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/user/method_delete_autorest.go b/resource-manager/apimanagement/2022-08-01/user/method_delete_autorest.go deleted file mode 100644 index 34b48b3fa26..00000000000 --- a/resource-manager/apimanagement/2022-08-01/user/method_delete_autorest.go +++ /dev/null @@ -1,110 +0,0 @@ -package user - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - AppType *AppType - DeleteSubscriptions *bool - IfMatch *string - Notify *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.AppType != nil { - out["appType"] = *o.AppType - } - - if o.DeleteSubscriptions != nil { - out["deleteSubscriptions"] = *o.DeleteSubscriptions - } - - if o.Notify != nil { - out["notify"] = *o.Notify - } - - return out -} - -// Delete ... -func (c UserClient) Delete(ctx context.Context, id UserId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c UserClient) preparerForDelete(ctx context.Context, id UserId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c UserClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/user/method_get.go b/resource-manager/apimanagement/2022-08-01/user/method_get.go new file mode 100644 index 00000000000..c70fed38ef8 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/user/method_get.go @@ -0,0 +1,51 @@ +package user + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +// Get ... +func (c UserClient) Get(ctx context.Context, id UserId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/user/method_get_autorest.go b/resource-manager/apimanagement/2022-08-01/user/method_get_autorest.go deleted file mode 100644 index e3b8b477c77..00000000000 --- a/resource-manager/apimanagement/2022-08-01/user/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package user - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *UserContract -} - -// Get ... -func (c UserClient) Get(ctx context.Context, id UserId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c UserClient) preparerForGet(ctx context.Context, id UserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c UserClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/user/method_getentitytag.go b/resource-manager/apimanagement/2022-08-01/user/method_getentitytag.go new file mode 100644 index 00000000000..bc31a7c3697 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/user/method_getentitytag.go @@ -0,0 +1,46 @@ +package user + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetEntityTagOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// GetEntityTag ... +func (c UserClient) GetEntityTag(ctx context.Context, id UserId) (result GetEntityTagOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodHead, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/user/method_getentitytag_autorest.go b/resource-manager/apimanagement/2022-08-01/user/method_getentitytag_autorest.go deleted file mode 100644 index ec2d361cccd..00000000000 --- a/resource-manager/apimanagement/2022-08-01/user/method_getentitytag_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package user - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetEntityTagOperationResponse struct { - HttpResponse *http.Response -} - -// GetEntityTag ... -func (c UserClient) GetEntityTag(ctx context.Context, id UserId) (result GetEntityTagOperationResponse, err error) { - req, err := c.preparerForGetEntityTag(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "GetEntityTag", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetEntityTag(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "GetEntityTag", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetEntityTag prepares the GetEntityTag request. -func (c UserClient) preparerForGetEntityTag(ctx context.Context, id UserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsHead(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetEntityTag handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (c UserClient) responderForGetEntityTag(resp *http.Response) (result GetEntityTagOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/user/method_listbyservice.go b/resource-manager/apimanagement/2022-08-01/user/method_listbyservice.go new file mode 100644 index 00000000000..5882829e90c --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/user/method_listbyservice.go @@ -0,0 +1,129 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServiceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]UserContract +} + +type ListByServiceCompleteResult struct { + Items []UserContract +} + +type ListByServiceOperationOptions struct { + ExpandGroups *bool + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { + return ListByServiceOperationOptions{} +} + +func (o ListByServiceOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByServiceOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByServiceOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ExpandGroups != nil { + out.Append("expandGroups", fmt.Sprintf("%v", *o.ExpandGroups)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByService ... +func (c UserClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (result ListByServiceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/users", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]UserContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByServiceComplete retrieves all the results into a single object +func (c UserClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { + return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, UserContractOperationPredicate{}) +} + +// ListByServiceCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c UserClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate UserContractOperationPredicate) (result ListByServiceCompleteResult, err error) { + items := make([]UserContract, 0) + + resp, err := c.ListByService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByServiceCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/user/method_listbyservice_autorest.go b/resource-manager/apimanagement/2022-08-01/user/method_listbyservice_autorest.go deleted file mode 100644 index 8304e22f9e4..00000000000 --- a/resource-manager/apimanagement/2022-08-01/user/method_listbyservice_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package user - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByServiceOperationResponse struct { - HttpResponse *http.Response - Model *[]UserContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByServiceOperationResponse, error) -} - -type ListByServiceCompleteResult struct { - Items []UserContract -} - -func (r ListByServiceOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByServiceOperationResponse) LoadMore(ctx context.Context) (resp ListByServiceOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByServiceOperationOptions struct { - ExpandGroups *bool - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListByServiceOperationOptions() ListByServiceOperationOptions { - return ListByServiceOperationOptions{} -} - -func (o ListByServiceOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByServiceOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.ExpandGroups != nil { - out["expandGroups"] = *o.ExpandGroups - } - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByService ... -func (c UserClient) ListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (resp ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByService(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByService(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByService prepares the ListByService request. -func (c UserClient) preparerForListByService(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/users", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByServiceWithNextLink prepares the ListByService request with the given nextLink token. -func (c UserClient) preparerForListByServiceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByService handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (c UserClient) responderForListByService(resp *http.Response) (result ListByServiceOperationResponse, err error) { - type page struct { - Values []UserContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServiceOperationResponse, err error) { - req, err := c.preparerForListByServiceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByService(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "ListByService", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByServiceComplete retrieves all of the results into a single object -func (c UserClient) ListByServiceComplete(ctx context.Context, id ServiceId, options ListByServiceOperationOptions) (ListByServiceCompleteResult, error) { - return c.ListByServiceCompleteMatchingPredicate(ctx, id, options, UserContractOperationPredicate{}) -} - -// ListByServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c UserClient) ListByServiceCompleteMatchingPredicate(ctx context.Context, id ServiceId, options ListByServiceOperationOptions, predicate UserContractOperationPredicate) (resp ListByServiceCompleteResult, err error) { - items := make([]UserContract, 0) - - page, err := c.ListByService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByServiceCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/user/method_update.go b/resource-manager/apimanagement/2022-08-01/user/method_update.go new file mode 100644 index 00000000000..ed43e43248d --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/user/method_update.go @@ -0,0 +1,84 @@ +package user + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserContract +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c UserClient) Update(ctx context.Context, id UserId, input UserUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/user/method_update_autorest.go b/resource-manager/apimanagement/2022-08-01/user/method_update_autorest.go deleted file mode 100644 index 38f81f608fd..00000000000 --- a/resource-manager/apimanagement/2022-08-01/user/method_update_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package user - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *UserContract -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c UserClient) Update(ctx context.Context, id UserId, input UserUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "user.UserClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c UserClient) preparerForUpdate(ctx context.Context, id UserId, input UserUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c UserClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/client.go b/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/client.go index 756489454aa..e8eb5e76d55 100644 --- a/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/client.go +++ b/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/client.go @@ -1,18 +1,26 @@ package userconfirmationpasswordsend -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserConfirmationPasswordSendClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserConfirmationPasswordSendClientWithBaseURI(endpoint string) UserConfirmationPasswordSendClient { - return UserConfirmationPasswordSendClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserConfirmationPasswordSendClientWithBaseURI(api sdkEnv.Api) (*UserConfirmationPasswordSendClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "userconfirmationpasswordsend", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserConfirmationPasswordSendClient: %+v", err) } + + return &UserConfirmationPasswordSendClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/constants.go b/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/constants.go index cc153945e69..c532eea3196 100644 --- a/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/constants.go +++ b/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/constants.go @@ -1,6 +1,10 @@ package userconfirmationpasswordsend -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAppType() []string { } } +func (s *AppType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAppType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAppType(input string) (*AppType, error) { vals := map[string]AppType{ "developerportal": AppTypeDeveloperPortal, diff --git a/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend.go b/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend.go new file mode 100644 index 00000000000..883292fd0c2 --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend.go @@ -0,0 +1,75 @@ +package userconfirmationpasswordsend + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserConfirmationPasswordSendOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type UserConfirmationPasswordSendOperationOptions struct { + AppType *AppType +} + +func DefaultUserConfirmationPasswordSendOperationOptions() UserConfirmationPasswordSendOperationOptions { + return UserConfirmationPasswordSendOperationOptions{} +} + +func (o UserConfirmationPasswordSendOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o UserConfirmationPasswordSendOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UserConfirmationPasswordSendOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.AppType != nil { + out.Append("appType", fmt.Sprintf("%v", *o.AppType)) + } + return &out +} + +// UserConfirmationPasswordSend ... +func (c UserConfirmationPasswordSendClient) UserConfirmationPasswordSend(ctx context.Context, id UserId, options UserConfirmationPasswordSendOperationOptions) (result UserConfirmationPasswordSendOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/confirmations/password/send", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend_autorest.go b/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend_autorest.go deleted file mode 100644 index 8a9f0a68633..00000000000 --- a/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/method_userconfirmationpasswordsend_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package userconfirmationpasswordsend - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserConfirmationPasswordSendOperationResponse struct { - HttpResponse *http.Response -} - -type UserConfirmationPasswordSendOperationOptions struct { - AppType *AppType -} - -func DefaultUserConfirmationPasswordSendOperationOptions() UserConfirmationPasswordSendOperationOptions { - return UserConfirmationPasswordSendOperationOptions{} -} - -func (o UserConfirmationPasswordSendOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o UserConfirmationPasswordSendOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.AppType != nil { - out["appType"] = *o.AppType - } - - return out -} - -// UserConfirmationPasswordSend ... -func (c UserConfirmationPasswordSendClient) UserConfirmationPasswordSend(ctx context.Context, id UserId, options UserConfirmationPasswordSendOperationOptions) (result UserConfirmationPasswordSendOperationResponse, err error) { - req, err := c.preparerForUserConfirmationPasswordSend(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "userconfirmationpasswordsend.UserConfirmationPasswordSendClient", "UserConfirmationPasswordSend", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "userconfirmationpasswordsend.UserConfirmationPasswordSendClient", "UserConfirmationPasswordSend", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserConfirmationPasswordSend(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "userconfirmationpasswordsend.UserConfirmationPasswordSendClient", "UserConfirmationPasswordSend", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserConfirmationPasswordSend prepares the UserConfirmationPasswordSend request. -func (c UserConfirmationPasswordSendClient) preparerForUserConfirmationPasswordSend(ctx context.Context, id UserId, options UserConfirmationPasswordSendOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/confirmations/password/send", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserConfirmationPasswordSend handles the response to the UserConfirmationPasswordSend request. The method always -// closes the http.Response Body. -func (c UserConfirmationPasswordSendClient) responderForUserConfirmationPasswordSend(resp *http.Response) (result UserConfirmationPasswordSendOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/usergroup/client.go b/resource-manager/apimanagement/2022-08-01/usergroup/client.go index d08c65ca35c..e320aaff086 100644 --- a/resource-manager/apimanagement/2022-08-01/usergroup/client.go +++ b/resource-manager/apimanagement/2022-08-01/usergroup/client.go @@ -1,18 +1,26 @@ package usergroup -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserGroupClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserGroupClientWithBaseURI(endpoint string) UserGroupClient { - return UserGroupClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserGroupClientWithBaseURI(api sdkEnv.Api) (*UserGroupClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "usergroup", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserGroupClient: %+v", err) } + + return &UserGroupClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/usergroup/constants.go b/resource-manager/apimanagement/2022-08-01/usergroup/constants.go index ea114107530..8762d75fc71 100644 --- a/resource-manager/apimanagement/2022-08-01/usergroup/constants.go +++ b/resource-manager/apimanagement/2022-08-01/usergroup/constants.go @@ -1,6 +1,10 @@ package usergroup -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForGroupType() []string { } } +func (s *GroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseGroupType(input string) (*GroupType, error) { vals := map[string]GroupType{ "custom": GroupTypeCustom, diff --git a/resource-manager/apimanagement/2022-08-01/usergroup/method_list.go b/resource-manager/apimanagement/2022-08-01/usergroup/method_list.go new file mode 100644 index 00000000000..c59680e814a --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/usergroup/method_list.go @@ -0,0 +1,125 @@ +package usergroup + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GroupContract +} + +type ListCompleteResult struct { + Items []GroupContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c UserGroupClient) List(ctx context.Context, id UserId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/groups", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GroupContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c UserGroupClient) ListComplete(ctx context.Context, id UserId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c UserGroupClient) ListCompleteMatchingPredicate(ctx context.Context, id UserId, options ListOperationOptions, predicate GroupContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]GroupContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/usergroup/method_list_autorest.go b/resource-manager/apimanagement/2022-08-01/usergroup/method_list_autorest.go deleted file mode 100644 index 61e0bb9e690..00000000000 --- a/resource-manager/apimanagement/2022-08-01/usergroup/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package usergroup - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]GroupContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []GroupContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c UserGroupClient) List(ctx context.Context, id UserId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c UserGroupClient) preparerForList(ctx context.Context, id UserId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/groups", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c UserGroupClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c UserGroupClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []GroupContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "usergroup.UserGroupClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c UserGroupClient) ListComplete(ctx context.Context, id UserId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, GroupContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c UserGroupClient) ListCompleteMatchingPredicate(ctx context.Context, id UserId, options ListOperationOptions, predicate GroupContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]GroupContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/useridentity/client.go b/resource-manager/apimanagement/2022-08-01/useridentity/client.go index 4ae90e35324..8a7497272b8 100644 --- a/resource-manager/apimanagement/2022-08-01/useridentity/client.go +++ b/resource-manager/apimanagement/2022-08-01/useridentity/client.go @@ -1,18 +1,26 @@ package useridentity -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserIdentityClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserIdentityClientWithBaseURI(endpoint string) UserIdentityClient { - return UserIdentityClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserIdentityClientWithBaseURI(api sdkEnv.Api) (*UserIdentityClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "useridentity", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserIdentityClient: %+v", err) } + + return &UserIdentityClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/useridentity/method_useridentitieslist.go b/resource-manager/apimanagement/2022-08-01/useridentity/method_useridentitieslist.go new file mode 100644 index 00000000000..74e3593f0ab --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/useridentity/method_useridentitieslist.go @@ -0,0 +1,89 @@ +package useridentity + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserIdentitiesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]UserIdentityContract +} + +type UserIdentitiesListCompleteResult struct { + Items []UserIdentityContract +} + +// UserIdentitiesList ... +func (c UserIdentityClient) UserIdentitiesList(ctx context.Context, id UserId) (result UserIdentitiesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/identities", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]UserIdentityContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// UserIdentitiesListComplete retrieves all the results into a single object +func (c UserIdentityClient) UserIdentitiesListComplete(ctx context.Context, id UserId) (UserIdentitiesListCompleteResult, error) { + return c.UserIdentitiesListCompleteMatchingPredicate(ctx, id, UserIdentityContractOperationPredicate{}) +} + +// UserIdentitiesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c UserIdentityClient) UserIdentitiesListCompleteMatchingPredicate(ctx context.Context, id UserId, predicate UserIdentityContractOperationPredicate) (result UserIdentitiesListCompleteResult, err error) { + items := make([]UserIdentityContract, 0) + + resp, err := c.UserIdentitiesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = UserIdentitiesListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/useridentity/method_useridentitieslist_autorest.go b/resource-manager/apimanagement/2022-08-01/useridentity/method_useridentitieslist_autorest.go deleted file mode 100644 index 6374338ce31..00000000000 --- a/resource-manager/apimanagement/2022-08-01/useridentity/method_useridentitieslist_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package useridentity - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserIdentitiesListOperationResponse struct { - HttpResponse *http.Response - Model *[]UserIdentityContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (UserIdentitiesListOperationResponse, error) -} - -type UserIdentitiesListCompleteResult struct { - Items []UserIdentityContract -} - -func (r UserIdentitiesListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r UserIdentitiesListOperationResponse) LoadMore(ctx context.Context) (resp UserIdentitiesListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// UserIdentitiesList ... -func (c UserIdentityClient) UserIdentitiesList(ctx context.Context, id UserId) (resp UserIdentitiesListOperationResponse, err error) { - req, err := c.preparerForUserIdentitiesList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForUserIdentitiesList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForUserIdentitiesList prepares the UserIdentitiesList request. -func (c UserIdentityClient) preparerForUserIdentitiesList(ctx context.Context, id UserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/identities", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForUserIdentitiesListWithNextLink prepares the UserIdentitiesList request with the given nextLink token. -func (c UserIdentityClient) preparerForUserIdentitiesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserIdentitiesList handles the response to the UserIdentitiesList request. The method always -// closes the http.Response Body. -func (c UserIdentityClient) responderForUserIdentitiesList(resp *http.Response) (result UserIdentitiesListOperationResponse, err error) { - type page struct { - Values []UserIdentityContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result UserIdentitiesListOperationResponse, err error) { - req, err := c.preparerForUserIdentitiesListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserIdentitiesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "useridentity.UserIdentityClient", "UserIdentitiesList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// UserIdentitiesListComplete retrieves all of the results into a single object -func (c UserIdentityClient) UserIdentitiesListComplete(ctx context.Context, id UserId) (UserIdentitiesListCompleteResult, error) { - return c.UserIdentitiesListCompleteMatchingPredicate(ctx, id, UserIdentityContractOperationPredicate{}) -} - -// UserIdentitiesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c UserIdentityClient) UserIdentitiesListCompleteMatchingPredicate(ctx context.Context, id UserId, predicate UserIdentityContractOperationPredicate) (resp UserIdentitiesListCompleteResult, err error) { - items := make([]UserIdentityContract, 0) - - page, err := c.UserIdentitiesList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := UserIdentitiesListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/users/client.go b/resource-manager/apimanagement/2022-08-01/users/client.go index eead37dfa09..80c03b18406 100644 --- a/resource-manager/apimanagement/2022-08-01/users/client.go +++ b/resource-manager/apimanagement/2022-08-01/users/client.go @@ -1,18 +1,26 @@ package users -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UsersClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUsersClientWithBaseURI(endpoint string) UsersClient { - return UsersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUsersClientWithBaseURI(api sdkEnv.Api) (*UsersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "users", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UsersClient: %+v", err) } + + return &UsersClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/users/method_usergeneratessourl.go b/resource-manager/apimanagement/2022-08-01/users/method_usergeneratessourl.go new file mode 100644 index 00000000000..9cf69e473cf --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/users/method_usergeneratessourl.go @@ -0,0 +1,52 @@ +package users + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserGenerateSsoUrlOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GenerateSsoUrlResult +} + +// UserGenerateSsoUrl ... +func (c UsersClient) UserGenerateSsoUrl(ctx context.Context, id UserId) (result UserGenerateSsoUrlOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateSsoUrl", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/users/method_usergeneratessourl_autorest.go b/resource-manager/apimanagement/2022-08-01/users/method_usergeneratessourl_autorest.go deleted file mode 100644 index 90bf6c3ad37..00000000000 --- a/resource-manager/apimanagement/2022-08-01/users/method_usergeneratessourl_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package users - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserGenerateSsoUrlOperationResponse struct { - HttpResponse *http.Response - Model *GenerateSsoUrlResult -} - -// UserGenerateSsoUrl ... -func (c UsersClient) UserGenerateSsoUrl(ctx context.Context, id UserId) (result UserGenerateSsoUrlOperationResponse, err error) { - req, err := c.preparerForUserGenerateSsoUrl(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "users.UsersClient", "UserGenerateSsoUrl", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "users.UsersClient", "UserGenerateSsoUrl", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserGenerateSsoUrl(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "users.UsersClient", "UserGenerateSsoUrl", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserGenerateSsoUrl prepares the UserGenerateSsoUrl request. -func (c UsersClient) preparerForUserGenerateSsoUrl(ctx context.Context, id UserId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/generateSsoUrl", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserGenerateSsoUrl handles the response to the UserGenerateSsoUrl request. The method always -// closes the http.Response Body. -func (c UsersClient) responderForUserGenerateSsoUrl(resp *http.Response) (result UserGenerateSsoUrlOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/apimanagement/2022-08-01/usersubscription/client.go b/resource-manager/apimanagement/2022-08-01/usersubscription/client.go index d3ba8ac4ce8..673507388e9 100644 --- a/resource-manager/apimanagement/2022-08-01/usersubscription/client.go +++ b/resource-manager/apimanagement/2022-08-01/usersubscription/client.go @@ -1,18 +1,26 @@ package usersubscription -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserSubscriptionClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserSubscriptionClientWithBaseURI(endpoint string) UserSubscriptionClient { - return UserSubscriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserSubscriptionClientWithBaseURI(api sdkEnv.Api) (*UserSubscriptionClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "usersubscription", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserSubscriptionClient: %+v", err) } + + return &UserSubscriptionClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/usersubscription/constants.go b/resource-manager/apimanagement/2022-08-01/usersubscription/constants.go index f7ed9ea1ce6..8999ff3cae7 100644 --- a/resource-manager/apimanagement/2022-08-01/usersubscription/constants.go +++ b/resource-manager/apimanagement/2022-08-01/usersubscription/constants.go @@ -1,6 +1,10 @@ package usersubscription -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -27,6 +31,19 @@ func PossibleValuesForSubscriptionState() []string { } } +func (s *SubscriptionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSubscriptionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSubscriptionState(input string) (*SubscriptionState, error) { vals := map[string]SubscriptionState{ "active": SubscriptionStateActive, diff --git a/resource-manager/apimanagement/2022-08-01/usersubscription/method_list.go b/resource-manager/apimanagement/2022-08-01/usersubscription/method_list.go new file mode 100644 index 00000000000..e66d1f8242d --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/usersubscription/method_list.go @@ -0,0 +1,125 @@ +package usersubscription + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SubscriptionContract +} + +type ListCompleteResult struct { + Items []SubscriptionContract +} + +type ListOperationOptions struct { + Filter *string + Skip *int64 + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c UserSubscriptionClient) List(ctx context.Context, id UserId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/subscriptions", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SubscriptionContract `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c UserSubscriptionClient) ListComplete(ctx context.Context, id UserId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c UserSubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id UserId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (result ListCompleteResult, err error) { + items := make([]SubscriptionContract, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/resource-manager/apimanagement/2022-08-01/usersubscription/method_list_autorest.go b/resource-manager/apimanagement/2022-08-01/usersubscription/method_list_autorest.go deleted file mode 100644 index e7fd01255cc..00000000000 --- a/resource-manager/apimanagement/2022-08-01/usersubscription/method_list_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package usersubscription - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]SubscriptionContract - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []SubscriptionContract -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string - Skip *int64 - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c UserSubscriptionClient) List(ctx context.Context, id UserId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c UserSubscriptionClient) preparerForList(ctx context.Context, id UserId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/subscriptions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c UserSubscriptionClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c UserSubscriptionClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []SubscriptionContract `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "usersubscription.UserSubscriptionClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c UserSubscriptionClient) ListComplete(ctx context.Context, id UserId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, SubscriptionContractOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c UserSubscriptionClient) ListCompleteMatchingPredicate(ctx context.Context, id UserId, options ListOperationOptions, predicate SubscriptionContractOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]SubscriptionContract, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/apimanagement/2022-08-01/usertoken/client.go b/resource-manager/apimanagement/2022-08-01/usertoken/client.go index ba17707e000..a19e5e1d326 100644 --- a/resource-manager/apimanagement/2022-08-01/usertoken/client.go +++ b/resource-manager/apimanagement/2022-08-01/usertoken/client.go @@ -1,18 +1,26 @@ package usertoken -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type UserTokenClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewUserTokenClientWithBaseURI(endpoint string) UserTokenClient { - return UserTokenClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewUserTokenClientWithBaseURI(api sdkEnv.Api) (*UserTokenClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "usertoken", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating UserTokenClient: %+v", err) } + + return &UserTokenClient{ + Client: client, + }, nil } diff --git a/resource-manager/apimanagement/2022-08-01/usertoken/constants.go b/resource-manager/apimanagement/2022-08-01/usertoken/constants.go index 9a1db97e8df..9c811483fc3 100644 --- a/resource-manager/apimanagement/2022-08-01/usertoken/constants.go +++ b/resource-manager/apimanagement/2022-08-01/usertoken/constants.go @@ -1,6 +1,10 @@ package usertoken -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForKeyType() []string { } } +func (s *KeyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKeyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKeyType(input string) (*KeyType, error) { vals := map[string]KeyType{ "primary": KeyTypePrimary, diff --git a/resource-manager/apimanagement/2022-08-01/usertoken/method_usergetsharedaccesstoken.go b/resource-manager/apimanagement/2022-08-01/usertoken/method_usergetsharedaccesstoken.go new file mode 100644 index 00000000000..c4fe631328a --- /dev/null +++ b/resource-manager/apimanagement/2022-08-01/usertoken/method_usergetsharedaccesstoken.go @@ -0,0 +1,56 @@ +package usertoken + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserGetSharedAccessTokenOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *UserTokenResult +} + +// UserGetSharedAccessToken ... +func (c UserTokenClient) UserGetSharedAccessToken(ctx context.Context, id UserId, input UserTokenParameters) (result UserGetSharedAccessTokenOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/token", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/apimanagement/2022-08-01/usertoken/method_usergetsharedaccesstoken_autorest.go b/resource-manager/apimanagement/2022-08-01/usertoken/method_usergetsharedaccesstoken_autorest.go deleted file mode 100644 index 75e4e070eb0..00000000000 --- a/resource-manager/apimanagement/2022-08-01/usertoken/method_usergetsharedaccesstoken_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package usertoken - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserGetSharedAccessTokenOperationResponse struct { - HttpResponse *http.Response - Model *UserTokenResult -} - -// UserGetSharedAccessToken ... -func (c UserTokenClient) UserGetSharedAccessToken(ctx context.Context, id UserId, input UserTokenParameters) (result UserGetSharedAccessTokenOperationResponse, err error) { - req, err := c.preparerForUserGetSharedAccessToken(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "usertoken.UserTokenClient", "UserGetSharedAccessToken", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "usertoken.UserTokenClient", "UserGetSharedAccessToken", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserGetSharedAccessToken(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "usertoken.UserTokenClient", "UserGetSharedAccessToken", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserGetSharedAccessToken prepares the UserGetSharedAccessToken request. -func (c UserTokenClient) preparerForUserGetSharedAccessToken(ctx context.Context, id UserId, input UserTokenParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/token", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserGetSharedAccessToken handles the response to the UserGetSharedAccessToken request. The method always -// closes the http.Response Body. -func (c UserTokenClient) responderForUserGetSharedAccessToken(resp *http.Response) (result UserGetSharedAccessTokenOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/appconfiguration/2023-03-01/client.go b/resource-manager/appconfiguration/2023-03-01/client.go index 6455511c1a6..50849dc6e4a 100644 --- a/resource-manager/appconfiguration/2023-03-01/client.go +++ b/resource-manager/appconfiguration/2023-03-01/client.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/privatelinkresources" "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -27,7 +27,7 @@ type Client struct { Replicas *replicas.ReplicasClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { configurationStoresClient, err := configurationstores.NewConfigurationStoresClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ConfigurationStores client: %+v", err) diff --git a/resource-manager/appconfiguration/2023-03-01/configurationstores/client.go b/resource-manager/appconfiguration/2023-03-01/configurationstores/client.go index fef2eec9958..86433a79fb0 100644 --- a/resource-manager/appconfiguration/2023-03-01/configurationstores/client.go +++ b/resource-manager/appconfiguration/2023-03-01/configurationstores/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationStoresClient struct { Client *resourcemanager.Client } -func NewConfigurationStoresClientWithBaseURI(api environments.Api) (*ConfigurationStoresClient, error) { +func NewConfigurationStoresClientWithBaseURI(api sdkEnv.Api) (*ConfigurationStoresClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurationstores", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationStoresClient: %+v", err) diff --git a/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores/client.go b/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores/client.go index b7b1131d1d4..42eec5762f2 100644 --- a/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores/client.go +++ b/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeletedConfigurationStoresClient struct { Client *resourcemanager.Client } -func NewDeletedConfigurationStoresClientWithBaseURI(api environments.Api) (*DeletedConfigurationStoresClient, error) { +func NewDeletedConfigurationStoresClientWithBaseURI(api sdkEnv.Api) (*DeletedConfigurationStoresClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "deletedconfigurationstores", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeletedConfigurationStoresClient: %+v", err) diff --git a/resource-manager/appconfiguration/2023-03-01/keyvalues/client.go b/resource-manager/appconfiguration/2023-03-01/keyvalues/client.go index d802f8e57d2..f03a79c5f53 100644 --- a/resource-manager/appconfiguration/2023-03-01/keyvalues/client.go +++ b/resource-manager/appconfiguration/2023-03-01/keyvalues/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type KeyValuesClient struct { Client *resourcemanager.Client } -func NewKeyValuesClientWithBaseURI(api environments.Api) (*KeyValuesClient, error) { +func NewKeyValuesClientWithBaseURI(api sdkEnv.Api) (*KeyValuesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "keyvalues", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating KeyValuesClient: %+v", err) diff --git a/resource-manager/appconfiguration/2023-03-01/operations/client.go b/resource-manager/appconfiguration/2023-03-01/operations/client.go index c3543fd2469..1d8041466a9 100644 --- a/resource-manager/appconfiguration/2023-03-01/operations/client.go +++ b/resource-manager/appconfiguration/2023-03-01/operations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationsClient struct { Client *resourcemanager.Client } -func NewOperationsClientWithBaseURI(api environments.Api) (*OperationsClient, error) { +func NewOperationsClientWithBaseURI(api sdkEnv.Api) (*OperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationsClient: %+v", err) diff --git a/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/client.go b/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/client.go +++ b/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/appconfiguration/2023-03-01/privatelinkresources/client.go b/resource-manager/appconfiguration/2023-03-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/appconfiguration/2023-03-01/privatelinkresources/client.go +++ b/resource-manager/appconfiguration/2023-03-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/appconfiguration/2023-03-01/replicas/client.go b/resource-manager/appconfiguration/2023-03-01/replicas/client.go index 084e9f43436..75f97ea346f 100644 --- a/resource-manager/appconfiguration/2023-03-01/replicas/client.go +++ b/resource-manager/appconfiguration/2023-03-01/replicas/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReplicasClient struct { Client *resourcemanager.Client } -func NewReplicasClientWithBaseURI(api environments.Api) (*ReplicasClient, error) { +func NewReplicasClientWithBaseURI(api sdkEnv.Api) (*ReplicasClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "replicas", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReplicasClient: %+v", err) diff --git a/resource-manager/applicationinsights/2020-11-20/client.go b/resource-manager/applicationinsights/2020-11-20/client.go index cd508b3bc75..1467f26e6cc 100644 --- a/resource-manager/applicationinsights/2020-11-20/client.go +++ b/resource-manager/applicationinsights/2020-11-20/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { WorkbookTemplatesAPIs *workbooktemplatesapis.WorkbookTemplatesAPIsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { workbookTemplatesAPIsClient, err := workbooktemplatesapis.NewWorkbookTemplatesAPIsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building WorkbookTemplatesAPIs client: %+v", err) diff --git a/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/client.go b/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/client.go index d88275bc576..6965523edfb 100644 --- a/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/client.go +++ b/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkbookTemplatesAPIsClient struct { Client *resourcemanager.Client } -func NewWorkbookTemplatesAPIsClientWithBaseURI(api environments.Api) (*WorkbookTemplatesAPIsClient, error) { +func NewWorkbookTemplatesAPIsClientWithBaseURI(api sdkEnv.Api) (*WorkbookTemplatesAPIsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workbooktemplatesapis", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkbookTemplatesAPIsClient: %+v", err) diff --git a/resource-manager/applicationinsights/2022-04-01/client.go b/resource-manager/applicationinsights/2022-04-01/client.go index e15f892c9bd..7b46667cda0 100644 --- a/resource-manager/applicationinsights/2022-04-01/client.go +++ b/resource-manager/applicationinsights/2022-04-01/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { WorkbooksAPIs *workbooksapis.WorkbooksAPIsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { workbooksAPIsClient, err := workbooksapis.NewWorkbooksAPIsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building WorkbooksAPIs client: %+v", err) diff --git a/resource-manager/applicationinsights/2022-04-01/workbooksapis/client.go b/resource-manager/applicationinsights/2022-04-01/workbooksapis/client.go index 4742f715826..48a2e85ffeb 100644 --- a/resource-manager/applicationinsights/2022-04-01/workbooksapis/client.go +++ b/resource-manager/applicationinsights/2022-04-01/workbooksapis/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkbooksAPIsClient struct { Client *resourcemanager.Client } -func NewWorkbooksAPIsClientWithBaseURI(api environments.Api) (*WorkbooksAPIsClient, error) { +func NewWorkbooksAPIsClientWithBaseURI(api sdkEnv.Api) (*WorkbooksAPIsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workbooksapis", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkbooksAPIsClient: %+v", err) diff --git a/resource-manager/applicationinsights/2022-06-15/client.go b/resource-manager/applicationinsights/2022-06-15/client.go index 36251911716..e40af57e2fb 100644 --- a/resource-manager/applicationinsights/2022-06-15/client.go +++ b/resource-manager/applicationinsights/2022-06-15/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { WebTestsAPIs *webtestsapis.WebTestsAPIsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { webTestsAPIsClient, err := webtestsapis.NewWebTestsAPIsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building WebTestsAPIs client: %+v", err) diff --git a/resource-manager/applicationinsights/2022-06-15/webtestsapis/client.go b/resource-manager/applicationinsights/2022-06-15/webtestsapis/client.go index 877469e1bdb..9880cf9920e 100644 --- a/resource-manager/applicationinsights/2022-06-15/webtestsapis/client.go +++ b/resource-manager/applicationinsights/2022-06-15/webtestsapis/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WebTestsAPIsClient struct { Client *resourcemanager.Client } -func NewWebTestsAPIsClientWithBaseURI(api environments.Api) (*WebTestsAPIsClient, error) { +func NewWebTestsAPIsClientWithBaseURI(api sdkEnv.Api) (*WebTestsAPIsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "webtestsapis", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WebTestsAPIsClient: %+v", err) diff --git a/resource-manager/appplatform/2022-09-01-preview/appplatform/client.go b/resource-manager/appplatform/2022-09-01-preview/appplatform/client.go index f8eb3398ac4..2c579666f76 100644 --- a/resource-manager/appplatform/2022-09-01-preview/appplatform/client.go +++ b/resource-manager/appplatform/2022-09-01-preview/appplatform/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AppPlatformClient struct { Client *resourcemanager.Client } -func NewAppPlatformClientWithBaseURI(api environments.Api) (*AppPlatformClient, error) { +func NewAppPlatformClientWithBaseURI(api sdkEnv.Api) (*AppPlatformClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "appplatform", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AppPlatformClient: %+v", err) diff --git a/resource-manager/appplatform/2022-09-01-preview/client.go b/resource-manager/appplatform/2022-09-01-preview/client.go index c08f1c93060..a9e5049b99d 100644 --- a/resource-manager/appplatform/2022-09-01-preview/client.go +++ b/resource-manager/appplatform/2022-09-01-preview/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/appplatform/2022-09-01-preview/appplatform" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { AppPlatform *appplatform.AppPlatformClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { appPlatformClient, err := appplatform.NewAppPlatformClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AppPlatform client: %+v", err) diff --git a/resource-manager/appplatform/2022-12-01/appplatform/client.go b/resource-manager/appplatform/2022-12-01/appplatform/client.go index f8eb3398ac4..2c579666f76 100644 --- a/resource-manager/appplatform/2022-12-01/appplatform/client.go +++ b/resource-manager/appplatform/2022-12-01/appplatform/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AppPlatformClient struct { Client *resourcemanager.Client } -func NewAppPlatformClientWithBaseURI(api environments.Api) (*AppPlatformClient, error) { +func NewAppPlatformClientWithBaseURI(api sdkEnv.Api) (*AppPlatformClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "appplatform", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AppPlatformClient: %+v", err) diff --git a/resource-manager/appplatform/2022-12-01/client.go b/resource-manager/appplatform/2022-12-01/client.go index dd18dc88077..0c01fffd49c 100644 --- a/resource-manager/appplatform/2022-12-01/client.go +++ b/resource-manager/appplatform/2022-12-01/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/appplatform/2022-12-01/appplatform" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { AppPlatform *appplatform.AppPlatformClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { appPlatformClient, err := appplatform.NewAppPlatformClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AppPlatform client: %+v", err) diff --git a/resource-manager/attestation/2020-10-01/attestationproviders/client.go b/resource-manager/attestation/2020-10-01/attestationproviders/client.go index 61f9f059283..dfe332a9ec2 100644 --- a/resource-manager/attestation/2020-10-01/attestationproviders/client.go +++ b/resource-manager/attestation/2020-10-01/attestationproviders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AttestationProvidersClient struct { Client *resourcemanager.Client } -func NewAttestationProvidersClientWithBaseURI(api environments.Api) (*AttestationProvidersClient, error) { +func NewAttestationProvidersClientWithBaseURI(api sdkEnv.Api) (*AttestationProvidersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "attestationproviders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AttestationProvidersClient: %+v", err) diff --git a/resource-manager/attestation/2020-10-01/client.go b/resource-manager/attestation/2020-10-01/client.go index 3073093794b..eab784ef0dc 100644 --- a/resource-manager/attestation/2020-10-01/client.go +++ b/resource-manager/attestation/2020-10-01/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders" "github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/privateendpointconnections" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { PrivateEndpointConnections *privateendpointconnections.PrivateEndpointConnectionsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { attestationProvidersClient, err := attestationproviders.NewAttestationProvidersClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AttestationProviders client: %+v", err) diff --git a/resource-manager/attestation/2020-10-01/privateendpointconnections/client.go b/resource-manager/attestation/2020-10-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/attestation/2020-10-01/privateendpointconnections/client.go +++ b/resource-manager/attestation/2020-10-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/attestation/2021-06-01/attestationproviders/client.go b/resource-manager/attestation/2021-06-01/attestationproviders/client.go index 61f9f059283..dfe332a9ec2 100644 --- a/resource-manager/attestation/2021-06-01/attestationproviders/client.go +++ b/resource-manager/attestation/2021-06-01/attestationproviders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AttestationProvidersClient struct { Client *resourcemanager.Client } -func NewAttestationProvidersClientWithBaseURI(api environments.Api) (*AttestationProvidersClient, error) { +func NewAttestationProvidersClientWithBaseURI(api sdkEnv.Api) (*AttestationProvidersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "attestationproviders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AttestationProvidersClient: %+v", err) diff --git a/resource-manager/attestation/2021-06-01/client.go b/resource-manager/attestation/2021-06-01/client.go index f6e2de0c42e..5de9a572c43 100644 --- a/resource-manager/attestation/2021-06-01/client.go +++ b/resource-manager/attestation/2021-06-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2021-06-01/privateendpointconnections" "github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2021-06-01/privatelinkresources" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { PrivateLinkResources *privatelinkresources.PrivateLinkResourcesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { attestationProvidersClient, err := attestationproviders.NewAttestationProvidersClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AttestationProviders client: %+v", err) diff --git a/resource-manager/attestation/2021-06-01/privateendpointconnections/client.go b/resource-manager/attestation/2021-06-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/attestation/2021-06-01/privateendpointconnections/client.go +++ b/resource-manager/attestation/2021-06-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/attestation/2021-06-01/privatelinkresources/client.go b/resource-manager/attestation/2021-06-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/attestation/2021-06-01/privatelinkresources/client.go +++ b/resource-manager/attestation/2021-06-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/authorization/2020-10-01/client.go b/resource-manager/authorization/2020-10-01/client.go index 9740dcad801..96a2bd9adc7 100644 --- a/resource-manager/authorization/2020-10-01/client.go +++ b/resource-manager/authorization/2020-10-01/client.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2020-10-01/rolemanagementpolicies" "github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2020-10-01/rolemanagementpolicyassignments" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -31,7 +31,7 @@ type Client struct { RoleManagementPolicyAssignments *rolemanagementpolicyassignments.RoleManagementPolicyAssignmentsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { eligibleChildResourcesClient, err := eligiblechildresources.NewEligibleChildResourcesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building EligibleChildResources client: %+v", err) diff --git a/resource-manager/authorization/2020-10-01/eligiblechildresources/client.go b/resource-manager/authorization/2020-10-01/eligiblechildresources/client.go index 3d9031767a4..6bef85bfa30 100644 --- a/resource-manager/authorization/2020-10-01/eligiblechildresources/client.go +++ b/resource-manager/authorization/2020-10-01/eligiblechildresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EligibleChildResourcesClient struct { Client *resourcemanager.Client } -func NewEligibleChildResourcesClientWithBaseURI(api environments.Api) (*EligibleChildResourcesClient, error) { +func NewEligibleChildResourcesClientWithBaseURI(api sdkEnv.Api) (*EligibleChildResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eligiblechildresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EligibleChildResourcesClient: %+v", err) diff --git a/resource-manager/authorization/2020-10-01/roleassignmentscheduleinstances/client.go b/resource-manager/authorization/2020-10-01/roleassignmentscheduleinstances/client.go index 55c53c71678..33079d4591b 100644 --- a/resource-manager/authorization/2020-10-01/roleassignmentscheduleinstances/client.go +++ b/resource-manager/authorization/2020-10-01/roleassignmentscheduleinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoleAssignmentScheduleInstancesClient struct { Client *resourcemanager.Client } -func NewRoleAssignmentScheduleInstancesClientWithBaseURI(api environments.Api) (*RoleAssignmentScheduleInstancesClient, error) { +func NewRoleAssignmentScheduleInstancesClientWithBaseURI(api sdkEnv.Api) (*RoleAssignmentScheduleInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "roleassignmentscheduleinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoleAssignmentScheduleInstancesClient: %+v", err) diff --git a/resource-manager/authorization/2020-10-01/roleassignmentschedulerequests/client.go b/resource-manager/authorization/2020-10-01/roleassignmentschedulerequests/client.go index f0e7a4084da..fb553466a70 100644 --- a/resource-manager/authorization/2020-10-01/roleassignmentschedulerequests/client.go +++ b/resource-manager/authorization/2020-10-01/roleassignmentschedulerequests/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoleAssignmentScheduleRequestsClient struct { Client *resourcemanager.Client } -func NewRoleAssignmentScheduleRequestsClientWithBaseURI(api environments.Api) (*RoleAssignmentScheduleRequestsClient, error) { +func NewRoleAssignmentScheduleRequestsClientWithBaseURI(api sdkEnv.Api) (*RoleAssignmentScheduleRequestsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "roleassignmentschedulerequests", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoleAssignmentScheduleRequestsClient: %+v", err) diff --git a/resource-manager/authorization/2020-10-01/roleassignmentschedules/client.go b/resource-manager/authorization/2020-10-01/roleassignmentschedules/client.go index f234a9a0ee1..0552ffce463 100644 --- a/resource-manager/authorization/2020-10-01/roleassignmentschedules/client.go +++ b/resource-manager/authorization/2020-10-01/roleassignmentschedules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoleAssignmentSchedulesClient struct { Client *resourcemanager.Client } -func NewRoleAssignmentSchedulesClientWithBaseURI(api environments.Api) (*RoleAssignmentSchedulesClient, error) { +func NewRoleAssignmentSchedulesClientWithBaseURI(api sdkEnv.Api) (*RoleAssignmentSchedulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "roleassignmentschedules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoleAssignmentSchedulesClient: %+v", err) diff --git a/resource-manager/authorization/2020-10-01/roleeligibilityscheduleinstances/client.go b/resource-manager/authorization/2020-10-01/roleeligibilityscheduleinstances/client.go index 1bbaeca8dd0..8c494bda786 100644 --- a/resource-manager/authorization/2020-10-01/roleeligibilityscheduleinstances/client.go +++ b/resource-manager/authorization/2020-10-01/roleeligibilityscheduleinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoleEligibilityScheduleInstancesClient struct { Client *resourcemanager.Client } -func NewRoleEligibilityScheduleInstancesClientWithBaseURI(api environments.Api) (*RoleEligibilityScheduleInstancesClient, error) { +func NewRoleEligibilityScheduleInstancesClientWithBaseURI(api sdkEnv.Api) (*RoleEligibilityScheduleInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "roleeligibilityscheduleinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoleEligibilityScheduleInstancesClient: %+v", err) diff --git a/resource-manager/authorization/2020-10-01/roleeligibilityschedulerequests/client.go b/resource-manager/authorization/2020-10-01/roleeligibilityschedulerequests/client.go index 5ce66555464..91679b3490c 100644 --- a/resource-manager/authorization/2020-10-01/roleeligibilityschedulerequests/client.go +++ b/resource-manager/authorization/2020-10-01/roleeligibilityschedulerequests/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoleEligibilityScheduleRequestsClient struct { Client *resourcemanager.Client } -func NewRoleEligibilityScheduleRequestsClientWithBaseURI(api environments.Api) (*RoleEligibilityScheduleRequestsClient, error) { +func NewRoleEligibilityScheduleRequestsClientWithBaseURI(api sdkEnv.Api) (*RoleEligibilityScheduleRequestsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "roleeligibilityschedulerequests", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoleEligibilityScheduleRequestsClient: %+v", err) diff --git a/resource-manager/authorization/2020-10-01/roleeligibilityschedules/client.go b/resource-manager/authorization/2020-10-01/roleeligibilityschedules/client.go index 11181df1979..fca10927b1e 100644 --- a/resource-manager/authorization/2020-10-01/roleeligibilityschedules/client.go +++ b/resource-manager/authorization/2020-10-01/roleeligibilityschedules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoleEligibilitySchedulesClient struct { Client *resourcemanager.Client } -func NewRoleEligibilitySchedulesClientWithBaseURI(api environments.Api) (*RoleEligibilitySchedulesClient, error) { +func NewRoleEligibilitySchedulesClientWithBaseURI(api sdkEnv.Api) (*RoleEligibilitySchedulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "roleeligibilityschedules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoleEligibilitySchedulesClient: %+v", err) diff --git a/resource-manager/authorization/2020-10-01/rolemanagementpolicies/client.go b/resource-manager/authorization/2020-10-01/rolemanagementpolicies/client.go index 199db1911e4..599b8037ef1 100644 --- a/resource-manager/authorization/2020-10-01/rolemanagementpolicies/client.go +++ b/resource-manager/authorization/2020-10-01/rolemanagementpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoleManagementPoliciesClient struct { Client *resourcemanager.Client } -func NewRoleManagementPoliciesClientWithBaseURI(api environments.Api) (*RoleManagementPoliciesClient, error) { +func NewRoleManagementPoliciesClientWithBaseURI(api sdkEnv.Api) (*RoleManagementPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "rolemanagementpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoleManagementPoliciesClient: %+v", err) diff --git a/resource-manager/authorization/2020-10-01/rolemanagementpolicyassignments/client.go b/resource-manager/authorization/2020-10-01/rolemanagementpolicyassignments/client.go index 320ccb62e90..1e6d941a4b8 100644 --- a/resource-manager/authorization/2020-10-01/rolemanagementpolicyassignments/client.go +++ b/resource-manager/authorization/2020-10-01/rolemanagementpolicyassignments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoleManagementPolicyAssignmentsClient struct { Client *resourcemanager.Client } -func NewRoleManagementPolicyAssignmentsClientWithBaseURI(api environments.Api) (*RoleManagementPolicyAssignmentsClient, error) { +func NewRoleManagementPolicyAssignmentsClientWithBaseURI(api sdkEnv.Api) (*RoleManagementPolicyAssignmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "rolemanagementpolicyassignments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoleManagementPolicyAssignmentsClient: %+v", err) diff --git a/resource-manager/authorization/2022-04-01/client.go b/resource-manager/authorization/2022-04-01/client.go index 8b2410f2fb2..89987a2571c 100644 --- a/resource-manager/authorization/2022-04-01/client.go +++ b/resource-manager/authorization/2022-04-01/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2022-04-01/roleassignments" "github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2022-04-01/roledefinitions" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { RoleDefinitions *roledefinitions.RoleDefinitionsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { denyAssignmentsClient, err := denyassignments.NewDenyAssignmentsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DenyAssignments client: %+v", err) diff --git a/resource-manager/authorization/2022-04-01/denyassignments/client.go b/resource-manager/authorization/2022-04-01/denyassignments/client.go index 34786847de1..0a3fd47f4e3 100644 --- a/resource-manager/authorization/2022-04-01/denyassignments/client.go +++ b/resource-manager/authorization/2022-04-01/denyassignments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DenyAssignmentsClient struct { Client *resourcemanager.Client } -func NewDenyAssignmentsClientWithBaseURI(api environments.Api) (*DenyAssignmentsClient, error) { +func NewDenyAssignmentsClientWithBaseURI(api sdkEnv.Api) (*DenyAssignmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "denyassignments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DenyAssignmentsClient: %+v", err) diff --git a/resource-manager/authorization/2022-04-01/permissions/client.go b/resource-manager/authorization/2022-04-01/permissions/client.go index d9214f9747d..6c62429083f 100644 --- a/resource-manager/authorization/2022-04-01/permissions/client.go +++ b/resource-manager/authorization/2022-04-01/permissions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PermissionsClient struct { Client *resourcemanager.Client } -func NewPermissionsClientWithBaseURI(api environments.Api) (*PermissionsClient, error) { +func NewPermissionsClientWithBaseURI(api sdkEnv.Api) (*PermissionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "permissions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PermissionsClient: %+v", err) diff --git a/resource-manager/authorization/2022-04-01/provideroperationsmetadata/client.go b/resource-manager/authorization/2022-04-01/provideroperationsmetadata/client.go index 1c67e393275..65901cdb414 100644 --- a/resource-manager/authorization/2022-04-01/provideroperationsmetadata/client.go +++ b/resource-manager/authorization/2022-04-01/provideroperationsmetadata/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProviderOperationsMetadataClient struct { Client *resourcemanager.Client } -func NewProviderOperationsMetadataClientWithBaseURI(api environments.Api) (*ProviderOperationsMetadataClient, error) { +func NewProviderOperationsMetadataClientWithBaseURI(api sdkEnv.Api) (*ProviderOperationsMetadataClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "provideroperationsmetadata", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProviderOperationsMetadataClient: %+v", err) diff --git a/resource-manager/authorization/2022-04-01/roleassignments/client.go b/resource-manager/authorization/2022-04-01/roleassignments/client.go index 275b6f0fd54..f101505c2ae 100644 --- a/resource-manager/authorization/2022-04-01/roleassignments/client.go +++ b/resource-manager/authorization/2022-04-01/roleassignments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoleAssignmentsClient struct { Client *resourcemanager.Client } -func NewRoleAssignmentsClientWithBaseURI(api environments.Api) (*RoleAssignmentsClient, error) { +func NewRoleAssignmentsClientWithBaseURI(api sdkEnv.Api) (*RoleAssignmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "roleassignments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoleAssignmentsClient: %+v", err) diff --git a/resource-manager/authorization/2022-04-01/roledefinitions/client.go b/resource-manager/authorization/2022-04-01/roledefinitions/client.go index f931183e275..8579b193fbb 100644 --- a/resource-manager/authorization/2022-04-01/roledefinitions/client.go +++ b/resource-manager/authorization/2022-04-01/roledefinitions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoleDefinitionsClient struct { Client *resourcemanager.Client } -func NewRoleDefinitionsClientWithBaseURI(api environments.Api) (*RoleDefinitionsClient, error) { +func NewRoleDefinitionsClientWithBaseURI(api sdkEnv.Api) (*RoleDefinitionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "roledefinitions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoleDefinitionsClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/activity/client.go b/resource-manager/automation/2022-08-08/activity/client.go index c2f6cc06490..75ad13b1b0e 100644 --- a/resource-manager/automation/2022-08-08/activity/client.go +++ b/resource-manager/automation/2022-08-08/activity/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ActivityClient struct { Client *resourcemanager.Client } -func NewActivityClientWithBaseURI(api environments.Api) (*ActivityClient, error) { +func NewActivityClientWithBaseURI(api sdkEnv.Api) (*ActivityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "activity", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ActivityClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/automationaccount/client.go b/resource-manager/automation/2022-08-08/automationaccount/client.go index 6a86ba9a484..7ad57e048fd 100644 --- a/resource-manager/automation/2022-08-08/automationaccount/client.go +++ b/resource-manager/automation/2022-08-08/automationaccount/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AutomationAccountClient struct { Client *resourcemanager.Client } -func NewAutomationAccountClientWithBaseURI(api environments.Api) (*AutomationAccountClient, error) { +func NewAutomationAccountClientWithBaseURI(api sdkEnv.Api) (*AutomationAccountClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "automationaccount", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AutomationAccountClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/certificate/client.go b/resource-manager/automation/2022-08-08/certificate/client.go index d850a6c7fd7..9caad657c9b 100644 --- a/resource-manager/automation/2022-08-08/certificate/client.go +++ b/resource-manager/automation/2022-08-08/certificate/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CertificateClient struct { Client *resourcemanager.Client } -func NewCertificateClientWithBaseURI(api environments.Api) (*CertificateClient, error) { +func NewCertificateClientWithBaseURI(api sdkEnv.Api) (*CertificateClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "certificate", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CertificateClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/client.go b/resource-manager/automation/2022-08-08/client.go index bf4454e7e3c..ae0da7a64c2 100644 --- a/resource-manager/automation/2022-08-08/client.go +++ b/resource-manager/automation/2022-08-08/client.go @@ -42,7 +42,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/usages" "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/variable" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -83,7 +83,7 @@ type Client struct { Variable *variable.VariableClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { activityClient, err := activity.NewActivityClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Activity client: %+v", err) diff --git a/resource-manager/automation/2022-08-08/connection/client.go b/resource-manager/automation/2022-08-08/connection/client.go index 6e372a9270e..dba7640af3c 100644 --- a/resource-manager/automation/2022-08-08/connection/client.go +++ b/resource-manager/automation/2022-08-08/connection/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConnectionClient struct { Client *resourcemanager.Client } -func NewConnectionClientWithBaseURI(api environments.Api) (*ConnectionClient, error) { +func NewConnectionClientWithBaseURI(api sdkEnv.Api) (*ConnectionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "connection", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConnectionClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/connectiontype/client.go b/resource-manager/automation/2022-08-08/connectiontype/client.go index 1d92356ab11..da5253578ea 100644 --- a/resource-manager/automation/2022-08-08/connectiontype/client.go +++ b/resource-manager/automation/2022-08-08/connectiontype/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConnectionTypeClient struct { Client *resourcemanager.Client } -func NewConnectionTypeClientWithBaseURI(api environments.Api) (*ConnectionTypeClient, error) { +func NewConnectionTypeClientWithBaseURI(api sdkEnv.Api) (*ConnectionTypeClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "connectiontype", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConnectionTypeClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/credential/client.go b/resource-manager/automation/2022-08-08/credential/client.go index fb5d7ba4cd1..58aed6210c5 100644 --- a/resource-manager/automation/2022-08-08/credential/client.go +++ b/resource-manager/automation/2022-08-08/credential/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CredentialClient struct { Client *resourcemanager.Client } -func NewCredentialClientWithBaseURI(api environments.Api) (*CredentialClient, error) { +func NewCredentialClientWithBaseURI(api sdkEnv.Api) (*CredentialClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "credential", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CredentialClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/dscconfiguration/client.go b/resource-manager/automation/2022-08-08/dscconfiguration/client.go index e9fc8c53627..e141511d105 100644 --- a/resource-manager/automation/2022-08-08/dscconfiguration/client.go +++ b/resource-manager/automation/2022-08-08/dscconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DscConfigurationClient struct { Client *resourcemanager.Client } -func NewDscConfigurationClientWithBaseURI(api environments.Api) (*DscConfigurationClient, error) { +func NewDscConfigurationClientWithBaseURI(api sdkEnv.Api) (*DscConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dscconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DscConfigurationClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/dscnodeconfiguration/client.go b/resource-manager/automation/2022-08-08/dscnodeconfiguration/client.go index cf138503966..bae3b1145f1 100644 --- a/resource-manager/automation/2022-08-08/dscnodeconfiguration/client.go +++ b/resource-manager/automation/2022-08-08/dscnodeconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DscNodeConfigurationClient struct { Client *resourcemanager.Client } -func NewDscNodeConfigurationClientWithBaseURI(api environments.Api) (*DscNodeConfigurationClient, error) { +func NewDscNodeConfigurationClientWithBaseURI(api sdkEnv.Api) (*DscNodeConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dscnodeconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DscNodeConfigurationClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/hybridrunbookworker/client.go b/resource-manager/automation/2022-08-08/hybridrunbookworker/client.go index df0d45ebdeb..77e20fa22fb 100644 --- a/resource-manager/automation/2022-08-08/hybridrunbookworker/client.go +++ b/resource-manager/automation/2022-08-08/hybridrunbookworker/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HybridRunbookWorkerClient struct { Client *resourcemanager.Client } -func NewHybridRunbookWorkerClientWithBaseURI(api environments.Api) (*HybridRunbookWorkerClient, error) { +func NewHybridRunbookWorkerClientWithBaseURI(api sdkEnv.Api) (*HybridRunbookWorkerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hybridrunbookworker", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HybridRunbookWorkerClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/client.go b/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/client.go index ec1d59acf3c..d038f06e147 100644 --- a/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/client.go +++ b/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HybridRunbookWorkerGroupClient struct { Client *resourcemanager.Client } -func NewHybridRunbookWorkerGroupClientWithBaseURI(api environments.Api) (*HybridRunbookWorkerGroupClient, error) { +func NewHybridRunbookWorkerGroupClientWithBaseURI(api sdkEnv.Api) (*HybridRunbookWorkerGroupClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hybridrunbookworkergroup", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HybridRunbookWorkerGroupClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/job/client.go b/resource-manager/automation/2022-08-08/job/client.go index 9c1aeead52a..9e0840550db 100644 --- a/resource-manager/automation/2022-08-08/job/client.go +++ b/resource-manager/automation/2022-08-08/job/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobClient struct { Client *resourcemanager.Client } -func NewJobClientWithBaseURI(api environments.Api) (*JobClient, error) { +func NewJobClientWithBaseURI(api sdkEnv.Api) (*JobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "job", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/jobschedule/client.go b/resource-manager/automation/2022-08-08/jobschedule/client.go index ac267909fb5..f3074da3aa4 100644 --- a/resource-manager/automation/2022-08-08/jobschedule/client.go +++ b/resource-manager/automation/2022-08-08/jobschedule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobScheduleClient struct { Client *resourcemanager.Client } -func NewJobScheduleClientWithBaseURI(api environments.Api) (*JobScheduleClient, error) { +func NewJobScheduleClientWithBaseURI(api sdkEnv.Api) (*JobScheduleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobschedule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobScheduleClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/jobstream/client.go b/resource-manager/automation/2022-08-08/jobstream/client.go index 3fd59f92957..0caa0c99b55 100644 --- a/resource-manager/automation/2022-08-08/jobstream/client.go +++ b/resource-manager/automation/2022-08-08/jobstream/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobStreamClient struct { Client *resourcemanager.Client } -func NewJobStreamClientWithBaseURI(api environments.Api) (*JobStreamClient, error) { +func NewJobStreamClientWithBaseURI(api sdkEnv.Api) (*JobStreamClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobstream", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobStreamClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/linkedworkspace/client.go b/resource-manager/automation/2022-08-08/linkedworkspace/client.go index bd37e884d33..8df17cafca3 100644 --- a/resource-manager/automation/2022-08-08/linkedworkspace/client.go +++ b/resource-manager/automation/2022-08-08/linkedworkspace/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LinkedWorkspaceClient struct { Client *resourcemanager.Client } -func NewLinkedWorkspaceClientWithBaseURI(api environments.Api) (*LinkedWorkspaceClient, error) { +func NewLinkedWorkspaceClientWithBaseURI(api sdkEnv.Api) (*LinkedWorkspaceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "linkedworkspace", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LinkedWorkspaceClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/listallhybridrunbookworkergroupinautomationaccount/client.go b/resource-manager/automation/2022-08-08/listallhybridrunbookworkergroupinautomationaccount/client.go index 3674ef61973..1ebf1b2d53c 100644 --- a/resource-manager/automation/2022-08-08/listallhybridrunbookworkergroupinautomationaccount/client.go +++ b/resource-manager/automation/2022-08-08/listallhybridrunbookworkergroupinautomationaccount/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ListAllHybridRunbookWorkerGroupInAutomationAccountClient struct { Client *resourcemanager.Client } -func NewListAllHybridRunbookWorkerGroupInAutomationAccountClientWithBaseURI(api environments.Api) (*ListAllHybridRunbookWorkerGroupInAutomationAccountClient, error) { +func NewListAllHybridRunbookWorkerGroupInAutomationAccountClientWithBaseURI(api sdkEnv.Api) (*ListAllHybridRunbookWorkerGroupInAutomationAccountClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "listallhybridrunbookworkergroupinautomationaccount", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ListAllHybridRunbookWorkerGroupInAutomationAccountClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/listkeys/client.go b/resource-manager/automation/2022-08-08/listkeys/client.go index d2466709254..5d321f04522 100644 --- a/resource-manager/automation/2022-08-08/listkeys/client.go +++ b/resource-manager/automation/2022-08-08/listkeys/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ListKeysClient struct { Client *resourcemanager.Client } -func NewListKeysClientWithBaseURI(api environments.Api) (*ListKeysClient, error) { +func NewListKeysClientWithBaseURI(api sdkEnv.Api) (*ListKeysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "listkeys", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ListKeysClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/module/client.go b/resource-manager/automation/2022-08-08/module/client.go index 09c21415a34..b5c1dc44dc6 100644 --- a/resource-manager/automation/2022-08-08/module/client.go +++ b/resource-manager/automation/2022-08-08/module/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ModuleClient struct { Client *resourcemanager.Client } -func NewModuleClientWithBaseURI(api environments.Api) (*ModuleClient, error) { +func NewModuleClientWithBaseURI(api sdkEnv.Api) (*ModuleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "module", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ModuleClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/objectdatatypes/client.go b/resource-manager/automation/2022-08-08/objectdatatypes/client.go index f48e934d0cc..296290c7e93 100644 --- a/resource-manager/automation/2022-08-08/objectdatatypes/client.go +++ b/resource-manager/automation/2022-08-08/objectdatatypes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ObjectDataTypesClient struct { Client *resourcemanager.Client } -func NewObjectDataTypesClientWithBaseURI(api environments.Api) (*ObjectDataTypesClient, error) { +func NewObjectDataTypesClientWithBaseURI(api sdkEnv.Api) (*ObjectDataTypesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "objectdatatypes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ObjectDataTypesClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/operations/client.go b/resource-manager/automation/2022-08-08/operations/client.go index c3543fd2469..1d8041466a9 100644 --- a/resource-manager/automation/2022-08-08/operations/client.go +++ b/resource-manager/automation/2022-08-08/operations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationsClient struct { Client *resourcemanager.Client } -func NewOperationsClientWithBaseURI(api environments.Api) (*OperationsClient, error) { +func NewOperationsClientWithBaseURI(api sdkEnv.Api) (*OperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationsClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/python2package/client.go b/resource-manager/automation/2022-08-08/python2package/client.go index 2a9e953deef..dbd7733e39e 100644 --- a/resource-manager/automation/2022-08-08/python2package/client.go +++ b/resource-manager/automation/2022-08-08/python2package/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type Python2PackageClient struct { Client *resourcemanager.Client } -func NewPython2PackageClientWithBaseURI(api environments.Api) (*Python2PackageClient, error) { +func NewPython2PackageClientWithBaseURI(api sdkEnv.Api) (*Python2PackageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "python2package", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating Python2PackageClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/python3package/client.go b/resource-manager/automation/2022-08-08/python3package/client.go index 0c24ccb73d6..6c2e7272364 100644 --- a/resource-manager/automation/2022-08-08/python3package/client.go +++ b/resource-manager/automation/2022-08-08/python3package/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type Python3PackageClient struct { Client *resourcemanager.Client } -func NewPython3PackageClientWithBaseURI(api environments.Api) (*Python3PackageClient, error) { +func NewPython3PackageClientWithBaseURI(api sdkEnv.Api) (*Python3PackageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "python3package", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating Python3PackageClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/runbook/client.go b/resource-manager/automation/2022-08-08/runbook/client.go index e7a956faadb..e0ece2371f7 100644 --- a/resource-manager/automation/2022-08-08/runbook/client.go +++ b/resource-manager/automation/2022-08-08/runbook/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RunbookClient struct { Client *resourcemanager.Client } -func NewRunbookClientWithBaseURI(api environments.Api) (*RunbookClient, error) { +func NewRunbookClientWithBaseURI(api sdkEnv.Api) (*RunbookClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "runbook", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RunbookClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/runbookdraft/client.go b/resource-manager/automation/2022-08-08/runbookdraft/client.go index 97f21d14b3d..1fb4036699b 100644 --- a/resource-manager/automation/2022-08-08/runbookdraft/client.go +++ b/resource-manager/automation/2022-08-08/runbookdraft/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RunbookDraftClient struct { Client *resourcemanager.Client } -func NewRunbookDraftClientWithBaseURI(api environments.Api) (*RunbookDraftClient, error) { +func NewRunbookDraftClientWithBaseURI(api sdkEnv.Api) (*RunbookDraftClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "runbookdraft", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RunbookDraftClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/schedule/client.go b/resource-manager/automation/2022-08-08/schedule/client.go index 60e00b447ce..1c5441b1037 100644 --- a/resource-manager/automation/2022-08-08/schedule/client.go +++ b/resource-manager/automation/2022-08-08/schedule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScheduleClient struct { Client *resourcemanager.Client } -func NewScheduleClientWithBaseURI(api environments.Api) (*ScheduleClient, error) { +func NewScheduleClientWithBaseURI(api sdkEnv.Api) (*ScheduleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "schedule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScheduleClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/client.go b/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/client.go index aa5dfc82f9b..2518ffcb805 100644 --- a/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/client.go +++ b/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SoftwareUpdateConfigurationMachineRunClient struct { Client *resourcemanager.Client } -func NewSoftwareUpdateConfigurationMachineRunClientWithBaseURI(api environments.Api) (*SoftwareUpdateConfigurationMachineRunClient, error) { +func NewSoftwareUpdateConfigurationMachineRunClientWithBaseURI(api sdkEnv.Api) (*SoftwareUpdateConfigurationMachineRunClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "softwareupdateconfigurationmachinerun", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SoftwareUpdateConfigurationMachineRunClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/client.go b/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/client.go index 3ed23b0cbcc..401cc6910b6 100644 --- a/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/client.go +++ b/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SoftwareUpdateConfigurationRunClient struct { Client *resourcemanager.Client } -func NewSoftwareUpdateConfigurationRunClientWithBaseURI(api environments.Api) (*SoftwareUpdateConfigurationRunClient, error) { +func NewSoftwareUpdateConfigurationRunClientWithBaseURI(api sdkEnv.Api) (*SoftwareUpdateConfigurationRunClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "softwareupdateconfigurationrun", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SoftwareUpdateConfigurationRunClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/sourcecontrol/client.go b/resource-manager/automation/2022-08-08/sourcecontrol/client.go index 09c7bffb3e9..a3abe0c9aa5 100644 --- a/resource-manager/automation/2022-08-08/sourcecontrol/client.go +++ b/resource-manager/automation/2022-08-08/sourcecontrol/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SourceControlClient struct { Client *resourcemanager.Client } -func NewSourceControlClientWithBaseURI(api environments.Api) (*SourceControlClient, error) { +func NewSourceControlClientWithBaseURI(api sdkEnv.Api) (*SourceControlClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sourcecontrol", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SourceControlClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/client.go b/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/client.go index 8b032d180db..3e6e6fbc2ac 100644 --- a/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/client.go +++ b/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SourceControlSyncJobClient struct { Client *resourcemanager.Client } -func NewSourceControlSyncJobClientWithBaseURI(api environments.Api) (*SourceControlSyncJobClient, error) { +func NewSourceControlSyncJobClientWithBaseURI(api sdkEnv.Api) (*SourceControlSyncJobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sourcecontrolsyncjob", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SourceControlSyncJobClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/client.go b/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/client.go index 273288c794c..7af4cef1c35 100644 --- a/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/client.go +++ b/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SourceControlSyncJobStreamsClient struct { Client *resourcemanager.Client } -func NewSourceControlSyncJobStreamsClientWithBaseURI(api environments.Api) (*SourceControlSyncJobStreamsClient, error) { +func NewSourceControlSyncJobStreamsClientWithBaseURI(api sdkEnv.Api) (*SourceControlSyncJobStreamsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sourcecontrolsyncjobstreams", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SourceControlSyncJobStreamsClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/statistics/client.go b/resource-manager/automation/2022-08-08/statistics/client.go index 7fac29a3626..ec2cd5e52ac 100644 --- a/resource-manager/automation/2022-08-08/statistics/client.go +++ b/resource-manager/automation/2022-08-08/statistics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StatisticsClient struct { Client *resourcemanager.Client } -func NewStatisticsClientWithBaseURI(api environments.Api) (*StatisticsClient, error) { +func NewStatisticsClientWithBaseURI(api sdkEnv.Api) (*StatisticsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "statistics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StatisticsClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/testjob/client.go b/resource-manager/automation/2022-08-08/testjob/client.go index f7fd4ae20ee..25a748d036a 100644 --- a/resource-manager/automation/2022-08-08/testjob/client.go +++ b/resource-manager/automation/2022-08-08/testjob/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TestJobClient struct { Client *resourcemanager.Client } -func NewTestJobClientWithBaseURI(api environments.Api) (*TestJobClient, error) { +func NewTestJobClientWithBaseURI(api sdkEnv.Api) (*TestJobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "testjob", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TestJobClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/testjobstream/client.go b/resource-manager/automation/2022-08-08/testjobstream/client.go index bcc9fa2ec51..1269eb727a7 100644 --- a/resource-manager/automation/2022-08-08/testjobstream/client.go +++ b/resource-manager/automation/2022-08-08/testjobstream/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TestJobStreamClient struct { Client *resourcemanager.Client } -func NewTestJobStreamClientWithBaseURI(api environments.Api) (*TestJobStreamClient, error) { +func NewTestJobStreamClientWithBaseURI(api sdkEnv.Api) (*TestJobStreamClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "testjobstream", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TestJobStreamClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/typefields/client.go b/resource-manager/automation/2022-08-08/typefields/client.go index 85efe5bf815..5bc0584c892 100644 --- a/resource-manager/automation/2022-08-08/typefields/client.go +++ b/resource-manager/automation/2022-08-08/typefields/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TypeFieldsClient struct { Client *resourcemanager.Client } -func NewTypeFieldsClientWithBaseURI(api environments.Api) (*TypeFieldsClient, error) { +func NewTypeFieldsClientWithBaseURI(api sdkEnv.Api) (*TypeFieldsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "typefields", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TypeFieldsClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/usages/client.go b/resource-manager/automation/2022-08-08/usages/client.go index 99b2625224d..9319b1a1f51 100644 --- a/resource-manager/automation/2022-08-08/usages/client.go +++ b/resource-manager/automation/2022-08-08/usages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsagesClient struct { Client *resourcemanager.Client } -func NewUsagesClientWithBaseURI(api environments.Api) (*UsagesClient, error) { +func NewUsagesClientWithBaseURI(api sdkEnv.Api) (*UsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsagesClient: %+v", err) diff --git a/resource-manager/automation/2022-08-08/variable/client.go b/resource-manager/automation/2022-08-08/variable/client.go index 9a223b83617..18a3b73e425 100644 --- a/resource-manager/automation/2022-08-08/variable/client.go +++ b/resource-manager/automation/2022-08-08/variable/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VariableClient struct { Client *resourcemanager.Client } -func NewVariableClientWithBaseURI(api environments.Api) (*VariableClient, error) { +func NewVariableClientWithBaseURI(api sdkEnv.Api) (*VariableClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "variable", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VariableClient: %+v", err) diff --git a/resource-manager/azureactivedirectory/2017-04-01/client.go b/resource-manager/azureactivedirectory/2017-04-01/client.go index f058d0dbe23..25a33fe4d52 100644 --- a/resource-manager/azureactivedirectory/2017-04-01/client.go +++ b/resource-manager/azureactivedirectory/2017-04-01/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettings" "github.com/hashicorp/go-azure-sdk/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettingscategories" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { DiagnosticSettingsCategories *diagnosticsettingscategories.DiagnosticSettingsCategoriesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { diagnosticSettingsCategoriesClient, err := diagnosticsettingscategories.NewDiagnosticSettingsCategoriesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DiagnosticSettingsCategories client: %+v", err) diff --git a/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettings/client.go b/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettings/client.go index 16b70c2b3cb..0467509d27b 100644 --- a/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettings/client.go +++ b/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DiagnosticSettingsClient struct { Client *resourcemanager.Client } -func NewDiagnosticSettingsClientWithBaseURI(api environments.Api) (*DiagnosticSettingsClient, error) { +func NewDiagnosticSettingsClientWithBaseURI(api sdkEnv.Api) (*DiagnosticSettingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "diagnosticsettings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DiagnosticSettingsClient: %+v", err) diff --git a/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettingscategories/client.go b/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettingscategories/client.go index c1a6755c2de..a50effe0d65 100644 --- a/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettingscategories/client.go +++ b/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettingscategories/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DiagnosticSettingsCategoriesClient struct { Client *resourcemanager.Client } -func NewDiagnosticSettingsCategoriesClientWithBaseURI(api environments.Api) (*DiagnosticSettingsCategoriesClient, error) { +func NewDiagnosticSettingsCategoriesClientWithBaseURI(api sdkEnv.Api) (*DiagnosticSettingsCategoriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "diagnosticsettingscategories", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DiagnosticSettingsCategoriesClient: %+v", err) diff --git a/resource-manager/azureactivedirectory/2020-03-01/client.go b/resource-manager/azureactivedirectory/2020-03-01/client.go index 0da05e184c4..f2849c91ae1 100644 --- a/resource-manager/azureactivedirectory/2020-03-01/client.go +++ b/resource-manager/azureactivedirectory/2020-03-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/azureactivedirectory/2020-03-01/privatelinkforazuread" "github.com/hashicorp/go-azure-sdk/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { PrivateLinkResources *privatelinkresources.PrivateLinkResourcesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { privateEndpointConnectionsClient, err := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building PrivateEndpointConnections client: %+v", err) diff --git a/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/client.go b/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/client.go +++ b/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/azureactivedirectory/2020-03-01/privatelinkforazuread/client.go b/resource-manager/azureactivedirectory/2020-03-01/privatelinkforazuread/client.go index 462360fe125..ee84821c592 100644 --- a/resource-manager/azureactivedirectory/2020-03-01/privatelinkforazuread/client.go +++ b/resource-manager/azureactivedirectory/2020-03-01/privatelinkforazuread/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkForAzureAdClient struct { Client *resourcemanager.Client } -func NewPrivateLinkForAzureAdClientWithBaseURI(api environments.Api) (*PrivateLinkForAzureAdClient, error) { +func NewPrivateLinkForAzureAdClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkForAzureAdClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkforazuread", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkForAzureAdClient: %+v", err) diff --git a/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/client.go b/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/client.go +++ b/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/azurestackhci/2023-03-01/arcsettings/client.go b/resource-manager/azurestackhci/2023-03-01/arcsettings/client.go index aa78837a448..fdc321f7df8 100644 --- a/resource-manager/azurestackhci/2023-03-01/arcsettings/client.go +++ b/resource-manager/azurestackhci/2023-03-01/arcsettings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ArcSettingsClient struct { Client *resourcemanager.Client } -func NewArcSettingsClientWithBaseURI(api environments.Api) (*ArcSettingsClient, error) { +func NewArcSettingsClientWithBaseURI(api sdkEnv.Api) (*ArcSettingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "arcsettings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ArcSettingsClient: %+v", err) diff --git a/resource-manager/azurestackhci/2023-03-01/client.go b/resource-manager/azurestackhci/2023-03-01/client.go index 9adddc871b5..1d4d3739aa8 100644 --- a/resource-manager/azurestackhci/2023-03-01/client.go +++ b/resource-manager/azurestackhci/2023-03-01/client.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2023-03-01/updates" "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2023-03-01/updatesummaries" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -33,7 +33,7 @@ type Client struct { Updates *updates.UpdatesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { arcSettingsClient, err := arcsettings.NewArcSettingsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ArcSettings client: %+v", err) diff --git a/resource-manager/azurestackhci/2023-03-01/cluster/client.go b/resource-manager/azurestackhci/2023-03-01/cluster/client.go index 36f5883038e..9b5b4610fb4 100644 --- a/resource-manager/azurestackhci/2023-03-01/cluster/client.go +++ b/resource-manager/azurestackhci/2023-03-01/cluster/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ClusterClient struct { Client *resourcemanager.Client } -func NewClusterClientWithBaseURI(api environments.Api) (*ClusterClient, error) { +func NewClusterClientWithBaseURI(api sdkEnv.Api) (*ClusterClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "cluster", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ClusterClient: %+v", err) diff --git a/resource-manager/azurestackhci/2023-03-01/clusters/client.go b/resource-manager/azurestackhci/2023-03-01/clusters/client.go index d6411c267f7..41e352f752c 100644 --- a/resource-manager/azurestackhci/2023-03-01/clusters/client.go +++ b/resource-manager/azurestackhci/2023-03-01/clusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ClustersClient struct { Client *resourcemanager.Client } -func NewClustersClientWithBaseURI(api environments.Api) (*ClustersClient, error) { +func NewClustersClientWithBaseURI(api sdkEnv.Api) (*ClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "clusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ClustersClient: %+v", err) diff --git a/resource-manager/azurestackhci/2023-03-01/extensions/client.go b/resource-manager/azurestackhci/2023-03-01/extensions/client.go index e88614623e6..eb7b3d07cb1 100644 --- a/resource-manager/azurestackhci/2023-03-01/extensions/client.go +++ b/resource-manager/azurestackhci/2023-03-01/extensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExtensionsClient struct { Client *resourcemanager.Client } -func NewExtensionsClientWithBaseURI(api environments.Api) (*ExtensionsClient, error) { +func NewExtensionsClientWithBaseURI(api sdkEnv.Api) (*ExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "extensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExtensionsClient: %+v", err) diff --git a/resource-manager/azurestackhci/2023-03-01/offers/client.go b/resource-manager/azurestackhci/2023-03-01/offers/client.go index 05d11353d22..bcfd95ac860 100644 --- a/resource-manager/azurestackhci/2023-03-01/offers/client.go +++ b/resource-manager/azurestackhci/2023-03-01/offers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OffersClient struct { Client *resourcemanager.Client } -func NewOffersClientWithBaseURI(api environments.Api) (*OffersClient, error) { +func NewOffersClientWithBaseURI(api sdkEnv.Api) (*OffersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "offers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OffersClient: %+v", err) diff --git a/resource-manager/azurestackhci/2023-03-01/publishers/client.go b/resource-manager/azurestackhci/2023-03-01/publishers/client.go index f3818874ae0..956c8db1d2f 100644 --- a/resource-manager/azurestackhci/2023-03-01/publishers/client.go +++ b/resource-manager/azurestackhci/2023-03-01/publishers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PublishersClient struct { Client *resourcemanager.Client } -func NewPublishersClientWithBaseURI(api environments.Api) (*PublishersClient, error) { +func NewPublishersClientWithBaseURI(api sdkEnv.Api) (*PublishersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "publishers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PublishersClient: %+v", err) diff --git a/resource-manager/azurestackhci/2023-03-01/skuses/client.go b/resource-manager/azurestackhci/2023-03-01/skuses/client.go index ca6acced6ce..0175538cf92 100644 --- a/resource-manager/azurestackhci/2023-03-01/skuses/client.go +++ b/resource-manager/azurestackhci/2023-03-01/skuses/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SkusesClient struct { Client *resourcemanager.Client } -func NewSkusesClientWithBaseURI(api environments.Api) (*SkusesClient, error) { +func NewSkusesClientWithBaseURI(api sdkEnv.Api) (*SkusesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "skuses", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SkusesClient: %+v", err) diff --git a/resource-manager/azurestackhci/2023-03-01/updateruns/client.go b/resource-manager/azurestackhci/2023-03-01/updateruns/client.go index 1e06d6b1568..0f757c7385c 100644 --- a/resource-manager/azurestackhci/2023-03-01/updateruns/client.go +++ b/resource-manager/azurestackhci/2023-03-01/updateruns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UpdateRunsClient struct { Client *resourcemanager.Client } -func NewUpdateRunsClientWithBaseURI(api environments.Api) (*UpdateRunsClient, error) { +func NewUpdateRunsClientWithBaseURI(api sdkEnv.Api) (*UpdateRunsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "updateruns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UpdateRunsClient: %+v", err) diff --git a/resource-manager/azurestackhci/2023-03-01/updates/client.go b/resource-manager/azurestackhci/2023-03-01/updates/client.go index 9c7019d8514..7ac3bdade70 100644 --- a/resource-manager/azurestackhci/2023-03-01/updates/client.go +++ b/resource-manager/azurestackhci/2023-03-01/updates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UpdatesClient struct { Client *resourcemanager.Client } -func NewUpdatesClientWithBaseURI(api environments.Api) (*UpdatesClient, error) { +func NewUpdatesClientWithBaseURI(api sdkEnv.Api) (*UpdatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "updates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UpdatesClient: %+v", err) diff --git a/resource-manager/azurestackhci/2023-03-01/updatesummaries/client.go b/resource-manager/azurestackhci/2023-03-01/updatesummaries/client.go index 4f85becbabf..2f3482f806a 100644 --- a/resource-manager/azurestackhci/2023-03-01/updatesummaries/client.go +++ b/resource-manager/azurestackhci/2023-03-01/updatesummaries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UpdateSummariesClient struct { Client *resourcemanager.Client } -func NewUpdateSummariesClientWithBaseURI(api environments.Api) (*UpdateSummariesClient, error) { +func NewUpdateSummariesClientWithBaseURI(api sdkEnv.Api) (*UpdateSummariesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "updatesummaries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UpdateSummariesClient: %+v", err) diff --git a/resource-manager/batch/2023-05-01/application/client.go b/resource-manager/batch/2023-05-01/application/client.go index a2f3d7b0dcb..808f717a43d 100644 --- a/resource-manager/batch/2023-05-01/application/client.go +++ b/resource-manager/batch/2023-05-01/application/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationClient struct { Client *resourcemanager.Client } -func NewApplicationClientWithBaseURI(api environments.Api) (*ApplicationClient, error) { +func NewApplicationClientWithBaseURI(api sdkEnv.Api) (*ApplicationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "application", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationClient: %+v", err) diff --git a/resource-manager/batch/2023-05-01/applicationpackage/client.go b/resource-manager/batch/2023-05-01/applicationpackage/client.go index f4ff74c323e..89dc5c4c6c2 100644 --- a/resource-manager/batch/2023-05-01/applicationpackage/client.go +++ b/resource-manager/batch/2023-05-01/applicationpackage/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationPackageClient struct { Client *resourcemanager.Client } -func NewApplicationPackageClientWithBaseURI(api environments.Api) (*ApplicationPackageClient, error) { +func NewApplicationPackageClientWithBaseURI(api sdkEnv.Api) (*ApplicationPackageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationpackage", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationPackageClient: %+v", err) diff --git a/resource-manager/batch/2023-05-01/batchaccount/client.go b/resource-manager/batch/2023-05-01/batchaccount/client.go index d791d0cdeb5..e314b707dfe 100644 --- a/resource-manager/batch/2023-05-01/batchaccount/client.go +++ b/resource-manager/batch/2023-05-01/batchaccount/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BatchAccountClient struct { Client *resourcemanager.Client } -func NewBatchAccountClientWithBaseURI(api environments.Api) (*BatchAccountClient, error) { +func NewBatchAccountClientWithBaseURI(api sdkEnv.Api) (*BatchAccountClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "batchaccount", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BatchAccountClient: %+v", err) diff --git a/resource-manager/batch/2023-05-01/batchmanagements/client.go b/resource-manager/batch/2023-05-01/batchmanagements/client.go index 5b07519214f..60b89371d93 100644 --- a/resource-manager/batch/2023-05-01/batchmanagements/client.go +++ b/resource-manager/batch/2023-05-01/batchmanagements/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BatchManagementsClient struct { Client *resourcemanager.Client } -func NewBatchManagementsClientWithBaseURI(api environments.Api) (*BatchManagementsClient, error) { +func NewBatchManagementsClientWithBaseURI(api sdkEnv.Api) (*BatchManagementsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "batchmanagements", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BatchManagementsClient: %+v", err) diff --git a/resource-manager/batch/2023-05-01/certificate/client.go b/resource-manager/batch/2023-05-01/certificate/client.go index d850a6c7fd7..9caad657c9b 100644 --- a/resource-manager/batch/2023-05-01/certificate/client.go +++ b/resource-manager/batch/2023-05-01/certificate/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CertificateClient struct { Client *resourcemanager.Client } -func NewCertificateClientWithBaseURI(api environments.Api) (*CertificateClient, error) { +func NewCertificateClientWithBaseURI(api sdkEnv.Api) (*CertificateClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "certificate", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CertificateClient: %+v", err) diff --git a/resource-manager/batch/2023-05-01/client.go b/resource-manager/batch/2023-05-01/client.go index 3481c191723..76512219482 100644 --- a/resource-manager/batch/2023-05-01/client.go +++ b/resource-manager/batch/2023-05-01/client.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2023-05-01/privateendpointconnection" "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2023-05-01/privatelinkresource" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -31,7 +31,7 @@ type Client struct { PrivateLinkResource *privatelinkresource.PrivateLinkResourceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { applicationClient, err := application.NewApplicationClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Application client: %+v", err) diff --git a/resource-manager/batch/2023-05-01/location/client.go b/resource-manager/batch/2023-05-01/location/client.go index fe1b2e21c89..8fd716914be 100644 --- a/resource-manager/batch/2023-05-01/location/client.go +++ b/resource-manager/batch/2023-05-01/location/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationClient struct { Client *resourcemanager.Client } -func NewLocationClientWithBaseURI(api environments.Api) (*LocationClient, error) { +func NewLocationClientWithBaseURI(api sdkEnv.Api) (*LocationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "location", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationClient: %+v", err) diff --git a/resource-manager/batch/2023-05-01/pool/client.go b/resource-manager/batch/2023-05-01/pool/client.go index 587e1af357d..d7ce2e883ae 100644 --- a/resource-manager/batch/2023-05-01/pool/client.go +++ b/resource-manager/batch/2023-05-01/pool/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PoolClient struct { Client *resourcemanager.Client } -func NewPoolClientWithBaseURI(api environments.Api) (*PoolClient, error) { +func NewPoolClientWithBaseURI(api sdkEnv.Api) (*PoolClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "pool", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PoolClient: %+v", err) diff --git a/resource-manager/batch/2023-05-01/privateendpointconnection/client.go b/resource-manager/batch/2023-05-01/privateendpointconnection/client.go index 35dcdf8567e..81fa9bc3329 100644 --- a/resource-manager/batch/2023-05-01/privateendpointconnection/client.go +++ b/resource-manager/batch/2023-05-01/privateendpointconnection/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionClient, error) { +func NewPrivateEndpointConnectionClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnection", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionClient: %+v", err) diff --git a/resource-manager/batch/2023-05-01/privatelinkresource/client.go b/resource-manager/batch/2023-05-01/privatelinkresource/client.go index 1caf7195e24..fc25864a1a8 100644 --- a/resource-manager/batch/2023-05-01/privatelinkresource/client.go +++ b/resource-manager/batch/2023-05-01/privatelinkresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourceClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourceClientWithBaseURI(api environments.Api) (*PrivateLinkResourceClient, error) { +func NewPrivateLinkResourceClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourceClient: %+v", err) diff --git a/resource-manager/blueprints/2018-11-01-preview/artifact/client.go b/resource-manager/blueprints/2018-11-01-preview/artifact/client.go index 02c32ac86f1..af5399fad3e 100644 --- a/resource-manager/blueprints/2018-11-01-preview/artifact/client.go +++ b/resource-manager/blueprints/2018-11-01-preview/artifact/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ArtifactClient struct { Client *resourcemanager.Client } -func NewArtifactClientWithBaseURI(api environments.Api) (*ArtifactClient, error) { +func NewArtifactClientWithBaseURI(api sdkEnv.Api) (*ArtifactClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "artifact", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ArtifactClient: %+v", err) diff --git a/resource-manager/blueprints/2018-11-01-preview/assignment/client.go b/resource-manager/blueprints/2018-11-01-preview/assignment/client.go index 57de4baaa33..5de69db3c0a 100644 --- a/resource-manager/blueprints/2018-11-01-preview/assignment/client.go +++ b/resource-manager/blueprints/2018-11-01-preview/assignment/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AssignmentClient struct { Client *resourcemanager.Client } -func NewAssignmentClientWithBaseURI(api environments.Api) (*AssignmentClient, error) { +func NewAssignmentClientWithBaseURI(api sdkEnv.Api) (*AssignmentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "assignment", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AssignmentClient: %+v", err) diff --git a/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/client.go b/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/client.go index 42f64999b37..ab5c58b47ca 100644 --- a/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/client.go +++ b/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AssignmentOperationsClient struct { Client *resourcemanager.Client } -func NewAssignmentOperationsClientWithBaseURI(api environments.Api) (*AssignmentOperationsClient, error) { +func NewAssignmentOperationsClientWithBaseURI(api sdkEnv.Api) (*AssignmentOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "assignmentoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AssignmentOperationsClient: %+v", err) diff --git a/resource-manager/blueprints/2018-11-01-preview/blueprint/client.go b/resource-manager/blueprints/2018-11-01-preview/blueprint/client.go index baa879f86f4..d7ca5f5237f 100644 --- a/resource-manager/blueprints/2018-11-01-preview/blueprint/client.go +++ b/resource-manager/blueprints/2018-11-01-preview/blueprint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BlueprintClient struct { Client *resourcemanager.Client } -func NewBlueprintClientWithBaseURI(api environments.Api) (*BlueprintClient, error) { +func NewBlueprintClientWithBaseURI(api sdkEnv.Api) (*BlueprintClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "blueprint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BlueprintClient: %+v", err) diff --git a/resource-manager/blueprints/2018-11-01-preview/blueprintassignments/client.go b/resource-manager/blueprints/2018-11-01-preview/blueprintassignments/client.go index 3869d2e1177..9393e131eb7 100644 --- a/resource-manager/blueprints/2018-11-01-preview/blueprintassignments/client.go +++ b/resource-manager/blueprints/2018-11-01-preview/blueprintassignments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BlueprintAssignmentsClient struct { Client *resourcemanager.Client } -func NewBlueprintAssignmentsClientWithBaseURI(api environments.Api) (*BlueprintAssignmentsClient, error) { +func NewBlueprintAssignmentsClientWithBaseURI(api sdkEnv.Api) (*BlueprintAssignmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "blueprintassignments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BlueprintAssignmentsClient: %+v", err) diff --git a/resource-manager/blueprints/2018-11-01-preview/client.go b/resource-manager/blueprints/2018-11-01-preview/client.go index 661c13e485b..0bfa4b2ddb4 100644 --- a/resource-manager/blueprints/2018-11-01-preview/client.go +++ b/resource-manager/blueprints/2018-11-01-preview/client.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/blueprints/2018-11-01-preview/publishedartifact" "github.com/hashicorp/go-azure-sdk/resource-manager/blueprints/2018-11-01-preview/publishedblueprint" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -27,7 +27,7 @@ type Client struct { PublishedBlueprint *publishedblueprint.PublishedBlueprintClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { artifactClient, err := artifact.NewArtifactClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Artifact client: %+v", err) diff --git a/resource-manager/blueprints/2018-11-01-preview/publishedartifact/client.go b/resource-manager/blueprints/2018-11-01-preview/publishedartifact/client.go index 8d49921a1d0..876ef79de40 100644 --- a/resource-manager/blueprints/2018-11-01-preview/publishedartifact/client.go +++ b/resource-manager/blueprints/2018-11-01-preview/publishedartifact/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PublishedArtifactClient struct { Client *resourcemanager.Client } -func NewPublishedArtifactClientWithBaseURI(api environments.Api) (*PublishedArtifactClient, error) { +func NewPublishedArtifactClientWithBaseURI(api sdkEnv.Api) (*PublishedArtifactClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "publishedartifact", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PublishedArtifactClient: %+v", err) diff --git a/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/client.go b/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/client.go index 29c73a867f8..14b9c21e1a5 100644 --- a/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/client.go +++ b/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PublishedBlueprintClient struct { Client *resourcemanager.Client } -func NewPublishedBlueprintClientWithBaseURI(api environments.Api) (*PublishedBlueprintClient, error) { +func NewPublishedBlueprintClientWithBaseURI(api sdkEnv.Api) (*PublishedBlueprintClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "publishedblueprint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PublishedBlueprintClient: %+v", err) diff --git a/resource-manager/chaosstudio/2022-07-01-preview/capabilities/client.go b/resource-manager/chaosstudio/2022-07-01-preview/capabilities/client.go index d8a772fc799..07a3a082f09 100644 --- a/resource-manager/chaosstudio/2022-07-01-preview/capabilities/client.go +++ b/resource-manager/chaosstudio/2022-07-01-preview/capabilities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CapabilitiesClient struct { Client *resourcemanager.Client } -func NewCapabilitiesClientWithBaseURI(api environments.Api) (*CapabilitiesClient, error) { +func NewCapabilitiesClientWithBaseURI(api sdkEnv.Api) (*CapabilitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "capabilities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CapabilitiesClient: %+v", err) diff --git a/resource-manager/chaosstudio/2022-07-01-preview/capabilitytypes/client.go b/resource-manager/chaosstudio/2022-07-01-preview/capabilitytypes/client.go index 73bf3daf995..1bf568185d1 100644 --- a/resource-manager/chaosstudio/2022-07-01-preview/capabilitytypes/client.go +++ b/resource-manager/chaosstudio/2022-07-01-preview/capabilitytypes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CapabilityTypesClient struct { Client *resourcemanager.Client } -func NewCapabilityTypesClientWithBaseURI(api environments.Api) (*CapabilityTypesClient, error) { +func NewCapabilityTypesClientWithBaseURI(api sdkEnv.Api) (*CapabilityTypesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "capabilitytypes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CapabilityTypesClient: %+v", err) diff --git a/resource-manager/chaosstudio/2022-07-01-preview/client.go b/resource-manager/chaosstudio/2022-07-01-preview/client.go index 2f8485686ba..384e02ad3fa 100644 --- a/resource-manager/chaosstudio/2022-07-01-preview/client.go +++ b/resource-manager/chaosstudio/2022-07-01-preview/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2022-07-01-preview/targets" "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2022-07-01-preview/targettypes" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { Targets *targets.TargetsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { capabilitiesClient, err := capabilities.NewCapabilitiesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Capabilities client: %+v", err) diff --git a/resource-manager/chaosstudio/2022-07-01-preview/experiments/client.go b/resource-manager/chaosstudio/2022-07-01-preview/experiments/client.go index 6b3f87bd3c6..62c8e4236c8 100644 --- a/resource-manager/chaosstudio/2022-07-01-preview/experiments/client.go +++ b/resource-manager/chaosstudio/2022-07-01-preview/experiments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExperimentsClient struct { Client *resourcemanager.Client } -func NewExperimentsClientWithBaseURI(api environments.Api) (*ExperimentsClient, error) { +func NewExperimentsClientWithBaseURI(api sdkEnv.Api) (*ExperimentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "experiments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExperimentsClient: %+v", err) diff --git a/resource-manager/chaosstudio/2022-07-01-preview/targets/client.go b/resource-manager/chaosstudio/2022-07-01-preview/targets/client.go index d10c15d1b16..78ab61b4e9c 100644 --- a/resource-manager/chaosstudio/2022-07-01-preview/targets/client.go +++ b/resource-manager/chaosstudio/2022-07-01-preview/targets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TargetsClient struct { Client *resourcemanager.Client } -func NewTargetsClientWithBaseURI(api environments.Api) (*TargetsClient, error) { +func NewTargetsClientWithBaseURI(api sdkEnv.Api) (*TargetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "targets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TargetsClient: %+v", err) diff --git a/resource-manager/chaosstudio/2022-07-01-preview/targettypes/client.go b/resource-manager/chaosstudio/2022-07-01-preview/targettypes/client.go index 56eb3c39279..7e51a16f6a4 100644 --- a/resource-manager/chaosstudio/2022-07-01-preview/targettypes/client.go +++ b/resource-manager/chaosstudio/2022-07-01-preview/targettypes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TargetTypesClient struct { Client *resourcemanager.Client } -func NewTargetTypesClientWithBaseURI(api environments.Api) (*TargetTypesClient, error) { +func NewTargetTypesClientWithBaseURI(api sdkEnv.Api) (*TargetTypesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "targettypes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TargetTypesClient: %+v", err) diff --git a/resource-manager/cognitive/2023-05-01/client.go b/resource-manager/cognitive/2023-05-01/client.go index 6fe22efa4ab..e27649e9845 100644 --- a/resource-manager/cognitive/2023-05-01/client.go +++ b/resource-manager/cognitive/2023-05-01/client.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2023-05-01/skus" "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2023-05-01/usages" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -33,7 +33,7 @@ type Client struct { Usages *usages.UsagesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { cognitiveServicesAccountsClient, err := cognitiveservicesaccounts.NewCognitiveServicesAccountsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CognitiveServicesAccounts client: %+v", err) diff --git a/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/client.go b/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/client.go index 27ba74e6636..80df454f08f 100644 --- a/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/client.go +++ b/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CognitiveServicesAccountsClient struct { Client *resourcemanager.Client } -func NewCognitiveServicesAccountsClientWithBaseURI(api environments.Api) (*CognitiveServicesAccountsClient, error) { +func NewCognitiveServicesAccountsClientWithBaseURI(api sdkEnv.Api) (*CognitiveServicesAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "cognitiveservicesaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CognitiveServicesAccountsClient: %+v", err) diff --git a/resource-manager/cognitive/2023-05-01/cognitiveservicescommitmentplans/client.go b/resource-manager/cognitive/2023-05-01/cognitiveservicescommitmentplans/client.go index 69a9b0b170b..510bd8c5977 100644 --- a/resource-manager/cognitive/2023-05-01/cognitiveservicescommitmentplans/client.go +++ b/resource-manager/cognitive/2023-05-01/cognitiveservicescommitmentplans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CognitiveServicesCommitmentPlansClient struct { Client *resourcemanager.Client } -func NewCognitiveServicesCommitmentPlansClientWithBaseURI(api environments.Api) (*CognitiveServicesCommitmentPlansClient, error) { +func NewCognitiveServicesCommitmentPlansClientWithBaseURI(api sdkEnv.Api) (*CognitiveServicesCommitmentPlansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "cognitiveservicescommitmentplans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CognitiveServicesCommitmentPlansClient: %+v", err) diff --git a/resource-manager/cognitive/2023-05-01/commitmentplans/client.go b/resource-manager/cognitive/2023-05-01/commitmentplans/client.go index c15044810c7..235b3725152 100644 --- a/resource-manager/cognitive/2023-05-01/commitmentplans/client.go +++ b/resource-manager/cognitive/2023-05-01/commitmentplans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CommitmentPlansClient struct { Client *resourcemanager.Client } -func NewCommitmentPlansClientWithBaseURI(api environments.Api) (*CommitmentPlansClient, error) { +func NewCommitmentPlansClientWithBaseURI(api sdkEnv.Api) (*CommitmentPlansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "commitmentplans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CommitmentPlansClient: %+v", err) diff --git a/resource-manager/cognitive/2023-05-01/commitmenttiers/client.go b/resource-manager/cognitive/2023-05-01/commitmenttiers/client.go index 6df51377653..befadb81105 100644 --- a/resource-manager/cognitive/2023-05-01/commitmenttiers/client.go +++ b/resource-manager/cognitive/2023-05-01/commitmenttiers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CommitmentTiersClient struct { Client *resourcemanager.Client } -func NewCommitmentTiersClientWithBaseURI(api environments.Api) (*CommitmentTiersClient, error) { +func NewCommitmentTiersClientWithBaseURI(api sdkEnv.Api) (*CommitmentTiersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "commitmenttiers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CommitmentTiersClient: %+v", err) diff --git a/resource-manager/cognitive/2023-05-01/deployments/client.go b/resource-manager/cognitive/2023-05-01/deployments/client.go index b4dc67ab0a9..f117c74690e 100644 --- a/resource-manager/cognitive/2023-05-01/deployments/client.go +++ b/resource-manager/cognitive/2023-05-01/deployments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeploymentsClient struct { Client *resourcemanager.Client } -func NewDeploymentsClientWithBaseURI(api environments.Api) (*DeploymentsClient, error) { +func NewDeploymentsClientWithBaseURI(api sdkEnv.Api) (*DeploymentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "deployments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeploymentsClient: %+v", err) diff --git a/resource-manager/cognitive/2023-05-01/models/client.go b/resource-manager/cognitive/2023-05-01/models/client.go index 1859a4b0e1d..5f89ba039e8 100644 --- a/resource-manager/cognitive/2023-05-01/models/client.go +++ b/resource-manager/cognitive/2023-05-01/models/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ModelsClient struct { Client *resourcemanager.Client } -func NewModelsClientWithBaseURI(api environments.Api) (*ModelsClient, error) { +func NewModelsClientWithBaseURI(api sdkEnv.Api) (*ModelsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "models", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ModelsClient: %+v", err) diff --git a/resource-manager/cognitive/2023-05-01/privateendpointconnections/client.go b/resource-manager/cognitive/2023-05-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/cognitive/2023-05-01/privateendpointconnections/client.go +++ b/resource-manager/cognitive/2023-05-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/cognitive/2023-05-01/privatelinkresources/client.go b/resource-manager/cognitive/2023-05-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/cognitive/2023-05-01/privatelinkresources/client.go +++ b/resource-manager/cognitive/2023-05-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/cognitive/2023-05-01/skus/client.go b/resource-manager/cognitive/2023-05-01/skus/client.go index a561bc4ec71..ee82463b163 100644 --- a/resource-manager/cognitive/2023-05-01/skus/client.go +++ b/resource-manager/cognitive/2023-05-01/skus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SkusClient struct { Client *resourcemanager.Client } -func NewSkusClientWithBaseURI(api environments.Api) (*SkusClient, error) { +func NewSkusClientWithBaseURI(api sdkEnv.Api) (*SkusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "skus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SkusClient: %+v", err) diff --git a/resource-manager/cognitive/2023-05-01/usages/client.go b/resource-manager/cognitive/2023-05-01/usages/client.go index 99b2625224d..9319b1a1f51 100644 --- a/resource-manager/cognitive/2023-05-01/usages/client.go +++ b/resource-manager/cognitive/2023-05-01/usages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsagesClient struct { Client *resourcemanager.Client } -func NewUsagesClientWithBaseURI(api environments.Api) (*UsagesClient, error) { +func NewUsagesClientWithBaseURI(api sdkEnv.Api) (*UsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsagesClient: %+v", err) diff --git a/resource-manager/communication/2023-03-31/client.go b/resource-manager/communication/2023-03-31/client.go index b06e1afc16c..865d47ebf12 100644 --- a/resource-manager/communication/2023-03-31/client.go +++ b/resource-manager/communication/2023-03-31/client.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/communication/2023-03-31/emailservices" "github.com/hashicorp/go-azure-sdk/resource-manager/communication/2023-03-31/senderusernames" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -21,7 +21,7 @@ type Client struct { SenderUsernames *senderusernames.SenderUsernamesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { communicationServicesClient, err := communicationservices.NewCommunicationServicesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CommunicationServices client: %+v", err) diff --git a/resource-manager/communication/2023-03-31/communicationservices/client.go b/resource-manager/communication/2023-03-31/communicationservices/client.go index 472426d7e8f..32120a60020 100644 --- a/resource-manager/communication/2023-03-31/communicationservices/client.go +++ b/resource-manager/communication/2023-03-31/communicationservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CommunicationServicesClient struct { Client *resourcemanager.Client } -func NewCommunicationServicesClientWithBaseURI(api environments.Api) (*CommunicationServicesClient, error) { +func NewCommunicationServicesClientWithBaseURI(api sdkEnv.Api) (*CommunicationServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "communicationservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CommunicationServicesClient: %+v", err) diff --git a/resource-manager/communication/2023-03-31/domains/client.go b/resource-manager/communication/2023-03-31/domains/client.go index 4816b188ae1..35bdff62532 100644 --- a/resource-manager/communication/2023-03-31/domains/client.go +++ b/resource-manager/communication/2023-03-31/domains/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DomainsClient struct { Client *resourcemanager.Client } -func NewDomainsClientWithBaseURI(api environments.Api) (*DomainsClient, error) { +func NewDomainsClientWithBaseURI(api sdkEnv.Api) (*DomainsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "domains", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DomainsClient: %+v", err) diff --git a/resource-manager/communication/2023-03-31/emailservices/client.go b/resource-manager/communication/2023-03-31/emailservices/client.go index 17a07a50bd6..be1c5f7e252 100644 --- a/resource-manager/communication/2023-03-31/emailservices/client.go +++ b/resource-manager/communication/2023-03-31/emailservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EmailServicesClient struct { Client *resourcemanager.Client } -func NewEmailServicesClientWithBaseURI(api environments.Api) (*EmailServicesClient, error) { +func NewEmailServicesClientWithBaseURI(api sdkEnv.Api) (*EmailServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "emailservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EmailServicesClient: %+v", err) diff --git a/resource-manager/communication/2023-03-31/senderusernames/client.go b/resource-manager/communication/2023-03-31/senderusernames/client.go index 16b80dd71a0..41da3bdef98 100644 --- a/resource-manager/communication/2023-03-31/senderusernames/client.go +++ b/resource-manager/communication/2023-03-31/senderusernames/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SenderUsernamesClient struct { Client *resourcemanager.Client } -func NewSenderUsernamesClientWithBaseURI(api environments.Api) (*SenderUsernamesClient, error) { +func NewSenderUsernamesClientWithBaseURI(api sdkEnv.Api) (*SenderUsernamesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "senderusernames", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SenderUsernamesClient: %+v", err) diff --git a/resource-manager/confidentialledger/2022-05-13/client.go b/resource-manager/confidentialledger/2022-05-13/client.go index 726955c493d..c23a275b919 100644 --- a/resource-manager/confidentialledger/2022-05-13/client.go +++ b/resource-manager/confidentialledger/2022-05-13/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger" "github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/nameavailability" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { NameAvailability *nameavailability.NameAvailabilityClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { confidentialLedgerClient, err := confidentialledger.NewConfidentialLedgerClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ConfidentialLedger client: %+v", err) diff --git a/resource-manager/confidentialledger/2022-05-13/confidentialledger/client.go b/resource-manager/confidentialledger/2022-05-13/confidentialledger/client.go index 551c02130f7..71a0dc659fd 100644 --- a/resource-manager/confidentialledger/2022-05-13/confidentialledger/client.go +++ b/resource-manager/confidentialledger/2022-05-13/confidentialledger/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfidentialLedgerClient struct { Client *resourcemanager.Client } -func NewConfidentialLedgerClientWithBaseURI(api environments.Api) (*ConfidentialLedgerClient, error) { +func NewConfidentialLedgerClientWithBaseURI(api sdkEnv.Api) (*ConfidentialLedgerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "confidentialledger", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfidentialLedgerClient: %+v", err) diff --git a/resource-manager/confidentialledger/2022-05-13/nameavailability/client.go b/resource-manager/confidentialledger/2022-05-13/nameavailability/client.go index 61f1c1f203a..87eb2adbc32 100644 --- a/resource-manager/confidentialledger/2022-05-13/nameavailability/client.go +++ b/resource-manager/confidentialledger/2022-05-13/nameavailability/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NameAvailabilityClient struct { Client *resourcemanager.Client } -func NewNameAvailabilityClientWithBaseURI(api environments.Api) (*NameAvailabilityClient, error) { +func NewNameAvailabilityClientWithBaseURI(api sdkEnv.Api) (*NameAvailabilityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "nameavailability", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NameAvailabilityClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/client.go b/resource-manager/connectedvmware/2022-01-10-preview/client.go index 609d373bbfd..539b372c84e 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/client.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/connectedvmware/2022-01-10-preview/virtualmachinetemplates" "github.com/hashicorp/go-azure-sdk/resource-manager/connectedvmware/2022-01-10-preview/virtualnetworks" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -37,7 +37,7 @@ type Client struct { VirtualNetworks *virtualnetworks.VirtualNetworksClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { clustersClient, err := clusters.NewClustersClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Clusters client: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/clusters/client.go b/resource-manager/connectedvmware/2022-01-10-preview/clusters/client.go index d6411c267f7..41e352f752c 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/clusters/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/clusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ClustersClient struct { Client *resourcemanager.Client } -func NewClustersClientWithBaseURI(api environments.Api) (*ClustersClient, error) { +func NewClustersClientWithBaseURI(api sdkEnv.Api) (*ClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "clusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ClustersClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/datastores/client.go b/resource-manager/connectedvmware/2022-01-10-preview/datastores/client.go index 2a1c3f50a52..b0db0e5167c 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/datastores/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/datastores/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataStoresClient struct { Client *resourcemanager.Client } -func NewDataStoresClientWithBaseURI(api environments.Api) (*DataStoresClient, error) { +func NewDataStoresClientWithBaseURI(api sdkEnv.Api) (*DataStoresClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datastores", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataStoresClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/guestagents/client.go b/resource-manager/connectedvmware/2022-01-10-preview/guestagents/client.go index d258ccf6e9c..f8b3bd4fd1b 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/guestagents/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/guestagents/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestAgentsClient struct { Client *resourcemanager.Client } -func NewGuestAgentsClientWithBaseURI(api environments.Api) (*GuestAgentsClient, error) { +func NewGuestAgentsClientWithBaseURI(api sdkEnv.Api) (*GuestAgentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestagents", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestAgentsClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/hosts/client.go b/resource-manager/connectedvmware/2022-01-10-preview/hosts/client.go index 35751538e39..c0549fa5c59 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/hosts/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/hosts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HostsClient struct { Client *resourcemanager.Client } -func NewHostsClientWithBaseURI(api environments.Api) (*HostsClient, error) { +func NewHostsClientWithBaseURI(api sdkEnv.Api) (*HostsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hosts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HostsClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/client.go b/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/client.go index f6b73bc4e2f..2652877cdcd 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HybridIdentityMetadataClient struct { Client *resourcemanager.Client } -func NewHybridIdentityMetadataClientWithBaseURI(api environments.Api) (*HybridIdentityMetadataClient, error) { +func NewHybridIdentityMetadataClientWithBaseURI(api sdkEnv.Api) (*HybridIdentityMetadataClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hybrididentitymetadata", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HybridIdentityMetadataClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/client.go b/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/client.go index cea1c3b3f20..f1d2584fddd 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type InventoryItemsClient struct { Client *resourcemanager.Client } -func NewInventoryItemsClientWithBaseURI(api environments.Api) (*InventoryItemsClient, error) { +func NewInventoryItemsClientWithBaseURI(api sdkEnv.Api) (*InventoryItemsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "inventoryitems", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating InventoryItemsClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/client.go b/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/client.go index a82426de010..c34090a6a48 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MachineExtensionsClient struct { Client *resourcemanager.Client } -func NewMachineExtensionsClientWithBaseURI(api environments.Api) (*MachineExtensionsClient, error) { +func NewMachineExtensionsClientWithBaseURI(api sdkEnv.Api) (*MachineExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "machineextensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MachineExtensionsClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/resourcepools/client.go b/resource-manager/connectedvmware/2022-01-10-preview/resourcepools/client.go index 97278df4ddc..b8031e07450 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/resourcepools/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/resourcepools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResourcePoolsClient struct { Client *resourcemanager.Client } -func NewResourcePoolsClientWithBaseURI(api environments.Api) (*ResourcePoolsClient, error) { +func NewResourcePoolsClientWithBaseURI(api sdkEnv.Api) (*ResourcePoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resourcepools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResourcePoolsClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/vcenters/client.go b/resource-manager/connectedvmware/2022-01-10-preview/vcenters/client.go index 7d01fde9f9c..065e981df5b 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/vcenters/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/vcenters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VCentersClient struct { Client *resourcemanager.Client } -func NewVCentersClientWithBaseURI(api environments.Api) (*VCentersClient, error) { +func NewVCentersClientWithBaseURI(api sdkEnv.Api) (*VCentersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vcenters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VCentersClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/virtualmachines/client.go b/resource-manager/connectedvmware/2022-01-10-preview/virtualmachines/client.go index ddde210da17..d9b2555ade0 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/virtualmachines/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/virtualmachines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualMachinesClient struct { Client *resourcemanager.Client } -func NewVirtualMachinesClientWithBaseURI(api environments.Api) (*VirtualMachinesClient, error) { +func NewVirtualMachinesClientWithBaseURI(api sdkEnv.Api) (*VirtualMachinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualmachines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualMachinesClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/virtualmachinetemplates/client.go b/resource-manager/connectedvmware/2022-01-10-preview/virtualmachinetemplates/client.go index f97ff1a720b..3113ba95542 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/virtualmachinetemplates/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/virtualmachinetemplates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualMachineTemplatesClient struct { Client *resourcemanager.Client } -func NewVirtualMachineTemplatesClientWithBaseURI(api environments.Api) (*VirtualMachineTemplatesClient, error) { +func NewVirtualMachineTemplatesClientWithBaseURI(api sdkEnv.Api) (*VirtualMachineTemplatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualmachinetemplates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualMachineTemplatesClient: %+v", err) diff --git a/resource-manager/connectedvmware/2022-01-10-preview/virtualnetworks/client.go b/resource-manager/connectedvmware/2022-01-10-preview/virtualnetworks/client.go index c274c9c87de..5c9e7698630 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/virtualnetworks/client.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/virtualnetworks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworksClient struct { Client *resourcemanager.Client } -func NewVirtualNetworksClientWithBaseURI(api environments.Api) (*VirtualNetworksClient, error) { +func NewVirtualNetworksClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworksClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/aggregatedcost/client.go b/resource-manager/consumption/2019-10-01/aggregatedcost/client.go index 7d1286c8153..0dff50459dc 100644 --- a/resource-manager/consumption/2019-10-01/aggregatedcost/client.go +++ b/resource-manager/consumption/2019-10-01/aggregatedcost/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AggregatedCostClient struct { Client *resourcemanager.Client } -func NewAggregatedCostClientWithBaseURI(api environments.Api) (*AggregatedCostClient, error) { +func NewAggregatedCostClientWithBaseURI(api sdkEnv.Api) (*AggregatedCostClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "aggregatedcost", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AggregatedCostClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/balances/client.go b/resource-manager/consumption/2019-10-01/balances/client.go index d1fbf8148d0..971aee221a1 100644 --- a/resource-manager/consumption/2019-10-01/balances/client.go +++ b/resource-manager/consumption/2019-10-01/balances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BalancesClient struct { Client *resourcemanager.Client } -func NewBalancesClientWithBaseURI(api environments.Api) (*BalancesClient, error) { +func NewBalancesClientWithBaseURI(api sdkEnv.Api) (*BalancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "balances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BalancesClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/budgets/client.go b/resource-manager/consumption/2019-10-01/budgets/client.go index 54abced399c..3f3b8d006de 100644 --- a/resource-manager/consumption/2019-10-01/budgets/client.go +++ b/resource-manager/consumption/2019-10-01/budgets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BudgetsClient struct { Client *resourcemanager.Client } -func NewBudgetsClientWithBaseURI(api environments.Api) (*BudgetsClient, error) { +func NewBudgetsClientWithBaseURI(api sdkEnv.Api) (*BudgetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "budgets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BudgetsClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/charges/client.go b/resource-manager/consumption/2019-10-01/charges/client.go index 9975656d4b6..77fa73bffd0 100644 --- a/resource-manager/consumption/2019-10-01/charges/client.go +++ b/resource-manager/consumption/2019-10-01/charges/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ChargesClient struct { Client *resourcemanager.Client } -func NewChargesClientWithBaseURI(api environments.Api) (*ChargesClient, error) { +func NewChargesClientWithBaseURI(api sdkEnv.Api) (*ChargesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "charges", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ChargesClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/client.go b/resource-manager/consumption/2019-10-01/client.go index 26261a326f7..106a96eb9e7 100644 --- a/resource-manager/consumption/2019-10-01/client.go +++ b/resource-manager/consumption/2019-10-01/client.go @@ -23,7 +23,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/reservationtransactions" "github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/usagedetails" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -45,7 +45,7 @@ type Client struct { UsageDetails *usagedetails.UsageDetailsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { aggregatedCostClient, err := aggregatedcost.NewAggregatedCostClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AggregatedCost client: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/credits/client.go b/resource-manager/consumption/2019-10-01/credits/client.go index 46ccf59f2bd..9b474f2ce05 100644 --- a/resource-manager/consumption/2019-10-01/credits/client.go +++ b/resource-manager/consumption/2019-10-01/credits/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CreditsClient struct { Client *resourcemanager.Client } -func NewCreditsClientWithBaseURI(api environments.Api) (*CreditsClient, error) { +func NewCreditsClientWithBaseURI(api sdkEnv.Api) (*CreditsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "credits", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CreditsClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/events/client.go b/resource-manager/consumption/2019-10-01/events/client.go index f6d343c073d..8ba79590d92 100644 --- a/resource-manager/consumption/2019-10-01/events/client.go +++ b/resource-manager/consumption/2019-10-01/events/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventsClient struct { Client *resourcemanager.Client } -func NewEventsClientWithBaseURI(api environments.Api) (*EventsClient, error) { +func NewEventsClientWithBaseURI(api sdkEnv.Api) (*EventsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "events", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventsClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/forecasts/client.go b/resource-manager/consumption/2019-10-01/forecasts/client.go index af024c7969b..4e4c671544f 100644 --- a/resource-manager/consumption/2019-10-01/forecasts/client.go +++ b/resource-manager/consumption/2019-10-01/forecasts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ForecastsClient struct { Client *resourcemanager.Client } -func NewForecastsClientWithBaseURI(api environments.Api) (*ForecastsClient, error) { +func NewForecastsClientWithBaseURI(api sdkEnv.Api) (*ForecastsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "forecasts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ForecastsClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/lots/client.go b/resource-manager/consumption/2019-10-01/lots/client.go index 535305596ba..6fce2ff3d67 100644 --- a/resource-manager/consumption/2019-10-01/lots/client.go +++ b/resource-manager/consumption/2019-10-01/lots/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LotsClient struct { Client *resourcemanager.Client } -func NewLotsClientWithBaseURI(api environments.Api) (*LotsClient, error) { +func NewLotsClientWithBaseURI(api sdkEnv.Api) (*LotsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "lots", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LotsClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/marketplaces/client.go b/resource-manager/consumption/2019-10-01/marketplaces/client.go index f107593d812..98233de23e3 100644 --- a/resource-manager/consumption/2019-10-01/marketplaces/client.go +++ b/resource-manager/consumption/2019-10-01/marketplaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MarketplacesClient struct { Client *resourcemanager.Client } -func NewMarketplacesClientWithBaseURI(api environments.Api) (*MarketplacesClient, error) { +func NewMarketplacesClientWithBaseURI(api sdkEnv.Api) (*MarketplacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "marketplaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MarketplacesClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/pricesheet/client.go b/resource-manager/consumption/2019-10-01/pricesheet/client.go index c9fa7425b77..4ecfaa287d8 100644 --- a/resource-manager/consumption/2019-10-01/pricesheet/client.go +++ b/resource-manager/consumption/2019-10-01/pricesheet/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PriceSheetClient struct { Client *resourcemanager.Client } -func NewPriceSheetClientWithBaseURI(api environments.Api) (*PriceSheetClient, error) { +func NewPriceSheetClientWithBaseURI(api sdkEnv.Api) (*PriceSheetClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "pricesheet", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PriceSheetClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/reservationdetails/client.go b/resource-manager/consumption/2019-10-01/reservationdetails/client.go index 3e118a5d9dd..65e64b06fca 100644 --- a/resource-manager/consumption/2019-10-01/reservationdetails/client.go +++ b/resource-manager/consumption/2019-10-01/reservationdetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationDetailsClient struct { Client *resourcemanager.Client } -func NewReservationDetailsClientWithBaseURI(api environments.Api) (*ReservationDetailsClient, error) { +func NewReservationDetailsClientWithBaseURI(api sdkEnv.Api) (*ReservationDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationdetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationDetailsClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/reservationrecommendationdetails/client.go b/resource-manager/consumption/2019-10-01/reservationrecommendationdetails/client.go index 5e7fa22d013..67162ea2284 100644 --- a/resource-manager/consumption/2019-10-01/reservationrecommendationdetails/client.go +++ b/resource-manager/consumption/2019-10-01/reservationrecommendationdetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationRecommendationDetailsClient struct { Client *resourcemanager.Client } -func NewReservationRecommendationDetailsClientWithBaseURI(api environments.Api) (*ReservationRecommendationDetailsClient, error) { +func NewReservationRecommendationDetailsClientWithBaseURI(api sdkEnv.Api) (*ReservationRecommendationDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationrecommendationdetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationRecommendationDetailsClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/reservationrecommendations/client.go b/resource-manager/consumption/2019-10-01/reservationrecommendations/client.go index da6b39f69b5..1255899e2cf 100644 --- a/resource-manager/consumption/2019-10-01/reservationrecommendations/client.go +++ b/resource-manager/consumption/2019-10-01/reservationrecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationRecommendationsClient struct { Client *resourcemanager.Client } -func NewReservationRecommendationsClientWithBaseURI(api environments.Api) (*ReservationRecommendationsClient, error) { +func NewReservationRecommendationsClientWithBaseURI(api sdkEnv.Api) (*ReservationRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationrecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationRecommendationsClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/reservationsummaries/client.go b/resource-manager/consumption/2019-10-01/reservationsummaries/client.go index 3e18b072ece..f2115ec9106 100644 --- a/resource-manager/consumption/2019-10-01/reservationsummaries/client.go +++ b/resource-manager/consumption/2019-10-01/reservationsummaries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationSummariesClient struct { Client *resourcemanager.Client } -func NewReservationSummariesClientWithBaseURI(api environments.Api) (*ReservationSummariesClient, error) { +func NewReservationSummariesClientWithBaseURI(api sdkEnv.Api) (*ReservationSummariesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationsummaries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationSummariesClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/reservationtransactions/client.go b/resource-manager/consumption/2019-10-01/reservationtransactions/client.go index 5d100f67ece..d6c9a43c04b 100644 --- a/resource-manager/consumption/2019-10-01/reservationtransactions/client.go +++ b/resource-manager/consumption/2019-10-01/reservationtransactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationTransactionsClient struct { Client *resourcemanager.Client } -func NewReservationTransactionsClientWithBaseURI(api environments.Api) (*ReservationTransactionsClient, error) { +func NewReservationTransactionsClientWithBaseURI(api sdkEnv.Api) (*ReservationTransactionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationtransactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationTransactionsClient: %+v", err) diff --git a/resource-manager/consumption/2019-10-01/usagedetails/client.go b/resource-manager/consumption/2019-10-01/usagedetails/client.go index 4b5d6b7fac9..fe0903d61e6 100644 --- a/resource-manager/consumption/2019-10-01/usagedetails/client.go +++ b/resource-manager/consumption/2019-10-01/usagedetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsageDetailsClient struct { Client *resourcemanager.Client } -func NewUsageDetailsClientWithBaseURI(api environments.Api) (*UsageDetailsClient, error) { +func NewUsageDetailsClientWithBaseURI(api sdkEnv.Api) (*UsageDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usagedetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsageDetailsClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/aggregatedcost/client.go b/resource-manager/consumption/2021-10-01/aggregatedcost/client.go index 7d1286c8153..0dff50459dc 100644 --- a/resource-manager/consumption/2021-10-01/aggregatedcost/client.go +++ b/resource-manager/consumption/2021-10-01/aggregatedcost/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AggregatedCostClient struct { Client *resourcemanager.Client } -func NewAggregatedCostClientWithBaseURI(api environments.Api) (*AggregatedCostClient, error) { +func NewAggregatedCostClientWithBaseURI(api sdkEnv.Api) (*AggregatedCostClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "aggregatedcost", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AggregatedCostClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/balances/client.go b/resource-manager/consumption/2021-10-01/balances/client.go index d1fbf8148d0..971aee221a1 100644 --- a/resource-manager/consumption/2021-10-01/balances/client.go +++ b/resource-manager/consumption/2021-10-01/balances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BalancesClient struct { Client *resourcemanager.Client } -func NewBalancesClientWithBaseURI(api environments.Api) (*BalancesClient, error) { +func NewBalancesClientWithBaseURI(api sdkEnv.Api) (*BalancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "balances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BalancesClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/budgets/client.go b/resource-manager/consumption/2021-10-01/budgets/client.go index 54abced399c..3f3b8d006de 100644 --- a/resource-manager/consumption/2021-10-01/budgets/client.go +++ b/resource-manager/consumption/2021-10-01/budgets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BudgetsClient struct { Client *resourcemanager.Client } -func NewBudgetsClientWithBaseURI(api environments.Api) (*BudgetsClient, error) { +func NewBudgetsClientWithBaseURI(api sdkEnv.Api) (*BudgetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "budgets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BudgetsClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/charges/client.go b/resource-manager/consumption/2021-10-01/charges/client.go index 9975656d4b6..77fa73bffd0 100644 --- a/resource-manager/consumption/2021-10-01/charges/client.go +++ b/resource-manager/consumption/2021-10-01/charges/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ChargesClient struct { Client *resourcemanager.Client } -func NewChargesClientWithBaseURI(api environments.Api) (*ChargesClient, error) { +func NewChargesClientWithBaseURI(api sdkEnv.Api) (*ChargesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "charges", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ChargesClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/client.go b/resource-manager/consumption/2021-10-01/client.go index b2f532706c4..60ecadaed1f 100644 --- a/resource-manager/consumption/2021-10-01/client.go +++ b/resource-manager/consumption/2021-10-01/client.go @@ -22,7 +22,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2021-10-01/reservationtransactions" "github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2021-10-01/usagedetails" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -43,7 +43,7 @@ type Client struct { UsageDetails *usagedetails.UsageDetailsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { aggregatedCostClient, err := aggregatedcost.NewAggregatedCostClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AggregatedCost client: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/credits/client.go b/resource-manager/consumption/2021-10-01/credits/client.go index 46ccf59f2bd..9b474f2ce05 100644 --- a/resource-manager/consumption/2021-10-01/credits/client.go +++ b/resource-manager/consumption/2021-10-01/credits/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CreditsClient struct { Client *resourcemanager.Client } -func NewCreditsClientWithBaseURI(api environments.Api) (*CreditsClient, error) { +func NewCreditsClientWithBaseURI(api sdkEnv.Api) (*CreditsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "credits", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CreditsClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/events/client.go b/resource-manager/consumption/2021-10-01/events/client.go index f6d343c073d..8ba79590d92 100644 --- a/resource-manager/consumption/2021-10-01/events/client.go +++ b/resource-manager/consumption/2021-10-01/events/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventsClient struct { Client *resourcemanager.Client } -func NewEventsClientWithBaseURI(api environments.Api) (*EventsClient, error) { +func NewEventsClientWithBaseURI(api sdkEnv.Api) (*EventsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "events", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventsClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/lots/client.go b/resource-manager/consumption/2021-10-01/lots/client.go index 535305596ba..6fce2ff3d67 100644 --- a/resource-manager/consumption/2021-10-01/lots/client.go +++ b/resource-manager/consumption/2021-10-01/lots/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LotsClient struct { Client *resourcemanager.Client } -func NewLotsClientWithBaseURI(api environments.Api) (*LotsClient, error) { +func NewLotsClientWithBaseURI(api sdkEnv.Api) (*LotsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "lots", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LotsClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/marketplaces/client.go b/resource-manager/consumption/2021-10-01/marketplaces/client.go index f107593d812..98233de23e3 100644 --- a/resource-manager/consumption/2021-10-01/marketplaces/client.go +++ b/resource-manager/consumption/2021-10-01/marketplaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MarketplacesClient struct { Client *resourcemanager.Client } -func NewMarketplacesClientWithBaseURI(api environments.Api) (*MarketplacesClient, error) { +func NewMarketplacesClientWithBaseURI(api sdkEnv.Api) (*MarketplacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "marketplaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MarketplacesClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/pricesheet/client.go b/resource-manager/consumption/2021-10-01/pricesheet/client.go index c9fa7425b77..4ecfaa287d8 100644 --- a/resource-manager/consumption/2021-10-01/pricesheet/client.go +++ b/resource-manager/consumption/2021-10-01/pricesheet/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PriceSheetClient struct { Client *resourcemanager.Client } -func NewPriceSheetClientWithBaseURI(api environments.Api) (*PriceSheetClient, error) { +func NewPriceSheetClientWithBaseURI(api sdkEnv.Api) (*PriceSheetClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "pricesheet", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PriceSheetClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/reservationdetails/client.go b/resource-manager/consumption/2021-10-01/reservationdetails/client.go index 3e118a5d9dd..65e64b06fca 100644 --- a/resource-manager/consumption/2021-10-01/reservationdetails/client.go +++ b/resource-manager/consumption/2021-10-01/reservationdetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationDetailsClient struct { Client *resourcemanager.Client } -func NewReservationDetailsClientWithBaseURI(api environments.Api) (*ReservationDetailsClient, error) { +func NewReservationDetailsClientWithBaseURI(api sdkEnv.Api) (*ReservationDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationdetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationDetailsClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/reservationrecommendationdetails/client.go b/resource-manager/consumption/2021-10-01/reservationrecommendationdetails/client.go index 5e7fa22d013..67162ea2284 100644 --- a/resource-manager/consumption/2021-10-01/reservationrecommendationdetails/client.go +++ b/resource-manager/consumption/2021-10-01/reservationrecommendationdetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationRecommendationDetailsClient struct { Client *resourcemanager.Client } -func NewReservationRecommendationDetailsClientWithBaseURI(api environments.Api) (*ReservationRecommendationDetailsClient, error) { +func NewReservationRecommendationDetailsClientWithBaseURI(api sdkEnv.Api) (*ReservationRecommendationDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationrecommendationdetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationRecommendationDetailsClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/reservationrecommendations/client.go b/resource-manager/consumption/2021-10-01/reservationrecommendations/client.go index da6b39f69b5..1255899e2cf 100644 --- a/resource-manager/consumption/2021-10-01/reservationrecommendations/client.go +++ b/resource-manager/consumption/2021-10-01/reservationrecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationRecommendationsClient struct { Client *resourcemanager.Client } -func NewReservationRecommendationsClientWithBaseURI(api environments.Api) (*ReservationRecommendationsClient, error) { +func NewReservationRecommendationsClientWithBaseURI(api sdkEnv.Api) (*ReservationRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationrecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationRecommendationsClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/reservationsummaries/client.go b/resource-manager/consumption/2021-10-01/reservationsummaries/client.go index 3e18b072ece..f2115ec9106 100644 --- a/resource-manager/consumption/2021-10-01/reservationsummaries/client.go +++ b/resource-manager/consumption/2021-10-01/reservationsummaries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationSummariesClient struct { Client *resourcemanager.Client } -func NewReservationSummariesClientWithBaseURI(api environments.Api) (*ReservationSummariesClient, error) { +func NewReservationSummariesClientWithBaseURI(api sdkEnv.Api) (*ReservationSummariesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationsummaries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationSummariesClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/reservationtransactions/client.go b/resource-manager/consumption/2021-10-01/reservationtransactions/client.go index 5d100f67ece..d6c9a43c04b 100644 --- a/resource-manager/consumption/2021-10-01/reservationtransactions/client.go +++ b/resource-manager/consumption/2021-10-01/reservationtransactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationTransactionsClient struct { Client *resourcemanager.Client } -func NewReservationTransactionsClientWithBaseURI(api environments.Api) (*ReservationTransactionsClient, error) { +func NewReservationTransactionsClientWithBaseURI(api sdkEnv.Api) (*ReservationTransactionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationtransactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationTransactionsClient: %+v", err) diff --git a/resource-manager/consumption/2021-10-01/usagedetails/client.go b/resource-manager/consumption/2021-10-01/usagedetails/client.go index 4b5d6b7fac9..fe0903d61e6 100644 --- a/resource-manager/consumption/2021-10-01/usagedetails/client.go +++ b/resource-manager/consumption/2021-10-01/usagedetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsageDetailsClient struct { Client *resourcemanager.Client } -func NewUsageDetailsClientWithBaseURI(api environments.Api) (*UsageDetailsClient, error) { +func NewUsageDetailsClientWithBaseURI(api sdkEnv.Api) (*UsageDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usagedetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsageDetailsClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/aggregatedcost/client.go b/resource-manager/consumption/2022-09-01/aggregatedcost/client.go index 7d1286c8153..0dff50459dc 100644 --- a/resource-manager/consumption/2022-09-01/aggregatedcost/client.go +++ b/resource-manager/consumption/2022-09-01/aggregatedcost/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AggregatedCostClient struct { Client *resourcemanager.Client } -func NewAggregatedCostClientWithBaseURI(api environments.Api) (*AggregatedCostClient, error) { +func NewAggregatedCostClientWithBaseURI(api sdkEnv.Api) (*AggregatedCostClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "aggregatedcost", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AggregatedCostClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/balances/client.go b/resource-manager/consumption/2022-09-01/balances/client.go index d1fbf8148d0..971aee221a1 100644 --- a/resource-manager/consumption/2022-09-01/balances/client.go +++ b/resource-manager/consumption/2022-09-01/balances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BalancesClient struct { Client *resourcemanager.Client } -func NewBalancesClientWithBaseURI(api environments.Api) (*BalancesClient, error) { +func NewBalancesClientWithBaseURI(api sdkEnv.Api) (*BalancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "balances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BalancesClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/budgets/client.go b/resource-manager/consumption/2022-09-01/budgets/client.go index 54abced399c..3f3b8d006de 100644 --- a/resource-manager/consumption/2022-09-01/budgets/client.go +++ b/resource-manager/consumption/2022-09-01/budgets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BudgetsClient struct { Client *resourcemanager.Client } -func NewBudgetsClientWithBaseURI(api environments.Api) (*BudgetsClient, error) { +func NewBudgetsClientWithBaseURI(api sdkEnv.Api) (*BudgetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "budgets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BudgetsClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/charges/client.go b/resource-manager/consumption/2022-09-01/charges/client.go index 9975656d4b6..77fa73bffd0 100644 --- a/resource-manager/consumption/2022-09-01/charges/client.go +++ b/resource-manager/consumption/2022-09-01/charges/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ChargesClient struct { Client *resourcemanager.Client } -func NewChargesClientWithBaseURI(api environments.Api) (*ChargesClient, error) { +func NewChargesClientWithBaseURI(api sdkEnv.Api) (*ChargesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "charges", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ChargesClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/client.go b/resource-manager/consumption/2022-09-01/client.go index 32a4a557db7..07ae8273d81 100644 --- a/resource-manager/consumption/2022-09-01/client.go +++ b/resource-manager/consumption/2022-09-01/client.go @@ -22,7 +22,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2022-09-01/reservationtransactions" "github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2022-09-01/usagedetails" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -43,7 +43,7 @@ type Client struct { UsageDetails *usagedetails.UsageDetailsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { aggregatedCostClient, err := aggregatedcost.NewAggregatedCostClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AggregatedCost client: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/credits/client.go b/resource-manager/consumption/2022-09-01/credits/client.go index 46ccf59f2bd..9b474f2ce05 100644 --- a/resource-manager/consumption/2022-09-01/credits/client.go +++ b/resource-manager/consumption/2022-09-01/credits/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CreditsClient struct { Client *resourcemanager.Client } -func NewCreditsClientWithBaseURI(api environments.Api) (*CreditsClient, error) { +func NewCreditsClientWithBaseURI(api sdkEnv.Api) (*CreditsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "credits", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CreditsClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/events/client.go b/resource-manager/consumption/2022-09-01/events/client.go index f6d343c073d..8ba79590d92 100644 --- a/resource-manager/consumption/2022-09-01/events/client.go +++ b/resource-manager/consumption/2022-09-01/events/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventsClient struct { Client *resourcemanager.Client } -func NewEventsClientWithBaseURI(api environments.Api) (*EventsClient, error) { +func NewEventsClientWithBaseURI(api sdkEnv.Api) (*EventsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "events", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventsClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/lots/client.go b/resource-manager/consumption/2022-09-01/lots/client.go index 535305596ba..6fce2ff3d67 100644 --- a/resource-manager/consumption/2022-09-01/lots/client.go +++ b/resource-manager/consumption/2022-09-01/lots/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LotsClient struct { Client *resourcemanager.Client } -func NewLotsClientWithBaseURI(api environments.Api) (*LotsClient, error) { +func NewLotsClientWithBaseURI(api sdkEnv.Api) (*LotsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "lots", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LotsClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/marketplaces/client.go b/resource-manager/consumption/2022-09-01/marketplaces/client.go index f107593d812..98233de23e3 100644 --- a/resource-manager/consumption/2022-09-01/marketplaces/client.go +++ b/resource-manager/consumption/2022-09-01/marketplaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MarketplacesClient struct { Client *resourcemanager.Client } -func NewMarketplacesClientWithBaseURI(api environments.Api) (*MarketplacesClient, error) { +func NewMarketplacesClientWithBaseURI(api sdkEnv.Api) (*MarketplacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "marketplaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MarketplacesClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/pricesheet/client.go b/resource-manager/consumption/2022-09-01/pricesheet/client.go index c9fa7425b77..4ecfaa287d8 100644 --- a/resource-manager/consumption/2022-09-01/pricesheet/client.go +++ b/resource-manager/consumption/2022-09-01/pricesheet/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PriceSheetClient struct { Client *resourcemanager.Client } -func NewPriceSheetClientWithBaseURI(api environments.Api) (*PriceSheetClient, error) { +func NewPriceSheetClientWithBaseURI(api sdkEnv.Api) (*PriceSheetClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "pricesheet", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PriceSheetClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/reservationdetails/client.go b/resource-manager/consumption/2022-09-01/reservationdetails/client.go index 3e118a5d9dd..65e64b06fca 100644 --- a/resource-manager/consumption/2022-09-01/reservationdetails/client.go +++ b/resource-manager/consumption/2022-09-01/reservationdetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationDetailsClient struct { Client *resourcemanager.Client } -func NewReservationDetailsClientWithBaseURI(api environments.Api) (*ReservationDetailsClient, error) { +func NewReservationDetailsClientWithBaseURI(api sdkEnv.Api) (*ReservationDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationdetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationDetailsClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/reservationrecommendationdetails/client.go b/resource-manager/consumption/2022-09-01/reservationrecommendationdetails/client.go index 5e7fa22d013..67162ea2284 100644 --- a/resource-manager/consumption/2022-09-01/reservationrecommendationdetails/client.go +++ b/resource-manager/consumption/2022-09-01/reservationrecommendationdetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationRecommendationDetailsClient struct { Client *resourcemanager.Client } -func NewReservationRecommendationDetailsClientWithBaseURI(api environments.Api) (*ReservationRecommendationDetailsClient, error) { +func NewReservationRecommendationDetailsClientWithBaseURI(api sdkEnv.Api) (*ReservationRecommendationDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationrecommendationdetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationRecommendationDetailsClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/reservationrecommendations/client.go b/resource-manager/consumption/2022-09-01/reservationrecommendations/client.go index da6b39f69b5..1255899e2cf 100644 --- a/resource-manager/consumption/2022-09-01/reservationrecommendations/client.go +++ b/resource-manager/consumption/2022-09-01/reservationrecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationRecommendationsClient struct { Client *resourcemanager.Client } -func NewReservationRecommendationsClientWithBaseURI(api environments.Api) (*ReservationRecommendationsClient, error) { +func NewReservationRecommendationsClientWithBaseURI(api sdkEnv.Api) (*ReservationRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationrecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationRecommendationsClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/reservationsummaries/client.go b/resource-manager/consumption/2022-09-01/reservationsummaries/client.go index 3e18b072ece..f2115ec9106 100644 --- a/resource-manager/consumption/2022-09-01/reservationsummaries/client.go +++ b/resource-manager/consumption/2022-09-01/reservationsummaries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationSummariesClient struct { Client *resourcemanager.Client } -func NewReservationSummariesClientWithBaseURI(api environments.Api) (*ReservationSummariesClient, error) { +func NewReservationSummariesClientWithBaseURI(api sdkEnv.Api) (*ReservationSummariesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationsummaries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationSummariesClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/reservationtransactions/client.go b/resource-manager/consumption/2022-09-01/reservationtransactions/client.go index 5d100f67ece..d6c9a43c04b 100644 --- a/resource-manager/consumption/2022-09-01/reservationtransactions/client.go +++ b/resource-manager/consumption/2022-09-01/reservationtransactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationTransactionsClient struct { Client *resourcemanager.Client } -func NewReservationTransactionsClientWithBaseURI(api environments.Api) (*ReservationTransactionsClient, error) { +func NewReservationTransactionsClientWithBaseURI(api sdkEnv.Api) (*ReservationTransactionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationtransactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationTransactionsClient: %+v", err) diff --git a/resource-manager/consumption/2022-09-01/usagedetails/client.go b/resource-manager/consumption/2022-09-01/usagedetails/client.go index 4b5d6b7fac9..fe0903d61e6 100644 --- a/resource-manager/consumption/2022-09-01/usagedetails/client.go +++ b/resource-manager/consumption/2022-09-01/usagedetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsageDetailsClient struct { Client *resourcemanager.Client } -func NewUsageDetailsClientWithBaseURI(api environments.Api) (*UsageDetailsClient, error) { +func NewUsageDetailsClientWithBaseURI(api sdkEnv.Api) (*UsageDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usagedetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsageDetailsClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/aggregatedcost/client.go b/resource-manager/consumption/2023-05-01/aggregatedcost/client.go index 7d1286c8153..0dff50459dc 100644 --- a/resource-manager/consumption/2023-05-01/aggregatedcost/client.go +++ b/resource-manager/consumption/2023-05-01/aggregatedcost/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AggregatedCostClient struct { Client *resourcemanager.Client } -func NewAggregatedCostClientWithBaseURI(api environments.Api) (*AggregatedCostClient, error) { +func NewAggregatedCostClientWithBaseURI(api sdkEnv.Api) (*AggregatedCostClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "aggregatedcost", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AggregatedCostClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/balances/client.go b/resource-manager/consumption/2023-05-01/balances/client.go index d1fbf8148d0..971aee221a1 100644 --- a/resource-manager/consumption/2023-05-01/balances/client.go +++ b/resource-manager/consumption/2023-05-01/balances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BalancesClient struct { Client *resourcemanager.Client } -func NewBalancesClientWithBaseURI(api environments.Api) (*BalancesClient, error) { +func NewBalancesClientWithBaseURI(api sdkEnv.Api) (*BalancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "balances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BalancesClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/budgets/client.go b/resource-manager/consumption/2023-05-01/budgets/client.go index 54abced399c..3f3b8d006de 100644 --- a/resource-manager/consumption/2023-05-01/budgets/client.go +++ b/resource-manager/consumption/2023-05-01/budgets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BudgetsClient struct { Client *resourcemanager.Client } -func NewBudgetsClientWithBaseURI(api environments.Api) (*BudgetsClient, error) { +func NewBudgetsClientWithBaseURI(api sdkEnv.Api) (*BudgetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "budgets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BudgetsClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/charges/client.go b/resource-manager/consumption/2023-05-01/charges/client.go index 9975656d4b6..77fa73bffd0 100644 --- a/resource-manager/consumption/2023-05-01/charges/client.go +++ b/resource-manager/consumption/2023-05-01/charges/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ChargesClient struct { Client *resourcemanager.Client } -func NewChargesClientWithBaseURI(api environments.Api) (*ChargesClient, error) { +func NewChargesClientWithBaseURI(api sdkEnv.Api) (*ChargesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "charges", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ChargesClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/client.go b/resource-manager/consumption/2023-05-01/client.go index 0213938a54c..0e119b89eb1 100644 --- a/resource-manager/consumption/2023-05-01/client.go +++ b/resource-manager/consumption/2023-05-01/client.go @@ -22,7 +22,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2023-05-01/reservationtransactions" "github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2023-05-01/usagedetails" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -43,7 +43,7 @@ type Client struct { UsageDetails *usagedetails.UsageDetailsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { aggregatedCostClient, err := aggregatedcost.NewAggregatedCostClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AggregatedCost client: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/credits/client.go b/resource-manager/consumption/2023-05-01/credits/client.go index 46ccf59f2bd..9b474f2ce05 100644 --- a/resource-manager/consumption/2023-05-01/credits/client.go +++ b/resource-manager/consumption/2023-05-01/credits/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CreditsClient struct { Client *resourcemanager.Client } -func NewCreditsClientWithBaseURI(api environments.Api) (*CreditsClient, error) { +func NewCreditsClientWithBaseURI(api sdkEnv.Api) (*CreditsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "credits", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CreditsClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/events/client.go b/resource-manager/consumption/2023-05-01/events/client.go index f6d343c073d..8ba79590d92 100644 --- a/resource-manager/consumption/2023-05-01/events/client.go +++ b/resource-manager/consumption/2023-05-01/events/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventsClient struct { Client *resourcemanager.Client } -func NewEventsClientWithBaseURI(api environments.Api) (*EventsClient, error) { +func NewEventsClientWithBaseURI(api sdkEnv.Api) (*EventsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "events", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventsClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/lots/client.go b/resource-manager/consumption/2023-05-01/lots/client.go index 535305596ba..6fce2ff3d67 100644 --- a/resource-manager/consumption/2023-05-01/lots/client.go +++ b/resource-manager/consumption/2023-05-01/lots/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LotsClient struct { Client *resourcemanager.Client } -func NewLotsClientWithBaseURI(api environments.Api) (*LotsClient, error) { +func NewLotsClientWithBaseURI(api sdkEnv.Api) (*LotsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "lots", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LotsClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/marketplaces/client.go b/resource-manager/consumption/2023-05-01/marketplaces/client.go index f107593d812..98233de23e3 100644 --- a/resource-manager/consumption/2023-05-01/marketplaces/client.go +++ b/resource-manager/consumption/2023-05-01/marketplaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MarketplacesClient struct { Client *resourcemanager.Client } -func NewMarketplacesClientWithBaseURI(api environments.Api) (*MarketplacesClient, error) { +func NewMarketplacesClientWithBaseURI(api sdkEnv.Api) (*MarketplacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "marketplaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MarketplacesClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/pricesheet/client.go b/resource-manager/consumption/2023-05-01/pricesheet/client.go index c9fa7425b77..4ecfaa287d8 100644 --- a/resource-manager/consumption/2023-05-01/pricesheet/client.go +++ b/resource-manager/consumption/2023-05-01/pricesheet/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PriceSheetClient struct { Client *resourcemanager.Client } -func NewPriceSheetClientWithBaseURI(api environments.Api) (*PriceSheetClient, error) { +func NewPriceSheetClientWithBaseURI(api sdkEnv.Api) (*PriceSheetClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "pricesheet", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PriceSheetClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/reservationdetails/client.go b/resource-manager/consumption/2023-05-01/reservationdetails/client.go index 3e118a5d9dd..65e64b06fca 100644 --- a/resource-manager/consumption/2023-05-01/reservationdetails/client.go +++ b/resource-manager/consumption/2023-05-01/reservationdetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationDetailsClient struct { Client *resourcemanager.Client } -func NewReservationDetailsClientWithBaseURI(api environments.Api) (*ReservationDetailsClient, error) { +func NewReservationDetailsClientWithBaseURI(api sdkEnv.Api) (*ReservationDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationdetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationDetailsClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/reservationrecommendationdetails/client.go b/resource-manager/consumption/2023-05-01/reservationrecommendationdetails/client.go index 5e7fa22d013..67162ea2284 100644 --- a/resource-manager/consumption/2023-05-01/reservationrecommendationdetails/client.go +++ b/resource-manager/consumption/2023-05-01/reservationrecommendationdetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationRecommendationDetailsClient struct { Client *resourcemanager.Client } -func NewReservationRecommendationDetailsClientWithBaseURI(api environments.Api) (*ReservationRecommendationDetailsClient, error) { +func NewReservationRecommendationDetailsClientWithBaseURI(api sdkEnv.Api) (*ReservationRecommendationDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationrecommendationdetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationRecommendationDetailsClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/reservationrecommendations/client.go b/resource-manager/consumption/2023-05-01/reservationrecommendations/client.go index da6b39f69b5..1255899e2cf 100644 --- a/resource-manager/consumption/2023-05-01/reservationrecommendations/client.go +++ b/resource-manager/consumption/2023-05-01/reservationrecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationRecommendationsClient struct { Client *resourcemanager.Client } -func NewReservationRecommendationsClientWithBaseURI(api environments.Api) (*ReservationRecommendationsClient, error) { +func NewReservationRecommendationsClientWithBaseURI(api sdkEnv.Api) (*ReservationRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationrecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationRecommendationsClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/reservationsummaries/client.go b/resource-manager/consumption/2023-05-01/reservationsummaries/client.go index 3e18b072ece..f2115ec9106 100644 --- a/resource-manager/consumption/2023-05-01/reservationsummaries/client.go +++ b/resource-manager/consumption/2023-05-01/reservationsummaries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationSummariesClient struct { Client *resourcemanager.Client } -func NewReservationSummariesClientWithBaseURI(api environments.Api) (*ReservationSummariesClient, error) { +func NewReservationSummariesClientWithBaseURI(api sdkEnv.Api) (*ReservationSummariesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationsummaries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationSummariesClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/reservationtransactions/client.go b/resource-manager/consumption/2023-05-01/reservationtransactions/client.go index 5d100f67ece..d6c9a43c04b 100644 --- a/resource-manager/consumption/2023-05-01/reservationtransactions/client.go +++ b/resource-manager/consumption/2023-05-01/reservationtransactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservationTransactionsClient struct { Client *resourcemanager.Client } -func NewReservationTransactionsClientWithBaseURI(api environments.Api) (*ReservationTransactionsClient, error) { +func NewReservationTransactionsClientWithBaseURI(api sdkEnv.Api) (*ReservationTransactionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservationtransactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservationTransactionsClient: %+v", err) diff --git a/resource-manager/consumption/2023-05-01/usagedetails/client.go b/resource-manager/consumption/2023-05-01/usagedetails/client.go index 4b5d6b7fac9..fe0903d61e6 100644 --- a/resource-manager/consumption/2023-05-01/usagedetails/client.go +++ b/resource-manager/consumption/2023-05-01/usagedetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsageDetailsClient struct { Client *resourcemanager.Client } -func NewUsageDetailsClientWithBaseURI(api environments.Api) (*UsageDetailsClient, error) { +func NewUsageDetailsClientWithBaseURI(api sdkEnv.Api) (*UsageDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usagedetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsageDetailsClient: %+v", err) diff --git a/resource-manager/containerregistry/2019-06-01-preview/agentpools/client.go b/resource-manager/containerregistry/2019-06-01-preview/agentpools/client.go index a51f96e2afe..53190ddf34e 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/agentpools/client.go +++ b/resource-manager/containerregistry/2019-06-01-preview/agentpools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AgentPoolsClient struct { Client *resourcemanager.Client } -func NewAgentPoolsClientWithBaseURI(api environments.Api) (*AgentPoolsClient, error) { +func NewAgentPoolsClientWithBaseURI(api sdkEnv.Api) (*AgentPoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "agentpools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AgentPoolsClient: %+v", err) diff --git a/resource-manager/containerregistry/2019-06-01-preview/client.go b/resource-manager/containerregistry/2019-06-01-preview/client.go index f8c64762c1b..be4cd5f5e2e 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/client.go +++ b/resource-manager/containerregistry/2019-06-01-preview/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2019-06-01-preview/taskruns" "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2019-06-01-preview/tasks" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { Tasks *tasks.TasksClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { agentPoolsClient, err := agentpools.NewAgentPoolsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AgentPools client: %+v", err) diff --git a/resource-manager/containerregistry/2019-06-01-preview/registries/client.go b/resource-manager/containerregistry/2019-06-01-preview/registries/client.go index fae7acdc3ed..6fde879f729 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/registries/client.go +++ b/resource-manager/containerregistry/2019-06-01-preview/registries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RegistriesClient struct { Client *resourcemanager.Client } -func NewRegistriesClientWithBaseURI(api environments.Api) (*RegistriesClient, error) { +func NewRegistriesClientWithBaseURI(api sdkEnv.Api) (*RegistriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "registries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RegistriesClient: %+v", err) diff --git a/resource-manager/containerregistry/2019-06-01-preview/runs/client.go b/resource-manager/containerregistry/2019-06-01-preview/runs/client.go index bb154fc767a..5c224fce423 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/runs/client.go +++ b/resource-manager/containerregistry/2019-06-01-preview/runs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RunsClient struct { Client *resourcemanager.Client } -func NewRunsClientWithBaseURI(api environments.Api) (*RunsClient, error) { +func NewRunsClientWithBaseURI(api sdkEnv.Api) (*RunsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "runs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RunsClient: %+v", err) diff --git a/resource-manager/containerregistry/2019-06-01-preview/taskruns/client.go b/resource-manager/containerregistry/2019-06-01-preview/taskruns/client.go index 896adbb84d0..bdfa57224ec 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/taskruns/client.go +++ b/resource-manager/containerregistry/2019-06-01-preview/taskruns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TaskRunsClient struct { Client *resourcemanager.Client } -func NewTaskRunsClientWithBaseURI(api environments.Api) (*TaskRunsClient, error) { +func NewTaskRunsClientWithBaseURI(api sdkEnv.Api) (*TaskRunsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "taskruns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TaskRunsClient: %+v", err) diff --git a/resource-manager/containerregistry/2019-06-01-preview/tasks/client.go b/resource-manager/containerregistry/2019-06-01-preview/tasks/client.go index 5b75ccb3dc6..25fff74bd4b 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/tasks/client.go +++ b/resource-manager/containerregistry/2019-06-01-preview/tasks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TasksClient struct { Client *resourcemanager.Client } -func NewTasksClientWithBaseURI(api environments.Api) (*TasksClient, error) { +func NewTasksClientWithBaseURI(api sdkEnv.Api) (*TasksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tasks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TasksClient: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/client.go b/resource-manager/containerregistry/2021-08-01-preview/client.go index 2b9fedf7f34..17c8a08911a 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/client.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2021-08-01-preview/tokens" "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2021-08-01-preview/webhooks" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -35,7 +35,7 @@ type Client struct { WebHooks *webhooks.WebHooksClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { connectedRegistriesClient, err := connectedregistries.NewConnectedRegistriesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ConnectedRegistries client: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/client.go b/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/client.go index 09c025eb0e7..f586b081448 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConnectedRegistriesClient struct { Client *resourcemanager.Client } -func NewConnectedRegistriesClientWithBaseURI(api environments.Api) (*ConnectedRegistriesClient, error) { +func NewConnectedRegistriesClientWithBaseURI(api sdkEnv.Api) (*ConnectedRegistriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "connectedregistries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConnectedRegistriesClient: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/client.go b/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/client.go index edac6b0631c..4fbe92df9e0 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExportPipelinesClient struct { Client *resourcemanager.Client } -func NewExportPipelinesClientWithBaseURI(api environments.Api) (*ExportPipelinesClient, error) { +func NewExportPipelinesClientWithBaseURI(api sdkEnv.Api) (*ExportPipelinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "exportpipelines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExportPipelinesClient: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/importpipelines/client.go b/resource-manager/containerregistry/2021-08-01-preview/importpipelines/client.go index 503ccbbaf57..cec34f846d0 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/importpipelines/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/importpipelines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ImportPipelinesClient struct { Client *resourcemanager.Client } -func NewImportPipelinesClientWithBaseURI(api environments.Api) (*ImportPipelinesClient, error) { +func NewImportPipelinesClientWithBaseURI(api sdkEnv.Api) (*ImportPipelinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "importpipelines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ImportPipelinesClient: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/operation/client.go b/resource-manager/containerregistry/2021-08-01-preview/operation/client.go index 4eb94974b7d..c4e3a72e9bb 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/operation/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/operation/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationClient struct { Client *resourcemanager.Client } -func NewOperationClientWithBaseURI(api environments.Api) (*OperationClient, error) { +func NewOperationClientWithBaseURI(api sdkEnv.Api) (*OperationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operation", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationClient: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/client.go b/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/client.go index 1bf576f2a24..28ec00fc74b 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PipelineRunsClient struct { Client *resourcemanager.Client } -func NewPipelineRunsClientWithBaseURI(api environments.Api) (*PipelineRunsClient, error) { +func NewPipelineRunsClientWithBaseURI(api sdkEnv.Api) (*PipelineRunsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "pipelineruns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PipelineRunsClient: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/client.go b/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/registries/client.go b/resource-manager/containerregistry/2021-08-01-preview/registries/client.go index fae7acdc3ed..6fde879f729 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/registries/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/registries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RegistriesClient struct { Client *resourcemanager.Client } -func NewRegistriesClientWithBaseURI(api environments.Api) (*RegistriesClient, error) { +func NewRegistriesClientWithBaseURI(api sdkEnv.Api) (*RegistriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "registries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RegistriesClient: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/replications/client.go b/resource-manager/containerregistry/2021-08-01-preview/replications/client.go index a49b967d6d0..aed60c34fe7 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/replications/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/replications/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReplicationsClient struct { Client *resourcemanager.Client } -func NewReplicationsClientWithBaseURI(api environments.Api) (*ReplicationsClient, error) { +func NewReplicationsClientWithBaseURI(api sdkEnv.Api) (*ReplicationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "replications", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReplicationsClient: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/scopemaps/client.go b/resource-manager/containerregistry/2021-08-01-preview/scopemaps/client.go index 014790b02f7..495cfad177f 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/scopemaps/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/scopemaps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScopeMapsClient struct { Client *resourcemanager.Client } -func NewScopeMapsClientWithBaseURI(api environments.Api) (*ScopeMapsClient, error) { +func NewScopeMapsClientWithBaseURI(api sdkEnv.Api) (*ScopeMapsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scopemaps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScopeMapsClient: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/tokens/client.go b/resource-manager/containerregistry/2021-08-01-preview/tokens/client.go index c4e34293912..1fec1d157b8 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/tokens/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/tokens/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TokensClient struct { Client *resourcemanager.Client } -func NewTokensClientWithBaseURI(api environments.Api) (*TokensClient, error) { +func NewTokensClientWithBaseURI(api sdkEnv.Api) (*TokensClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tokens", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TokensClient: %+v", err) diff --git a/resource-manager/containerregistry/2021-08-01-preview/webhooks/client.go b/resource-manager/containerregistry/2021-08-01-preview/webhooks/client.go index 2dabb50a22f..776b6f38d9d 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/webhooks/client.go +++ b/resource-manager/containerregistry/2021-08-01-preview/webhooks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WebHooksClient struct { Client *resourcemanager.Client } -func NewWebHooksClientWithBaseURI(api environments.Api) (*WebHooksClient, error) { +func NewWebHooksClientWithBaseURI(api sdkEnv.Api) (*WebHooksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "webhooks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WebHooksClient: %+v", err) diff --git a/resource-manager/containerregistry/2022-12-01/client.go b/resource-manager/containerregistry/2022-12-01/client.go index 9db39cb51ee..53e43cada5a 100644 --- a/resource-manager/containerregistry/2022-12-01/client.go +++ b/resource-manager/containerregistry/2022-12-01/client.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2022-12-01/tokens" "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2022-12-01/webhooks" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -27,7 +27,7 @@ type Client struct { WebHooks *webhooks.WebHooksClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { operationClient, err := operation.NewOperationClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Operation client: %+v", err) diff --git a/resource-manager/containerregistry/2022-12-01/operation/client.go b/resource-manager/containerregistry/2022-12-01/operation/client.go index 4eb94974b7d..c4e3a72e9bb 100644 --- a/resource-manager/containerregistry/2022-12-01/operation/client.go +++ b/resource-manager/containerregistry/2022-12-01/operation/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationClient struct { Client *resourcemanager.Client } -func NewOperationClientWithBaseURI(api environments.Api) (*OperationClient, error) { +func NewOperationClientWithBaseURI(api sdkEnv.Api) (*OperationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operation", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationClient: %+v", err) diff --git a/resource-manager/containerregistry/2022-12-01/privateendpointconnections/client.go b/resource-manager/containerregistry/2022-12-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/containerregistry/2022-12-01/privateendpointconnections/client.go +++ b/resource-manager/containerregistry/2022-12-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/containerregistry/2022-12-01/registries/client.go b/resource-manager/containerregistry/2022-12-01/registries/client.go index fae7acdc3ed..6fde879f729 100644 --- a/resource-manager/containerregistry/2022-12-01/registries/client.go +++ b/resource-manager/containerregistry/2022-12-01/registries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RegistriesClient struct { Client *resourcemanager.Client } -func NewRegistriesClientWithBaseURI(api environments.Api) (*RegistriesClient, error) { +func NewRegistriesClientWithBaseURI(api sdkEnv.Api) (*RegistriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "registries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RegistriesClient: %+v", err) diff --git a/resource-manager/containerregistry/2022-12-01/replications/client.go b/resource-manager/containerregistry/2022-12-01/replications/client.go index a49b967d6d0..aed60c34fe7 100644 --- a/resource-manager/containerregistry/2022-12-01/replications/client.go +++ b/resource-manager/containerregistry/2022-12-01/replications/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReplicationsClient struct { Client *resourcemanager.Client } -func NewReplicationsClientWithBaseURI(api environments.Api) (*ReplicationsClient, error) { +func NewReplicationsClientWithBaseURI(api sdkEnv.Api) (*ReplicationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "replications", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReplicationsClient: %+v", err) diff --git a/resource-manager/containerregistry/2022-12-01/scopemaps/client.go b/resource-manager/containerregistry/2022-12-01/scopemaps/client.go index 014790b02f7..495cfad177f 100644 --- a/resource-manager/containerregistry/2022-12-01/scopemaps/client.go +++ b/resource-manager/containerregistry/2022-12-01/scopemaps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScopeMapsClient struct { Client *resourcemanager.Client } -func NewScopeMapsClientWithBaseURI(api environments.Api) (*ScopeMapsClient, error) { +func NewScopeMapsClientWithBaseURI(api sdkEnv.Api) (*ScopeMapsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scopemaps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScopeMapsClient: %+v", err) diff --git a/resource-manager/containerregistry/2022-12-01/tokens/client.go b/resource-manager/containerregistry/2022-12-01/tokens/client.go index c4e34293912..1fec1d157b8 100644 --- a/resource-manager/containerregistry/2022-12-01/tokens/client.go +++ b/resource-manager/containerregistry/2022-12-01/tokens/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TokensClient struct { Client *resourcemanager.Client } -func NewTokensClientWithBaseURI(api environments.Api) (*TokensClient, error) { +func NewTokensClientWithBaseURI(api sdkEnv.Api) (*TokensClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tokens", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TokensClient: %+v", err) diff --git a/resource-manager/containerregistry/2022-12-01/webhooks/client.go b/resource-manager/containerregistry/2022-12-01/webhooks/client.go index 2dabb50a22f..776b6f38d9d 100644 --- a/resource-manager/containerregistry/2022-12-01/webhooks/client.go +++ b/resource-manager/containerregistry/2022-12-01/webhooks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WebHooksClient struct { Client *resourcemanager.Client } -func NewWebHooksClientWithBaseURI(api environments.Api) (*WebHooksClient, error) { +func NewWebHooksClientWithBaseURI(api sdkEnv.Api) (*WebHooksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "webhooks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WebHooksClient: %+v", err) diff --git a/resource-manager/costmanagement/2021-10-01/alerts/client.go b/resource-manager/costmanagement/2021-10-01/alerts/client.go index 87c5a0ee0b4..5ce43674784 100644 --- a/resource-manager/costmanagement/2021-10-01/alerts/client.go +++ b/resource-manager/costmanagement/2021-10-01/alerts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AlertsClient struct { Client *resourcemanager.Client } -func NewAlertsClientWithBaseURI(api environments.Api) (*AlertsClient, error) { +func NewAlertsClientWithBaseURI(api sdkEnv.Api) (*AlertsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "alerts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AlertsClient: %+v", err) diff --git a/resource-manager/costmanagement/2021-10-01/client.go b/resource-manager/costmanagement/2021-10-01/client.go index fd5ee0ed590..e9b955e2081 100644 --- a/resource-manager/costmanagement/2021-10-01/client.go +++ b/resource-manager/costmanagement/2021-10-01/client.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/usagedetails" "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/views" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -29,7 +29,7 @@ type Client struct { Views *views.ViewsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { alertsClient, err := alerts.NewAlertsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Alerts client: %+v", err) diff --git a/resource-manager/costmanagement/2021-10-01/dimensions/client.go b/resource-manager/costmanagement/2021-10-01/dimensions/client.go index 67626373f1c..3558ae24746 100644 --- a/resource-manager/costmanagement/2021-10-01/dimensions/client.go +++ b/resource-manager/costmanagement/2021-10-01/dimensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DimensionsClient struct { Client *resourcemanager.Client } -func NewDimensionsClientWithBaseURI(api environments.Api) (*DimensionsClient, error) { +func NewDimensionsClientWithBaseURI(api sdkEnv.Api) (*DimensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dimensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DimensionsClient: %+v", err) diff --git a/resource-manager/costmanagement/2021-10-01/exports/client.go b/resource-manager/costmanagement/2021-10-01/exports/client.go index 82edbb1ba89..52e48f563bb 100644 --- a/resource-manager/costmanagement/2021-10-01/exports/client.go +++ b/resource-manager/costmanagement/2021-10-01/exports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExportsClient struct { Client *resourcemanager.Client } -func NewExportsClientWithBaseURI(api environments.Api) (*ExportsClient, error) { +func NewExportsClientWithBaseURI(api sdkEnv.Api) (*ExportsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "exports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExportsClient: %+v", err) diff --git a/resource-manager/costmanagement/2021-10-01/forecast/client.go b/resource-manager/costmanagement/2021-10-01/forecast/client.go index 37ee083bf2b..d95cb2b7779 100644 --- a/resource-manager/costmanagement/2021-10-01/forecast/client.go +++ b/resource-manager/costmanagement/2021-10-01/forecast/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ForecastClient struct { Client *resourcemanager.Client } -func NewForecastClientWithBaseURI(api environments.Api) (*ForecastClient, error) { +func NewForecastClientWithBaseURI(api sdkEnv.Api) (*ForecastClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "forecast", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ForecastClient: %+v", err) diff --git a/resource-manager/costmanagement/2021-10-01/query/client.go b/resource-manager/costmanagement/2021-10-01/query/client.go index eeaebdd6b5d..72dab99adaa 100644 --- a/resource-manager/costmanagement/2021-10-01/query/client.go +++ b/resource-manager/costmanagement/2021-10-01/query/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QueryClient struct { Client *resourcemanager.Client } -func NewQueryClientWithBaseURI(api environments.Api) (*QueryClient, error) { +func NewQueryClientWithBaseURI(api sdkEnv.Api) (*QueryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "query", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QueryClient: %+v", err) diff --git a/resource-manager/costmanagement/2021-10-01/reservedinstances/client.go b/resource-manager/costmanagement/2021-10-01/reservedinstances/client.go index bbaf498ce7b..fd0aa21b578 100644 --- a/resource-manager/costmanagement/2021-10-01/reservedinstances/client.go +++ b/resource-manager/costmanagement/2021-10-01/reservedinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservedInstancesClient struct { Client *resourcemanager.Client } -func NewReservedInstancesClientWithBaseURI(api environments.Api) (*ReservedInstancesClient, error) { +func NewReservedInstancesClientWithBaseURI(api sdkEnv.Api) (*ReservedInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservedinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservedInstancesClient: %+v", err) diff --git a/resource-manager/costmanagement/2021-10-01/usagedetails/client.go b/resource-manager/costmanagement/2021-10-01/usagedetails/client.go index 4b5d6b7fac9..fe0903d61e6 100644 --- a/resource-manager/costmanagement/2021-10-01/usagedetails/client.go +++ b/resource-manager/costmanagement/2021-10-01/usagedetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsageDetailsClient struct { Client *resourcemanager.Client } -func NewUsageDetailsClientWithBaseURI(api environments.Api) (*UsageDetailsClient, error) { +func NewUsageDetailsClientWithBaseURI(api sdkEnv.Api) (*UsageDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usagedetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsageDetailsClient: %+v", err) diff --git a/resource-manager/costmanagement/2021-10-01/views/client.go b/resource-manager/costmanagement/2021-10-01/views/client.go index 44d5cb77e50..3e2b7eaf923 100644 --- a/resource-manager/costmanagement/2021-10-01/views/client.go +++ b/resource-manager/costmanagement/2021-10-01/views/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ViewsClient struct { Client *resourcemanager.Client } -func NewViewsClientWithBaseURI(api environments.Api) (*ViewsClient, error) { +func NewViewsClientWithBaseURI(api sdkEnv.Api) (*ViewsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "views", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ViewsClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-06-01-preview/client.go b/resource-manager/costmanagement/2022-06-01-preview/client.go index 5c18c4f2dfd..9ca297f7ed8 100644 --- a/resource-manager/costmanagement/2022-06-01-preview/client.go +++ b/resource-manager/costmanagement/2022-06-01-preview/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { ScheduledActions *scheduledactions.ScheduledActionsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { scheduledActionsClient, err := scheduledactions.NewScheduledActionsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ScheduledActions client: %+v", err) diff --git a/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/client.go b/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/client.go index a9621d2a137..0807aa84aa6 100644 --- a/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/client.go +++ b/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScheduledActionsClient struct { Client *resourcemanager.Client } -func NewScheduledActionsClientWithBaseURI(api environments.Api) (*ScheduledActionsClient, error) { +func NewScheduledActionsClientWithBaseURI(api sdkEnv.Api) (*ScheduledActionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scheduledactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScheduledActionsClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/alerts/client.go b/resource-manager/costmanagement/2022-10-01/alerts/client.go index 87c5a0ee0b4..5ce43674784 100644 --- a/resource-manager/costmanagement/2022-10-01/alerts/client.go +++ b/resource-manager/costmanagement/2022-10-01/alerts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AlertsClient struct { Client *resourcemanager.Client } -func NewAlertsClientWithBaseURI(api environments.Api) (*AlertsClient, error) { +func NewAlertsClientWithBaseURI(api sdkEnv.Api) (*AlertsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "alerts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AlertsClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/benefitrecommendations/client.go b/resource-manager/costmanagement/2022-10-01/benefitrecommendations/client.go index a3e8d215a6d..8e7d34a9eab 100644 --- a/resource-manager/costmanagement/2022-10-01/benefitrecommendations/client.go +++ b/resource-manager/costmanagement/2022-10-01/benefitrecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BenefitRecommendationsClient struct { Client *resourcemanager.Client } -func NewBenefitRecommendationsClientWithBaseURI(api environments.Api) (*BenefitRecommendationsClient, error) { +func NewBenefitRecommendationsClientWithBaseURI(api sdkEnv.Api) (*BenefitRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "benefitrecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BenefitRecommendationsClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/client.go b/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/client.go index 8d49e55fb08..2279f31bb68 100644 --- a/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/client.go +++ b/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BenefitUtilizationSummariesClient struct { Client *resourcemanager.Client } -func NewBenefitUtilizationSummariesClientWithBaseURI(api environments.Api) (*BenefitUtilizationSummariesClient, error) { +func NewBenefitUtilizationSummariesClientWithBaseURI(api sdkEnv.Api) (*BenefitUtilizationSummariesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "benefitutilizationsummaries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BenefitUtilizationSummariesClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/client.go b/resource-manager/costmanagement/2022-10-01/client.go index 1786e024825..468742e2fbd 100644 --- a/resource-manager/costmanagement/2022-10-01/client.go +++ b/resource-manager/costmanagement/2022-10-01/client.go @@ -20,7 +20,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-10-01/usagedetails" "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-10-01/views" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -39,7 +39,7 @@ type Client struct { Views *views.ViewsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { alertsClient, err := alerts.NewAlertsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Alerts client: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/costdetails/client.go b/resource-manager/costmanagement/2022-10-01/costdetails/client.go index 4976bddf08f..43f872cded8 100644 --- a/resource-manager/costmanagement/2022-10-01/costdetails/client.go +++ b/resource-manager/costmanagement/2022-10-01/costdetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CostDetailsClient struct { Client *resourcemanager.Client } -func NewCostDetailsClientWithBaseURI(api environments.Api) (*CostDetailsClient, error) { +func NewCostDetailsClientWithBaseURI(api sdkEnv.Api) (*CostDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "costdetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CostDetailsClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/dimensions/client.go b/resource-manager/costmanagement/2022-10-01/dimensions/client.go index 67626373f1c..3558ae24746 100644 --- a/resource-manager/costmanagement/2022-10-01/dimensions/client.go +++ b/resource-manager/costmanagement/2022-10-01/dimensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DimensionsClient struct { Client *resourcemanager.Client } -func NewDimensionsClientWithBaseURI(api environments.Api) (*DimensionsClient, error) { +func NewDimensionsClientWithBaseURI(api sdkEnv.Api) (*DimensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dimensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DimensionsClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/exports/client.go b/resource-manager/costmanagement/2022-10-01/exports/client.go index 82edbb1ba89..52e48f563bb 100644 --- a/resource-manager/costmanagement/2022-10-01/exports/client.go +++ b/resource-manager/costmanagement/2022-10-01/exports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExportsClient struct { Client *resourcemanager.Client } -func NewExportsClientWithBaseURI(api environments.Api) (*ExportsClient, error) { +func NewExportsClientWithBaseURI(api sdkEnv.Api) (*ExportsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "exports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExportsClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/forecast/client.go b/resource-manager/costmanagement/2022-10-01/forecast/client.go index 37ee083bf2b..d95cb2b7779 100644 --- a/resource-manager/costmanagement/2022-10-01/forecast/client.go +++ b/resource-manager/costmanagement/2022-10-01/forecast/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ForecastClient struct { Client *resourcemanager.Client } -func NewForecastClientWithBaseURI(api environments.Api) (*ForecastClient, error) { +func NewForecastClientWithBaseURI(api sdkEnv.Api) (*ForecastClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "forecast", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ForecastClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/pricesheets/client.go b/resource-manager/costmanagement/2022-10-01/pricesheets/client.go index 892455fe4cc..76289267541 100644 --- a/resource-manager/costmanagement/2022-10-01/pricesheets/client.go +++ b/resource-manager/costmanagement/2022-10-01/pricesheets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PriceSheetsClient struct { Client *resourcemanager.Client } -func NewPriceSheetsClientWithBaseURI(api environments.Api) (*PriceSheetsClient, error) { +func NewPriceSheetsClientWithBaseURI(api sdkEnv.Api) (*PriceSheetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "pricesheets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PriceSheetsClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/query/client.go b/resource-manager/costmanagement/2022-10-01/query/client.go index eeaebdd6b5d..72dab99adaa 100644 --- a/resource-manager/costmanagement/2022-10-01/query/client.go +++ b/resource-manager/costmanagement/2022-10-01/query/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QueryClient struct { Client *resourcemanager.Client } -func NewQueryClientWithBaseURI(api environments.Api) (*QueryClient, error) { +func NewQueryClientWithBaseURI(api sdkEnv.Api) (*QueryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "query", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QueryClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/reservedinstances/client.go b/resource-manager/costmanagement/2022-10-01/reservedinstances/client.go index bbaf498ce7b..fd0aa21b578 100644 --- a/resource-manager/costmanagement/2022-10-01/reservedinstances/client.go +++ b/resource-manager/costmanagement/2022-10-01/reservedinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservedInstancesClient struct { Client *resourcemanager.Client } -func NewReservedInstancesClientWithBaseURI(api environments.Api) (*ReservedInstancesClient, error) { +func NewReservedInstancesClientWithBaseURI(api sdkEnv.Api) (*ReservedInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservedinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservedInstancesClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/scheduledactions/client.go b/resource-manager/costmanagement/2022-10-01/scheduledactions/client.go index a9621d2a137..0807aa84aa6 100644 --- a/resource-manager/costmanagement/2022-10-01/scheduledactions/client.go +++ b/resource-manager/costmanagement/2022-10-01/scheduledactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScheduledActionsClient struct { Client *resourcemanager.Client } -func NewScheduledActionsClientWithBaseURI(api environments.Api) (*ScheduledActionsClient, error) { +func NewScheduledActionsClientWithBaseURI(api sdkEnv.Api) (*ScheduledActionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scheduledactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScheduledActionsClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/usagedetails/client.go b/resource-manager/costmanagement/2022-10-01/usagedetails/client.go index 4b5d6b7fac9..fe0903d61e6 100644 --- a/resource-manager/costmanagement/2022-10-01/usagedetails/client.go +++ b/resource-manager/costmanagement/2022-10-01/usagedetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsageDetailsClient struct { Client *resourcemanager.Client } -func NewUsageDetailsClientWithBaseURI(api environments.Api) (*UsageDetailsClient, error) { +func NewUsageDetailsClientWithBaseURI(api sdkEnv.Api) (*UsageDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usagedetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsageDetailsClient: %+v", err) diff --git a/resource-manager/costmanagement/2022-10-01/views/client.go b/resource-manager/costmanagement/2022-10-01/views/client.go index 44d5cb77e50..3e2b7eaf923 100644 --- a/resource-manager/costmanagement/2022-10-01/views/client.go +++ b/resource-manager/costmanagement/2022-10-01/views/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ViewsClient struct { Client *resourcemanager.Client } -func NewViewsClientWithBaseURI(api environments.Api) (*ViewsClient, error) { +func NewViewsClientWithBaseURI(api sdkEnv.Api) (*ViewsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "views", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ViewsClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/alerts/client.go b/resource-manager/costmanagement/2023-03-01/alerts/client.go index 87c5a0ee0b4..5ce43674784 100644 --- a/resource-manager/costmanagement/2023-03-01/alerts/client.go +++ b/resource-manager/costmanagement/2023-03-01/alerts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AlertsClient struct { Client *resourcemanager.Client } -func NewAlertsClientWithBaseURI(api environments.Api) (*AlertsClient, error) { +func NewAlertsClientWithBaseURI(api sdkEnv.Api) (*AlertsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "alerts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AlertsClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/benefitrecommendations/client.go b/resource-manager/costmanagement/2023-03-01/benefitrecommendations/client.go index a3e8d215a6d..8e7d34a9eab 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitrecommendations/client.go +++ b/resource-manager/costmanagement/2023-03-01/benefitrecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BenefitRecommendationsClient struct { Client *resourcemanager.Client } -func NewBenefitRecommendationsClientWithBaseURI(api environments.Api) (*BenefitRecommendationsClient, error) { +func NewBenefitRecommendationsClientWithBaseURI(api sdkEnv.Api) (*BenefitRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "benefitrecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BenefitRecommendationsClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/client.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/client.go index 8d49e55fb08..2279f31bb68 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/client.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BenefitUtilizationSummariesClient struct { Client *resourcemanager.Client } -func NewBenefitUtilizationSummariesClientWithBaseURI(api environments.Api) (*BenefitUtilizationSummariesClient, error) { +func NewBenefitUtilizationSummariesClientWithBaseURI(api sdkEnv.Api) (*BenefitUtilizationSummariesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "benefitutilizationsummaries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BenefitUtilizationSummariesClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/client.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/client.go index 4506beed08b..62f48087f9a 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/client.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BenefitUtilizationSummariesAsyncClient struct { Client *resourcemanager.Client } -func NewBenefitUtilizationSummariesAsyncClientWithBaseURI(api environments.Api) (*BenefitUtilizationSummariesAsyncClient, error) { +func NewBenefitUtilizationSummariesAsyncClientWithBaseURI(api sdkEnv.Api) (*BenefitUtilizationSummariesAsyncClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "benefitutilizationsummariesasync", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BenefitUtilizationSummariesAsyncClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/client.go b/resource-manager/costmanagement/2023-03-01/client.go index bc392a12a3c..e571dd47752 100644 --- a/resource-manager/costmanagement/2023-03-01/client.go +++ b/resource-manager/costmanagement/2023-03-01/client.go @@ -21,7 +21,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2023-03-01/usagedetails" "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2023-03-01/views" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -41,7 +41,7 @@ type Client struct { Views *views.ViewsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { alertsClient, err := alerts.NewAlertsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Alerts client: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/costdetails/client.go b/resource-manager/costmanagement/2023-03-01/costdetails/client.go index 4976bddf08f..43f872cded8 100644 --- a/resource-manager/costmanagement/2023-03-01/costdetails/client.go +++ b/resource-manager/costmanagement/2023-03-01/costdetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CostDetailsClient struct { Client *resourcemanager.Client } -func NewCostDetailsClientWithBaseURI(api environments.Api) (*CostDetailsClient, error) { +func NewCostDetailsClientWithBaseURI(api sdkEnv.Api) (*CostDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "costdetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CostDetailsClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/dimensions/client.go b/resource-manager/costmanagement/2023-03-01/dimensions/client.go index 67626373f1c..3558ae24746 100644 --- a/resource-manager/costmanagement/2023-03-01/dimensions/client.go +++ b/resource-manager/costmanagement/2023-03-01/dimensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DimensionsClient struct { Client *resourcemanager.Client } -func NewDimensionsClientWithBaseURI(api environments.Api) (*DimensionsClient, error) { +func NewDimensionsClientWithBaseURI(api sdkEnv.Api) (*DimensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dimensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DimensionsClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/exports/client.go b/resource-manager/costmanagement/2023-03-01/exports/client.go index 82edbb1ba89..52e48f563bb 100644 --- a/resource-manager/costmanagement/2023-03-01/exports/client.go +++ b/resource-manager/costmanagement/2023-03-01/exports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExportsClient struct { Client *resourcemanager.Client } -func NewExportsClientWithBaseURI(api environments.Api) (*ExportsClient, error) { +func NewExportsClientWithBaseURI(api sdkEnv.Api) (*ExportsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "exports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExportsClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/forecast/client.go b/resource-manager/costmanagement/2023-03-01/forecast/client.go index 37ee083bf2b..d95cb2b7779 100644 --- a/resource-manager/costmanagement/2023-03-01/forecast/client.go +++ b/resource-manager/costmanagement/2023-03-01/forecast/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ForecastClient struct { Client *resourcemanager.Client } -func NewForecastClientWithBaseURI(api environments.Api) (*ForecastClient, error) { +func NewForecastClientWithBaseURI(api sdkEnv.Api) (*ForecastClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "forecast", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ForecastClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/pricesheets/client.go b/resource-manager/costmanagement/2023-03-01/pricesheets/client.go index 892455fe4cc..76289267541 100644 --- a/resource-manager/costmanagement/2023-03-01/pricesheets/client.go +++ b/resource-manager/costmanagement/2023-03-01/pricesheets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PriceSheetsClient struct { Client *resourcemanager.Client } -func NewPriceSheetsClientWithBaseURI(api environments.Api) (*PriceSheetsClient, error) { +func NewPriceSheetsClientWithBaseURI(api sdkEnv.Api) (*PriceSheetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "pricesheets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PriceSheetsClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/query/client.go b/resource-manager/costmanagement/2023-03-01/query/client.go index eeaebdd6b5d..72dab99adaa 100644 --- a/resource-manager/costmanagement/2023-03-01/query/client.go +++ b/resource-manager/costmanagement/2023-03-01/query/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QueryClient struct { Client *resourcemanager.Client } -func NewQueryClientWithBaseURI(api environments.Api) (*QueryClient, error) { +func NewQueryClientWithBaseURI(api sdkEnv.Api) (*QueryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "query", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QueryClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/reservedinstances/client.go b/resource-manager/costmanagement/2023-03-01/reservedinstances/client.go index bbaf498ce7b..fd0aa21b578 100644 --- a/resource-manager/costmanagement/2023-03-01/reservedinstances/client.go +++ b/resource-manager/costmanagement/2023-03-01/reservedinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReservedInstancesClient struct { Client *resourcemanager.Client } -func NewReservedInstancesClientWithBaseURI(api environments.Api) (*ReservedInstancesClient, error) { +func NewReservedInstancesClientWithBaseURI(api sdkEnv.Api) (*ReservedInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "reservedinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReservedInstancesClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/scheduledactions/client.go b/resource-manager/costmanagement/2023-03-01/scheduledactions/client.go index a9621d2a137..0807aa84aa6 100644 --- a/resource-manager/costmanagement/2023-03-01/scheduledactions/client.go +++ b/resource-manager/costmanagement/2023-03-01/scheduledactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScheduledActionsClient struct { Client *resourcemanager.Client } -func NewScheduledActionsClientWithBaseURI(api environments.Api) (*ScheduledActionsClient, error) { +func NewScheduledActionsClientWithBaseURI(api sdkEnv.Api) (*ScheduledActionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scheduledactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScheduledActionsClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/usagedetails/client.go b/resource-manager/costmanagement/2023-03-01/usagedetails/client.go index 4b5d6b7fac9..fe0903d61e6 100644 --- a/resource-manager/costmanagement/2023-03-01/usagedetails/client.go +++ b/resource-manager/costmanagement/2023-03-01/usagedetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsageDetailsClient struct { Client *resourcemanager.Client } -func NewUsageDetailsClientWithBaseURI(api environments.Api) (*UsageDetailsClient, error) { +func NewUsageDetailsClientWithBaseURI(api sdkEnv.Api) (*UsageDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usagedetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsageDetailsClient: %+v", err) diff --git a/resource-manager/costmanagement/2023-03-01/views/client.go b/resource-manager/costmanagement/2023-03-01/views/client.go index 44d5cb77e50..3e2b7eaf923 100644 --- a/resource-manager/costmanagement/2023-03-01/views/client.go +++ b/resource-manager/costmanagement/2023-03-01/views/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ViewsClient struct { Client *resourcemanager.Client } -func NewViewsClientWithBaseURI(api environments.Api) (*ViewsClient, error) { +func NewViewsClientWithBaseURI(api sdkEnv.Api) (*ViewsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "views", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ViewsClient: %+v", err) diff --git a/resource-manager/customproviders/2018-09-01-preview/associations/client.go b/resource-manager/customproviders/2018-09-01-preview/associations/client.go index 2d0c481d363..a0b9b5ff7e3 100644 --- a/resource-manager/customproviders/2018-09-01-preview/associations/client.go +++ b/resource-manager/customproviders/2018-09-01-preview/associations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AssociationsClient struct { Client *resourcemanager.Client } -func NewAssociationsClientWithBaseURI(api environments.Api) (*AssociationsClient, error) { +func NewAssociationsClientWithBaseURI(api sdkEnv.Api) (*AssociationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "associations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AssociationsClient: %+v", err) diff --git a/resource-manager/customproviders/2018-09-01-preview/client.go b/resource-manager/customproviders/2018-09-01-preview/client.go index fd5bbe1c02a..51d4c4742ee 100644 --- a/resource-manager/customproviders/2018-09-01-preview/client.go +++ b/resource-manager/customproviders/2018-09-01-preview/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/associations" "github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { CustomResourceProvider *customresourceprovider.CustomResourceProviderClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { associationsClient, err := associations.NewAssociationsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Associations client: %+v", err) diff --git a/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/client.go b/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/client.go index 40f4ccd8cd0..93181635427 100644 --- a/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/client.go +++ b/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CustomResourceProviderClient struct { Client *resourcemanager.Client } -func NewCustomResourceProviderClientWithBaseURI(api environments.Api) (*CustomResourceProviderClient, error) { +func NewCustomResourceProviderClientWithBaseURI(api sdkEnv.Api) (*CustomResourceProviderClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "customresourceprovider", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CustomResourceProviderClient: %+v", err) diff --git a/resource-manager/dashboard/2022-08-01/client.go b/resource-manager/dashboard/2022-08-01/client.go index f50e4b8e299..c4af8106f06 100644 --- a/resource-manager/dashboard/2022-08-01/client.go +++ b/resource-manager/dashboard/2022-08-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/privateendpointconnection" "github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/privatelinkresource" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { PrivateLinkResource *privatelinkresource.PrivateLinkResourceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { grafanaResourceClient, err := grafanaresource.NewGrafanaResourceClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building GrafanaResource client: %+v", err) diff --git a/resource-manager/dashboard/2022-08-01/grafanaresource/client.go b/resource-manager/dashboard/2022-08-01/grafanaresource/client.go index db10436f9e5..c49c5a08752 100644 --- a/resource-manager/dashboard/2022-08-01/grafanaresource/client.go +++ b/resource-manager/dashboard/2022-08-01/grafanaresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GrafanaResourceClient struct { Client *resourcemanager.Client } -func NewGrafanaResourceClientWithBaseURI(api environments.Api) (*GrafanaResourceClient, error) { +func NewGrafanaResourceClientWithBaseURI(api sdkEnv.Api) (*GrafanaResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "grafanaresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GrafanaResourceClient: %+v", err) diff --git a/resource-manager/dashboard/2022-08-01/privateendpointconnection/client.go b/resource-manager/dashboard/2022-08-01/privateendpointconnection/client.go index 35dcdf8567e..81fa9bc3329 100644 --- a/resource-manager/dashboard/2022-08-01/privateendpointconnection/client.go +++ b/resource-manager/dashboard/2022-08-01/privateendpointconnection/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionClient, error) { +func NewPrivateEndpointConnectionClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnection", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionClient: %+v", err) diff --git a/resource-manager/dashboard/2022-08-01/privatelinkresource/client.go b/resource-manager/dashboard/2022-08-01/privatelinkresource/client.go index 1caf7195e24..fc25864a1a8 100644 --- a/resource-manager/dashboard/2022-08-01/privatelinkresource/client.go +++ b/resource-manager/dashboard/2022-08-01/privatelinkresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourceClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourceClientWithBaseURI(api environments.Api) (*PrivateLinkResourceClient, error) { +func NewPrivateLinkResourceClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourceClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/addons/client.go b/resource-manager/databoxedge/2022-03-01/addons/client.go index 5e76a060858..06469fc3c99 100644 --- a/resource-manager/databoxedge/2022-03-01/addons/client.go +++ b/resource-manager/databoxedge/2022-03-01/addons/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AddonsClient struct { Client *resourcemanager.Client } -func NewAddonsClientWithBaseURI(api environments.Api) (*AddonsClient, error) { +func NewAddonsClientWithBaseURI(api sdkEnv.Api) (*AddonsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "addons", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AddonsClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/alerts/client.go b/resource-manager/databoxedge/2022-03-01/alerts/client.go index 87c5a0ee0b4..5ce43674784 100644 --- a/resource-manager/databoxedge/2022-03-01/alerts/client.go +++ b/resource-manager/databoxedge/2022-03-01/alerts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AlertsClient struct { Client *resourcemanager.Client } -func NewAlertsClientWithBaseURI(api environments.Api) (*AlertsClient, error) { +func NewAlertsClientWithBaseURI(api sdkEnv.Api) (*AlertsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "alerts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AlertsClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/availableskus/client.go b/resource-manager/databoxedge/2022-03-01/availableskus/client.go index 90bb927b3f0..ce887b41a4f 100644 --- a/resource-manager/databoxedge/2022-03-01/availableskus/client.go +++ b/resource-manager/databoxedge/2022-03-01/availableskus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AvailableSkusClient struct { Client *resourcemanager.Client } -func NewAvailableSkusClientWithBaseURI(api environments.Api) (*AvailableSkusClient, error) { +func NewAvailableSkusClientWithBaseURI(api sdkEnv.Api) (*AvailableSkusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "availableskus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AvailableSkusClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/bandwidthschedules/client.go b/resource-manager/databoxedge/2022-03-01/bandwidthschedules/client.go index 832d0e44109..2885163ba3a 100644 --- a/resource-manager/databoxedge/2022-03-01/bandwidthschedules/client.go +++ b/resource-manager/databoxedge/2022-03-01/bandwidthschedules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BandwidthSchedulesClient struct { Client *resourcemanager.Client } -func NewBandwidthSchedulesClientWithBaseURI(api environments.Api) (*BandwidthSchedulesClient, error) { +func NewBandwidthSchedulesClientWithBaseURI(api sdkEnv.Api) (*BandwidthSchedulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "bandwidthschedules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BandwidthSchedulesClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/client.go b/resource-manager/databoxedge/2022-03-01/client.go index 200ab60c887..40d007f25aa 100644 --- a/resource-manager/databoxedge/2022-03-01/client.go +++ b/resource-manager/databoxedge/2022-03-01/client.go @@ -27,7 +27,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/triggers" "github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/users" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -53,7 +53,7 @@ type Client struct { Users *users.UsersClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { addonsClient, err := addons.NewAddonsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Addons client: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/containers/client.go b/resource-manager/databoxedge/2022-03-01/containers/client.go index fc77e7c475f..673689ddb36 100644 --- a/resource-manager/databoxedge/2022-03-01/containers/client.go +++ b/resource-manager/databoxedge/2022-03-01/containers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ContainersClient struct { Client *resourcemanager.Client } -func NewContainersClientWithBaseURI(api environments.Api) (*ContainersClient, error) { +func NewContainersClientWithBaseURI(api sdkEnv.Api) (*ContainersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "containers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ContainersClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/devicecapacitycheck/client.go b/resource-manager/databoxedge/2022-03-01/devicecapacitycheck/client.go index caf3129187b..79520ebf884 100644 --- a/resource-manager/databoxedge/2022-03-01/devicecapacitycheck/client.go +++ b/resource-manager/databoxedge/2022-03-01/devicecapacitycheck/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeviceCapacityCheckClient struct { Client *resourcemanager.Client } -func NewDeviceCapacityCheckClientWithBaseURI(api environments.Api) (*DeviceCapacityCheckClient, error) { +func NewDeviceCapacityCheckClientWithBaseURI(api sdkEnv.Api) (*DeviceCapacityCheckClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "devicecapacitycheck", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeviceCapacityCheckClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/devicecapacityinfo/client.go b/resource-manager/databoxedge/2022-03-01/devicecapacityinfo/client.go index 93d60595f36..ac69ad405fc 100644 --- a/resource-manager/databoxedge/2022-03-01/devicecapacityinfo/client.go +++ b/resource-manager/databoxedge/2022-03-01/devicecapacityinfo/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeviceCapacityInfoClient struct { Client *resourcemanager.Client } -func NewDeviceCapacityInfoClientWithBaseURI(api environments.Api) (*DeviceCapacityInfoClient, error) { +func NewDeviceCapacityInfoClientWithBaseURI(api sdkEnv.Api) (*DeviceCapacityInfoClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "devicecapacityinfo", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeviceCapacityInfoClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/devices/client.go b/resource-manager/databoxedge/2022-03-01/devices/client.go index 44cb7fca123..3d19cf96ee0 100644 --- a/resource-manager/databoxedge/2022-03-01/devices/client.go +++ b/resource-manager/databoxedge/2022-03-01/devices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DevicesClient struct { Client *resourcemanager.Client } -func NewDevicesClientWithBaseURI(api environments.Api) (*DevicesClient, error) { +func NewDevicesClientWithBaseURI(api sdkEnv.Api) (*DevicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "devices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DevicesClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/diagnosticsettings/client.go b/resource-manager/databoxedge/2022-03-01/diagnosticsettings/client.go index 16b70c2b3cb..0467509d27b 100644 --- a/resource-manager/databoxedge/2022-03-01/diagnosticsettings/client.go +++ b/resource-manager/databoxedge/2022-03-01/diagnosticsettings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DiagnosticSettingsClient struct { Client *resourcemanager.Client } -func NewDiagnosticSettingsClientWithBaseURI(api environments.Api) (*DiagnosticSettingsClient, error) { +func NewDiagnosticSettingsClientWithBaseURI(api sdkEnv.Api) (*DiagnosticSettingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "diagnosticsettings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DiagnosticSettingsClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/jobs/client.go b/resource-manager/databoxedge/2022-03-01/jobs/client.go index e2cca931b31..a7c521817f9 100644 --- a/resource-manager/databoxedge/2022-03-01/jobs/client.go +++ b/resource-manager/databoxedge/2022-03-01/jobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobsClient struct { Client *resourcemanager.Client } -func NewJobsClientWithBaseURI(api environments.Api) (*JobsClient, error) { +func NewJobsClientWithBaseURI(api sdkEnv.Api) (*JobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobsClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/monitoringconfig/client.go b/resource-manager/databoxedge/2022-03-01/monitoringconfig/client.go index 8b35da4deff..9a6126b4969 100644 --- a/resource-manager/databoxedge/2022-03-01/monitoringconfig/client.go +++ b/resource-manager/databoxedge/2022-03-01/monitoringconfig/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitoringConfigClient struct { Client *resourcemanager.Client } -func NewMonitoringConfigClientWithBaseURI(api environments.Api) (*MonitoringConfigClient, error) { +func NewMonitoringConfigClientWithBaseURI(api sdkEnv.Api) (*MonitoringConfigClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitoringconfig", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitoringConfigClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/nodes/client.go b/resource-manager/databoxedge/2022-03-01/nodes/client.go index 5ca3c0aa313..36a17778668 100644 --- a/resource-manager/databoxedge/2022-03-01/nodes/client.go +++ b/resource-manager/databoxedge/2022-03-01/nodes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NodesClient struct { Client *resourcemanager.Client } -func NewNodesClientWithBaseURI(api environments.Api) (*NodesClient, error) { +func NewNodesClientWithBaseURI(api sdkEnv.Api) (*NodesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "nodes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NodesClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/orders/client.go b/resource-manager/databoxedge/2022-03-01/orders/client.go index 20c1acdd346..79f7a0e6b37 100644 --- a/resource-manager/databoxedge/2022-03-01/orders/client.go +++ b/resource-manager/databoxedge/2022-03-01/orders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OrdersClient struct { Client *resourcemanager.Client } -func NewOrdersClientWithBaseURI(api environments.Api) (*OrdersClient, error) { +func NewOrdersClientWithBaseURI(api sdkEnv.Api) (*OrdersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "orders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OrdersClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/roles/client.go b/resource-manager/databoxedge/2022-03-01/roles/client.go index f443ed2050e..fc5b6babc6c 100644 --- a/resource-manager/databoxedge/2022-03-01/roles/client.go +++ b/resource-manager/databoxedge/2022-03-01/roles/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RolesClient struct { Client *resourcemanager.Client } -func NewRolesClientWithBaseURI(api environments.Api) (*RolesClient, error) { +func NewRolesClientWithBaseURI(api sdkEnv.Api) (*RolesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "roles", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RolesClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/shares/client.go b/resource-manager/databoxedge/2022-03-01/shares/client.go index 69ebb021071..38e2cc3bff1 100644 --- a/resource-manager/databoxedge/2022-03-01/shares/client.go +++ b/resource-manager/databoxedge/2022-03-01/shares/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SharesClient struct { Client *resourcemanager.Client } -func NewSharesClientWithBaseURI(api environments.Api) (*SharesClient, error) { +func NewSharesClientWithBaseURI(api sdkEnv.Api) (*SharesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "shares", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SharesClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/client.go b/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/client.go index b684a7ea27c..a6a30200b3d 100644 --- a/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/client.go +++ b/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StorageAccountCredentialsClient struct { Client *resourcemanager.Client } -func NewStorageAccountCredentialsClientWithBaseURI(api environments.Api) (*StorageAccountCredentialsClient, error) { +func NewStorageAccountCredentialsClientWithBaseURI(api sdkEnv.Api) (*StorageAccountCredentialsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "storageaccountcredentials", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StorageAccountCredentialsClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/storageaccounts/client.go b/resource-manager/databoxedge/2022-03-01/storageaccounts/client.go index 6d86e81e728..85e7a567018 100644 --- a/resource-manager/databoxedge/2022-03-01/storageaccounts/client.go +++ b/resource-manager/databoxedge/2022-03-01/storageaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StorageAccountsClient struct { Client *resourcemanager.Client } -func NewStorageAccountsClientWithBaseURI(api environments.Api) (*StorageAccountsClient, error) { +func NewStorageAccountsClientWithBaseURI(api sdkEnv.Api) (*StorageAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "storageaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StorageAccountsClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/supportpackages/client.go b/resource-manager/databoxedge/2022-03-01/supportpackages/client.go index 646712f0ae7..330404785af 100644 --- a/resource-manager/databoxedge/2022-03-01/supportpackages/client.go +++ b/resource-manager/databoxedge/2022-03-01/supportpackages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SupportPackagesClient struct { Client *resourcemanager.Client } -func NewSupportPackagesClientWithBaseURI(api environments.Api) (*SupportPackagesClient, error) { +func NewSupportPackagesClientWithBaseURI(api sdkEnv.Api) (*SupportPackagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "supportpackages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SupportPackagesClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/triggers/client.go b/resource-manager/databoxedge/2022-03-01/triggers/client.go index 9a6deac9284..5fbc0c3a9f1 100644 --- a/resource-manager/databoxedge/2022-03-01/triggers/client.go +++ b/resource-manager/databoxedge/2022-03-01/triggers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TriggersClient struct { Client *resourcemanager.Client } -func NewTriggersClientWithBaseURI(api environments.Api) (*TriggersClient, error) { +func NewTriggersClientWithBaseURI(api sdkEnv.Api) (*TriggersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "triggers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TriggersClient: %+v", err) diff --git a/resource-manager/databoxedge/2022-03-01/users/client.go b/resource-manager/databoxedge/2022-03-01/users/client.go index b2fbba7618b..80c03b18406 100644 --- a/resource-manager/databoxedge/2022-03-01/users/client.go +++ b/resource-manager/databoxedge/2022-03-01/users/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsersClient struct { Client *resourcemanager.Client } -func NewUsersClientWithBaseURI(api environments.Api) (*UsersClient, error) { +func NewUsersClientWithBaseURI(api sdkEnv.Api) (*UsersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "users", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsersClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/addons/client.go b/resource-manager/databoxedge/2023-07-01/addons/client.go index 5e76a060858..06469fc3c99 100644 --- a/resource-manager/databoxedge/2023-07-01/addons/client.go +++ b/resource-manager/databoxedge/2023-07-01/addons/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AddonsClient struct { Client *resourcemanager.Client } -func NewAddonsClientWithBaseURI(api environments.Api) (*AddonsClient, error) { +func NewAddonsClientWithBaseURI(api sdkEnv.Api) (*AddonsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "addons", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AddonsClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/alerts/client.go b/resource-manager/databoxedge/2023-07-01/alerts/client.go index 87c5a0ee0b4..5ce43674784 100644 --- a/resource-manager/databoxedge/2023-07-01/alerts/client.go +++ b/resource-manager/databoxedge/2023-07-01/alerts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AlertsClient struct { Client *resourcemanager.Client } -func NewAlertsClientWithBaseURI(api environments.Api) (*AlertsClient, error) { +func NewAlertsClientWithBaseURI(api sdkEnv.Api) (*AlertsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "alerts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AlertsClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/availableskus/client.go b/resource-manager/databoxedge/2023-07-01/availableskus/client.go index 90bb927b3f0..ce887b41a4f 100644 --- a/resource-manager/databoxedge/2023-07-01/availableskus/client.go +++ b/resource-manager/databoxedge/2023-07-01/availableskus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AvailableSkusClient struct { Client *resourcemanager.Client } -func NewAvailableSkusClientWithBaseURI(api environments.Api) (*AvailableSkusClient, error) { +func NewAvailableSkusClientWithBaseURI(api sdkEnv.Api) (*AvailableSkusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "availableskus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AvailableSkusClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/bandwidthschedules/client.go b/resource-manager/databoxedge/2023-07-01/bandwidthschedules/client.go index 832d0e44109..2885163ba3a 100644 --- a/resource-manager/databoxedge/2023-07-01/bandwidthschedules/client.go +++ b/resource-manager/databoxedge/2023-07-01/bandwidthschedules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BandwidthSchedulesClient struct { Client *resourcemanager.Client } -func NewBandwidthSchedulesClientWithBaseURI(api environments.Api) (*BandwidthSchedulesClient, error) { +func NewBandwidthSchedulesClientWithBaseURI(api sdkEnv.Api) (*BandwidthSchedulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "bandwidthschedules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BandwidthSchedulesClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/client.go b/resource-manager/databoxedge/2023-07-01/client.go index b604bb8f50d..1ae0a133360 100644 --- a/resource-manager/databoxedge/2023-07-01/client.go +++ b/resource-manager/databoxedge/2023-07-01/client.go @@ -27,7 +27,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2023-07-01/triggers" "github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2023-07-01/users" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -53,7 +53,7 @@ type Client struct { Users *users.UsersClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { addonsClient, err := addons.NewAddonsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Addons client: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/containers/client.go b/resource-manager/databoxedge/2023-07-01/containers/client.go index fc77e7c475f..673689ddb36 100644 --- a/resource-manager/databoxedge/2023-07-01/containers/client.go +++ b/resource-manager/databoxedge/2023-07-01/containers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ContainersClient struct { Client *resourcemanager.Client } -func NewContainersClientWithBaseURI(api environments.Api) (*ContainersClient, error) { +func NewContainersClientWithBaseURI(api sdkEnv.Api) (*ContainersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "containers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ContainersClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/devicecapacitycheck/client.go b/resource-manager/databoxedge/2023-07-01/devicecapacitycheck/client.go index caf3129187b..79520ebf884 100644 --- a/resource-manager/databoxedge/2023-07-01/devicecapacitycheck/client.go +++ b/resource-manager/databoxedge/2023-07-01/devicecapacitycheck/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeviceCapacityCheckClient struct { Client *resourcemanager.Client } -func NewDeviceCapacityCheckClientWithBaseURI(api environments.Api) (*DeviceCapacityCheckClient, error) { +func NewDeviceCapacityCheckClientWithBaseURI(api sdkEnv.Api) (*DeviceCapacityCheckClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "devicecapacitycheck", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeviceCapacityCheckClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/devicecapacityinfo/client.go b/resource-manager/databoxedge/2023-07-01/devicecapacityinfo/client.go index 93d60595f36..ac69ad405fc 100644 --- a/resource-manager/databoxedge/2023-07-01/devicecapacityinfo/client.go +++ b/resource-manager/databoxedge/2023-07-01/devicecapacityinfo/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeviceCapacityInfoClient struct { Client *resourcemanager.Client } -func NewDeviceCapacityInfoClientWithBaseURI(api environments.Api) (*DeviceCapacityInfoClient, error) { +func NewDeviceCapacityInfoClientWithBaseURI(api sdkEnv.Api) (*DeviceCapacityInfoClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "devicecapacityinfo", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeviceCapacityInfoClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/devices/client.go b/resource-manager/databoxedge/2023-07-01/devices/client.go index 44cb7fca123..3d19cf96ee0 100644 --- a/resource-manager/databoxedge/2023-07-01/devices/client.go +++ b/resource-manager/databoxedge/2023-07-01/devices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DevicesClient struct { Client *resourcemanager.Client } -func NewDevicesClientWithBaseURI(api environments.Api) (*DevicesClient, error) { +func NewDevicesClientWithBaseURI(api sdkEnv.Api) (*DevicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "devices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DevicesClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/diagnosticsettings/client.go b/resource-manager/databoxedge/2023-07-01/diagnosticsettings/client.go index 16b70c2b3cb..0467509d27b 100644 --- a/resource-manager/databoxedge/2023-07-01/diagnosticsettings/client.go +++ b/resource-manager/databoxedge/2023-07-01/diagnosticsettings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DiagnosticSettingsClient struct { Client *resourcemanager.Client } -func NewDiagnosticSettingsClientWithBaseURI(api environments.Api) (*DiagnosticSettingsClient, error) { +func NewDiagnosticSettingsClientWithBaseURI(api sdkEnv.Api) (*DiagnosticSettingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "diagnosticsettings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DiagnosticSettingsClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/jobs/client.go b/resource-manager/databoxedge/2023-07-01/jobs/client.go index e2cca931b31..a7c521817f9 100644 --- a/resource-manager/databoxedge/2023-07-01/jobs/client.go +++ b/resource-manager/databoxedge/2023-07-01/jobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobsClient struct { Client *resourcemanager.Client } -func NewJobsClientWithBaseURI(api environments.Api) (*JobsClient, error) { +func NewJobsClientWithBaseURI(api sdkEnv.Api) (*JobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobsClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/monitoringconfig/client.go b/resource-manager/databoxedge/2023-07-01/monitoringconfig/client.go index 8b35da4deff..9a6126b4969 100644 --- a/resource-manager/databoxedge/2023-07-01/monitoringconfig/client.go +++ b/resource-manager/databoxedge/2023-07-01/monitoringconfig/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitoringConfigClient struct { Client *resourcemanager.Client } -func NewMonitoringConfigClientWithBaseURI(api environments.Api) (*MonitoringConfigClient, error) { +func NewMonitoringConfigClientWithBaseURI(api sdkEnv.Api) (*MonitoringConfigClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitoringconfig", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitoringConfigClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/nodes/client.go b/resource-manager/databoxedge/2023-07-01/nodes/client.go index 5ca3c0aa313..36a17778668 100644 --- a/resource-manager/databoxedge/2023-07-01/nodes/client.go +++ b/resource-manager/databoxedge/2023-07-01/nodes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NodesClient struct { Client *resourcemanager.Client } -func NewNodesClientWithBaseURI(api environments.Api) (*NodesClient, error) { +func NewNodesClientWithBaseURI(api sdkEnv.Api) (*NodesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "nodes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NodesClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/orders/client.go b/resource-manager/databoxedge/2023-07-01/orders/client.go index 20c1acdd346..79f7a0e6b37 100644 --- a/resource-manager/databoxedge/2023-07-01/orders/client.go +++ b/resource-manager/databoxedge/2023-07-01/orders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OrdersClient struct { Client *resourcemanager.Client } -func NewOrdersClientWithBaseURI(api environments.Api) (*OrdersClient, error) { +func NewOrdersClientWithBaseURI(api sdkEnv.Api) (*OrdersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "orders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OrdersClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/roles/client.go b/resource-manager/databoxedge/2023-07-01/roles/client.go index f443ed2050e..fc5b6babc6c 100644 --- a/resource-manager/databoxedge/2023-07-01/roles/client.go +++ b/resource-manager/databoxedge/2023-07-01/roles/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RolesClient struct { Client *resourcemanager.Client } -func NewRolesClientWithBaseURI(api environments.Api) (*RolesClient, error) { +func NewRolesClientWithBaseURI(api sdkEnv.Api) (*RolesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "roles", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RolesClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/shares/client.go b/resource-manager/databoxedge/2023-07-01/shares/client.go index 69ebb021071..38e2cc3bff1 100644 --- a/resource-manager/databoxedge/2023-07-01/shares/client.go +++ b/resource-manager/databoxedge/2023-07-01/shares/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SharesClient struct { Client *resourcemanager.Client } -func NewSharesClientWithBaseURI(api environments.Api) (*SharesClient, error) { +func NewSharesClientWithBaseURI(api sdkEnv.Api) (*SharesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "shares", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SharesClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/client.go b/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/client.go index b684a7ea27c..a6a30200b3d 100644 --- a/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/client.go +++ b/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StorageAccountCredentialsClient struct { Client *resourcemanager.Client } -func NewStorageAccountCredentialsClientWithBaseURI(api environments.Api) (*StorageAccountCredentialsClient, error) { +func NewStorageAccountCredentialsClientWithBaseURI(api sdkEnv.Api) (*StorageAccountCredentialsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "storageaccountcredentials", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StorageAccountCredentialsClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/storageaccounts/client.go b/resource-manager/databoxedge/2023-07-01/storageaccounts/client.go index 6d86e81e728..85e7a567018 100644 --- a/resource-manager/databoxedge/2023-07-01/storageaccounts/client.go +++ b/resource-manager/databoxedge/2023-07-01/storageaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StorageAccountsClient struct { Client *resourcemanager.Client } -func NewStorageAccountsClientWithBaseURI(api environments.Api) (*StorageAccountsClient, error) { +func NewStorageAccountsClientWithBaseURI(api sdkEnv.Api) (*StorageAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "storageaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StorageAccountsClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/supportpackages/client.go b/resource-manager/databoxedge/2023-07-01/supportpackages/client.go index 646712f0ae7..330404785af 100644 --- a/resource-manager/databoxedge/2023-07-01/supportpackages/client.go +++ b/resource-manager/databoxedge/2023-07-01/supportpackages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SupportPackagesClient struct { Client *resourcemanager.Client } -func NewSupportPackagesClientWithBaseURI(api environments.Api) (*SupportPackagesClient, error) { +func NewSupportPackagesClientWithBaseURI(api sdkEnv.Api) (*SupportPackagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "supportpackages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SupportPackagesClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/triggers/client.go b/resource-manager/databoxedge/2023-07-01/triggers/client.go index 9a6deac9284..5fbc0c3a9f1 100644 --- a/resource-manager/databoxedge/2023-07-01/triggers/client.go +++ b/resource-manager/databoxedge/2023-07-01/triggers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TriggersClient struct { Client *resourcemanager.Client } -func NewTriggersClientWithBaseURI(api environments.Api) (*TriggersClient, error) { +func NewTriggersClientWithBaseURI(api sdkEnv.Api) (*TriggersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "triggers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TriggersClient: %+v", err) diff --git a/resource-manager/databoxedge/2023-07-01/users/client.go b/resource-manager/databoxedge/2023-07-01/users/client.go index b2fbba7618b..80c03b18406 100644 --- a/resource-manager/databoxedge/2023-07-01/users/client.go +++ b/resource-manager/databoxedge/2023-07-01/users/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsersClient struct { Client *resourcemanager.Client } -func NewUsersClientWithBaseURI(api environments.Api) (*UsersClient, error) { +func NewUsersClientWithBaseURI(api sdkEnv.Api) (*UsersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "users", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsersClient: %+v", err) diff --git a/resource-manager/databricks/2022-04-01-preview/accessconnector/client.go b/resource-manager/databricks/2022-04-01-preview/accessconnector/client.go index 0cc450c4307..9c8155a7f85 100644 --- a/resource-manager/databricks/2022-04-01-preview/accessconnector/client.go +++ b/resource-manager/databricks/2022-04-01-preview/accessconnector/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccessConnectorClient struct { Client *resourcemanager.Client } -func NewAccessConnectorClientWithBaseURI(api environments.Api) (*AccessConnectorClient, error) { +func NewAccessConnectorClientWithBaseURI(api sdkEnv.Api) (*AccessConnectorClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "accessconnector", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccessConnectorClient: %+v", err) diff --git a/resource-manager/databricks/2022-04-01-preview/client.go b/resource-manager/databricks/2022-04-01-preview/client.go index a48edff2040..7a2f5937591 100644 --- a/resource-manager/databricks/2022-04-01-preview/client.go +++ b/resource-manager/databricks/2022-04-01-preview/client.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/vnetpeering" "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/workspaces" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -29,7 +29,7 @@ type Client struct { Workspaces *workspaces.WorkspacesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { accessConnectorClient, err := accessconnector.NewAccessConnectorClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AccessConnector client: %+v", err) diff --git a/resource-manager/databricks/2022-04-01-preview/delete/client.go b/resource-manager/databricks/2022-04-01-preview/delete/client.go index c2e00994b74..7feeb7efcaf 100644 --- a/resource-manager/databricks/2022-04-01-preview/delete/client.go +++ b/resource-manager/databricks/2022-04-01-preview/delete/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DELETEClient struct { Client *resourcemanager.Client } -func NewDELETEClientWithBaseURI(api environments.Api) (*DELETEClient, error) { +func NewDELETEClientWithBaseURI(api sdkEnv.Api) (*DELETEClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "delete", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DELETEClient: %+v", err) diff --git a/resource-manager/databricks/2022-04-01-preview/outboundnetworkdependenciesendpoints/client.go b/resource-manager/databricks/2022-04-01-preview/outboundnetworkdependenciesendpoints/client.go index bdf407b2056..a9777dea6e6 100644 --- a/resource-manager/databricks/2022-04-01-preview/outboundnetworkdependenciesendpoints/client.go +++ b/resource-manager/databricks/2022-04-01-preview/outboundnetworkdependenciesendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OutboundNetworkDependenciesEndpointsClient struct { Client *resourcemanager.Client } -func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api environments.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { +func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api sdkEnv.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "outboundnetworkdependenciesendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OutboundNetworkDependenciesEndpointsClient: %+v", err) diff --git a/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/client.go b/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/client.go +++ b/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/databricks/2022-04-01-preview/privatelinkresources/client.go b/resource-manager/databricks/2022-04-01-preview/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/databricks/2022-04-01-preview/privatelinkresources/client.go +++ b/resource-manager/databricks/2022-04-01-preview/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/databricks/2022-04-01-preview/put/client.go b/resource-manager/databricks/2022-04-01-preview/put/client.go index 3cebb510f93..3e377e36761 100644 --- a/resource-manager/databricks/2022-04-01-preview/put/client.go +++ b/resource-manager/databricks/2022-04-01-preview/put/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PUTClient struct { Client *resourcemanager.Client } -func NewPUTClientWithBaseURI(api environments.Api) (*PUTClient, error) { +func NewPUTClientWithBaseURI(api sdkEnv.Api) (*PUTClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "put", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PUTClient: %+v", err) diff --git a/resource-manager/databricks/2022-04-01-preview/vnetpeering/client.go b/resource-manager/databricks/2022-04-01-preview/vnetpeering/client.go index 3a58116b74f..e471ff02a7e 100644 --- a/resource-manager/databricks/2022-04-01-preview/vnetpeering/client.go +++ b/resource-manager/databricks/2022-04-01-preview/vnetpeering/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VNetPeeringClient struct { Client *resourcemanager.Client } -func NewVNetPeeringClientWithBaseURI(api environments.Api) (*VNetPeeringClient, error) { +func NewVNetPeeringClientWithBaseURI(api sdkEnv.Api) (*VNetPeeringClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vnetpeering", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VNetPeeringClient: %+v", err) diff --git a/resource-manager/databricks/2022-04-01-preview/workspaces/client.go b/resource-manager/databricks/2022-04-01-preview/workspaces/client.go index bf91cd2dee7..868fd830b2a 100644 --- a/resource-manager/databricks/2022-04-01-preview/workspaces/client.go +++ b/resource-manager/databricks/2022-04-01-preview/workspaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacesClient struct { Client *resourcemanager.Client } -func NewWorkspacesClientWithBaseURI(api environments.Api) (*WorkspacesClient, error) { +func NewWorkspacesClientWithBaseURI(api sdkEnv.Api) (*WorkspacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacesClient: %+v", err) diff --git a/resource-manager/databricks/2022-10-01-preview/accessconnector/client.go b/resource-manager/databricks/2022-10-01-preview/accessconnector/client.go index 0cc450c4307..9c8155a7f85 100644 --- a/resource-manager/databricks/2022-10-01-preview/accessconnector/client.go +++ b/resource-manager/databricks/2022-10-01-preview/accessconnector/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccessConnectorClient struct { Client *resourcemanager.Client } -func NewAccessConnectorClientWithBaseURI(api environments.Api) (*AccessConnectorClient, error) { +func NewAccessConnectorClientWithBaseURI(api sdkEnv.Api) (*AccessConnectorClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "accessconnector", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccessConnectorClient: %+v", err) diff --git a/resource-manager/databricks/2022-10-01-preview/client.go b/resource-manager/databricks/2022-10-01-preview/client.go index 20ce46d6acd..cebfecfe6a3 100644 --- a/resource-manager/databricks/2022-10-01-preview/client.go +++ b/resource-manager/databricks/2022-10-01-preview/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-10-01-preview/accessconnector" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { AccessConnector *accessconnector.AccessConnectorClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { accessConnectorClient, err := accessconnector.NewAccessConnectorClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AccessConnector client: %+v", err) diff --git a/resource-manager/databricks/2023-02-01/client.go b/resource-manager/databricks/2023-02-01/client.go index a51df74c830..db429ff4066 100644 --- a/resource-manager/databricks/2023-02-01/client.go +++ b/resource-manager/databricks/2023-02-01/client.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/vnetpeering" "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -27,7 +27,7 @@ type Client struct { Workspaces *workspaces.WorkspacesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { dELETEClient, err := delete.NewDELETEClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DELETE client: %+v", err) diff --git a/resource-manager/databricks/2023-02-01/delete/client.go b/resource-manager/databricks/2023-02-01/delete/client.go index c2e00994b74..7feeb7efcaf 100644 --- a/resource-manager/databricks/2023-02-01/delete/client.go +++ b/resource-manager/databricks/2023-02-01/delete/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DELETEClient struct { Client *resourcemanager.Client } -func NewDELETEClientWithBaseURI(api environments.Api) (*DELETEClient, error) { +func NewDELETEClientWithBaseURI(api sdkEnv.Api) (*DELETEClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "delete", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DELETEClient: %+v", err) diff --git a/resource-manager/databricks/2023-02-01/outboundnetworkdependenciesendpoints/client.go b/resource-manager/databricks/2023-02-01/outboundnetworkdependenciesendpoints/client.go index bdf407b2056..a9777dea6e6 100644 --- a/resource-manager/databricks/2023-02-01/outboundnetworkdependenciesendpoints/client.go +++ b/resource-manager/databricks/2023-02-01/outboundnetworkdependenciesendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OutboundNetworkDependenciesEndpointsClient struct { Client *resourcemanager.Client } -func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api environments.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { +func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api sdkEnv.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "outboundnetworkdependenciesendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OutboundNetworkDependenciesEndpointsClient: %+v", err) diff --git a/resource-manager/databricks/2023-02-01/privateendpointconnections/client.go b/resource-manager/databricks/2023-02-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/databricks/2023-02-01/privateendpointconnections/client.go +++ b/resource-manager/databricks/2023-02-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/databricks/2023-02-01/privatelinkresources/client.go b/resource-manager/databricks/2023-02-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/databricks/2023-02-01/privatelinkresources/client.go +++ b/resource-manager/databricks/2023-02-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/databricks/2023-02-01/put/client.go b/resource-manager/databricks/2023-02-01/put/client.go index 3cebb510f93..3e377e36761 100644 --- a/resource-manager/databricks/2023-02-01/put/client.go +++ b/resource-manager/databricks/2023-02-01/put/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PUTClient struct { Client *resourcemanager.Client } -func NewPUTClientWithBaseURI(api environments.Api) (*PUTClient, error) { +func NewPUTClientWithBaseURI(api sdkEnv.Api) (*PUTClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "put", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PUTClient: %+v", err) diff --git a/resource-manager/databricks/2023-02-01/vnetpeering/client.go b/resource-manager/databricks/2023-02-01/vnetpeering/client.go index 3a58116b74f..e471ff02a7e 100644 --- a/resource-manager/databricks/2023-02-01/vnetpeering/client.go +++ b/resource-manager/databricks/2023-02-01/vnetpeering/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VNetPeeringClient struct { Client *resourcemanager.Client } -func NewVNetPeeringClientWithBaseURI(api environments.Api) (*VNetPeeringClient, error) { +func NewVNetPeeringClientWithBaseURI(api sdkEnv.Api) (*VNetPeeringClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vnetpeering", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VNetPeeringClient: %+v", err) diff --git a/resource-manager/databricks/2023-02-01/workspaces/client.go b/resource-manager/databricks/2023-02-01/workspaces/client.go index bf91cd2dee7..868fd830b2a 100644 --- a/resource-manager/databricks/2023-02-01/workspaces/client.go +++ b/resource-manager/databricks/2023-02-01/workspaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacesClient struct { Client *resourcemanager.Client } -func NewWorkspacesClientWithBaseURI(api environments.Api) (*WorkspacesClient, error) { +func NewWorkspacesClientWithBaseURI(api sdkEnv.Api) (*WorkspacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacesClient: %+v", err) diff --git a/resource-manager/databricks/2023-05-01/accessconnector/client.go b/resource-manager/databricks/2023-05-01/accessconnector/client.go index 0cc450c4307..9c8155a7f85 100644 --- a/resource-manager/databricks/2023-05-01/accessconnector/client.go +++ b/resource-manager/databricks/2023-05-01/accessconnector/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccessConnectorClient struct { Client *resourcemanager.Client } -func NewAccessConnectorClientWithBaseURI(api environments.Api) (*AccessConnectorClient, error) { +func NewAccessConnectorClientWithBaseURI(api sdkEnv.Api) (*AccessConnectorClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "accessconnector", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccessConnectorClient: %+v", err) diff --git a/resource-manager/databricks/2023-05-01/client.go b/resource-manager/databricks/2023-05-01/client.go index 1eee4b31cd0..1375a9ed08b 100644 --- a/resource-manager/databricks/2023-05-01/client.go +++ b/resource-manager/databricks/2023-05-01/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-05-01/accessconnector" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { AccessConnector *accessconnector.AccessConnectorClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { accessConnectorClient, err := accessconnector.NewAccessConnectorClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AccessConnector client: %+v", err) diff --git a/resource-manager/datadog/2021-03-01/agreements/client.go b/resource-manager/datadog/2021-03-01/agreements/client.go index 51de79b933c..40cdf7641ce 100644 --- a/resource-manager/datadog/2021-03-01/agreements/client.go +++ b/resource-manager/datadog/2021-03-01/agreements/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AgreementsClient struct { Client *resourcemanager.Client } -func NewAgreementsClientWithBaseURI(api environments.Api) (*AgreementsClient, error) { +func NewAgreementsClientWithBaseURI(api sdkEnv.Api) (*AgreementsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "agreements", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AgreementsClient: %+v", err) diff --git a/resource-manager/datadog/2021-03-01/apikey/client.go b/resource-manager/datadog/2021-03-01/apikey/client.go index 023f2b7b74a..7e00b15aae5 100644 --- a/resource-manager/datadog/2021-03-01/apikey/client.go +++ b/resource-manager/datadog/2021-03-01/apikey/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApiKeyClient struct { Client *resourcemanager.Client } -func NewApiKeyClientWithBaseURI(api environments.Api) (*ApiKeyClient, error) { +func NewApiKeyClientWithBaseURI(api sdkEnv.Api) (*ApiKeyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "apikey", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApiKeyClient: %+v", err) diff --git a/resource-manager/datadog/2021-03-01/client.go b/resource-manager/datadog/2021-03-01/client.go index a47c976dc06..bef4171954a 100644 --- a/resource-manager/datadog/2021-03-01/client.go +++ b/resource-manager/datadog/2021-03-01/client.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules" "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -31,7 +31,7 @@ type Client struct { SingleSignOn *singlesignon.SingleSignOnClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { agreementsClient, err := agreements.NewAgreementsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Agreements client: %+v", err) diff --git a/resource-manager/datadog/2021-03-01/hosts/client.go b/resource-manager/datadog/2021-03-01/hosts/client.go index 35751538e39..c0549fa5c59 100644 --- a/resource-manager/datadog/2021-03-01/hosts/client.go +++ b/resource-manager/datadog/2021-03-01/hosts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HostsClient struct { Client *resourcemanager.Client } -func NewHostsClientWithBaseURI(api environments.Api) (*HostsClient, error) { +func NewHostsClientWithBaseURI(api sdkEnv.Api) (*HostsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hosts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HostsClient: %+v", err) diff --git a/resource-manager/datadog/2021-03-01/linkedresources/client.go b/resource-manager/datadog/2021-03-01/linkedresources/client.go index 70ea4584be2..91ce3c9fc6c 100644 --- a/resource-manager/datadog/2021-03-01/linkedresources/client.go +++ b/resource-manager/datadog/2021-03-01/linkedresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LinkedResourcesClient struct { Client *resourcemanager.Client } -func NewLinkedResourcesClientWithBaseURI(api environments.Api) (*LinkedResourcesClient, error) { +func NewLinkedResourcesClientWithBaseURI(api sdkEnv.Api) (*LinkedResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "linkedresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LinkedResourcesClient: %+v", err) diff --git a/resource-manager/datadog/2021-03-01/monitoredresources/client.go b/resource-manager/datadog/2021-03-01/monitoredresources/client.go index 708d327579c..925ce7d53f7 100644 --- a/resource-manager/datadog/2021-03-01/monitoredresources/client.go +++ b/resource-manager/datadog/2021-03-01/monitoredresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitoredResourcesClient struct { Client *resourcemanager.Client } -func NewMonitoredResourcesClientWithBaseURI(api environments.Api) (*MonitoredResourcesClient, error) { +func NewMonitoredResourcesClientWithBaseURI(api sdkEnv.Api) (*MonitoredResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitoredresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitoredResourcesClient: %+v", err) diff --git a/resource-manager/datadog/2021-03-01/monitorsresource/client.go b/resource-manager/datadog/2021-03-01/monitorsresource/client.go index 9dbf73eadda..08b44fb5569 100644 --- a/resource-manager/datadog/2021-03-01/monitorsresource/client.go +++ b/resource-manager/datadog/2021-03-01/monitorsresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitorsResourceClient struct { Client *resourcemanager.Client } -func NewMonitorsResourceClientWithBaseURI(api environments.Api) (*MonitorsResourceClient, error) { +func NewMonitorsResourceClientWithBaseURI(api sdkEnv.Api) (*MonitorsResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitorsresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitorsResourceClient: %+v", err) diff --git a/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/client.go b/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/client.go index 1f62eb91357..ddc5f73b8a6 100644 --- a/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/client.go +++ b/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RefreshSetPasswordLinkClient struct { Client *resourcemanager.Client } -func NewRefreshSetPasswordLinkClientWithBaseURI(api environments.Api) (*RefreshSetPasswordLinkClient, error) { +func NewRefreshSetPasswordLinkClientWithBaseURI(api sdkEnv.Api) (*RefreshSetPasswordLinkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "refreshsetpasswordlink", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RefreshSetPasswordLinkClient: %+v", err) diff --git a/resource-manager/datadog/2021-03-01/rules/client.go b/resource-manager/datadog/2021-03-01/rules/client.go index 1897d15f86a..1fce7789d65 100644 --- a/resource-manager/datadog/2021-03-01/rules/client.go +++ b/resource-manager/datadog/2021-03-01/rules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RulesClient struct { Client *resourcemanager.Client } -func NewRulesClientWithBaseURI(api environments.Api) (*RulesClient, error) { +func NewRulesClientWithBaseURI(api sdkEnv.Api) (*RulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "rules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RulesClient: %+v", err) diff --git a/resource-manager/datadog/2021-03-01/singlesignon/client.go b/resource-manager/datadog/2021-03-01/singlesignon/client.go index b37a7e2692a..ecca8e4d537 100644 --- a/resource-manager/datadog/2021-03-01/singlesignon/client.go +++ b/resource-manager/datadog/2021-03-01/singlesignon/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SingleSignOnClient struct { Client *resourcemanager.Client } -func NewSingleSignOnClientWithBaseURI(api environments.Api) (*SingleSignOnClient, error) { +func NewSingleSignOnClientWithBaseURI(api sdkEnv.Api) (*SingleSignOnClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "singlesignon", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SingleSignOnClient: %+v", err) diff --git a/resource-manager/datadog/2022-06-01/agreements/client.go b/resource-manager/datadog/2022-06-01/agreements/client.go index 51de79b933c..40cdf7641ce 100644 --- a/resource-manager/datadog/2022-06-01/agreements/client.go +++ b/resource-manager/datadog/2022-06-01/agreements/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AgreementsClient struct { Client *resourcemanager.Client } -func NewAgreementsClientWithBaseURI(api environments.Api) (*AgreementsClient, error) { +func NewAgreementsClientWithBaseURI(api sdkEnv.Api) (*AgreementsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "agreements", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AgreementsClient: %+v", err) diff --git a/resource-manager/datadog/2022-06-01/apikey/client.go b/resource-manager/datadog/2022-06-01/apikey/client.go index 023f2b7b74a..7e00b15aae5 100644 --- a/resource-manager/datadog/2022-06-01/apikey/client.go +++ b/resource-manager/datadog/2022-06-01/apikey/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApiKeyClient struct { Client *resourcemanager.Client } -func NewApiKeyClientWithBaseURI(api environments.Api) (*ApiKeyClient, error) { +func NewApiKeyClientWithBaseURI(api sdkEnv.Api) (*ApiKeyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "apikey", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApiKeyClient: %+v", err) diff --git a/resource-manager/datadog/2022-06-01/client.go b/resource-manager/datadog/2022-06-01/client.go index 2101e35e7f1..4532e8306d3 100644 --- a/resource-manager/datadog/2022-06-01/client.go +++ b/resource-manager/datadog/2022-06-01/client.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2022-06-01/rules" "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2022-06-01/singlesignon" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -31,7 +31,7 @@ type Client struct { SingleSignOn *singlesignon.SingleSignOnClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { agreementsClient, err := agreements.NewAgreementsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Agreements client: %+v", err) diff --git a/resource-manager/datadog/2022-06-01/hosts/client.go b/resource-manager/datadog/2022-06-01/hosts/client.go index 35751538e39..c0549fa5c59 100644 --- a/resource-manager/datadog/2022-06-01/hosts/client.go +++ b/resource-manager/datadog/2022-06-01/hosts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HostsClient struct { Client *resourcemanager.Client } -func NewHostsClientWithBaseURI(api environments.Api) (*HostsClient, error) { +func NewHostsClientWithBaseURI(api sdkEnv.Api) (*HostsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hosts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HostsClient: %+v", err) diff --git a/resource-manager/datadog/2022-06-01/linkedresources/client.go b/resource-manager/datadog/2022-06-01/linkedresources/client.go index 70ea4584be2..91ce3c9fc6c 100644 --- a/resource-manager/datadog/2022-06-01/linkedresources/client.go +++ b/resource-manager/datadog/2022-06-01/linkedresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LinkedResourcesClient struct { Client *resourcemanager.Client } -func NewLinkedResourcesClientWithBaseURI(api environments.Api) (*LinkedResourcesClient, error) { +func NewLinkedResourcesClientWithBaseURI(api sdkEnv.Api) (*LinkedResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "linkedresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LinkedResourcesClient: %+v", err) diff --git a/resource-manager/datadog/2022-06-01/monitoredresources/client.go b/resource-manager/datadog/2022-06-01/monitoredresources/client.go index 708d327579c..925ce7d53f7 100644 --- a/resource-manager/datadog/2022-06-01/monitoredresources/client.go +++ b/resource-manager/datadog/2022-06-01/monitoredresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitoredResourcesClient struct { Client *resourcemanager.Client } -func NewMonitoredResourcesClientWithBaseURI(api environments.Api) (*MonitoredResourcesClient, error) { +func NewMonitoredResourcesClientWithBaseURI(api sdkEnv.Api) (*MonitoredResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitoredresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitoredResourcesClient: %+v", err) diff --git a/resource-manager/datadog/2022-06-01/monitorsresource/client.go b/resource-manager/datadog/2022-06-01/monitorsresource/client.go index 9dbf73eadda..08b44fb5569 100644 --- a/resource-manager/datadog/2022-06-01/monitorsresource/client.go +++ b/resource-manager/datadog/2022-06-01/monitorsresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitorsResourceClient struct { Client *resourcemanager.Client } -func NewMonitorsResourceClientWithBaseURI(api environments.Api) (*MonitorsResourceClient, error) { +func NewMonitorsResourceClientWithBaseURI(api sdkEnv.Api) (*MonitorsResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitorsresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitorsResourceClient: %+v", err) diff --git a/resource-manager/datadog/2022-06-01/refreshsetpasswordlink/client.go b/resource-manager/datadog/2022-06-01/refreshsetpasswordlink/client.go index 1f62eb91357..ddc5f73b8a6 100644 --- a/resource-manager/datadog/2022-06-01/refreshsetpasswordlink/client.go +++ b/resource-manager/datadog/2022-06-01/refreshsetpasswordlink/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RefreshSetPasswordLinkClient struct { Client *resourcemanager.Client } -func NewRefreshSetPasswordLinkClientWithBaseURI(api environments.Api) (*RefreshSetPasswordLinkClient, error) { +func NewRefreshSetPasswordLinkClientWithBaseURI(api sdkEnv.Api) (*RefreshSetPasswordLinkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "refreshsetpasswordlink", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RefreshSetPasswordLinkClient: %+v", err) diff --git a/resource-manager/datadog/2022-06-01/rules/client.go b/resource-manager/datadog/2022-06-01/rules/client.go index 1897d15f86a..1fce7789d65 100644 --- a/resource-manager/datadog/2022-06-01/rules/client.go +++ b/resource-manager/datadog/2022-06-01/rules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RulesClient struct { Client *resourcemanager.Client } -func NewRulesClientWithBaseURI(api environments.Api) (*RulesClient, error) { +func NewRulesClientWithBaseURI(api sdkEnv.Api) (*RulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "rules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RulesClient: %+v", err) diff --git a/resource-manager/datadog/2022-06-01/singlesignon/client.go b/resource-manager/datadog/2022-06-01/singlesignon/client.go index b37a7e2692a..ecca8e4d537 100644 --- a/resource-manager/datadog/2022-06-01/singlesignon/client.go +++ b/resource-manager/datadog/2022-06-01/singlesignon/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SingleSignOnClient struct { Client *resourcemanager.Client } -func NewSingleSignOnClientWithBaseURI(api environments.Api) (*SingleSignOnClient, error) { +func NewSingleSignOnClientWithBaseURI(api sdkEnv.Api) (*SingleSignOnClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "singlesignon", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SingleSignOnClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/activityruns/client.go b/resource-manager/datafactory/2018-06-01/activityruns/client.go index fcbe93c4b75..d8214ba7da7 100644 --- a/resource-manager/datafactory/2018-06-01/activityruns/client.go +++ b/resource-manager/datafactory/2018-06-01/activityruns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ActivityrunsClient struct { Client *resourcemanager.Client } -func NewActivityrunsClientWithBaseURI(api environments.Api) (*ActivityrunsClient, error) { +func NewActivityrunsClientWithBaseURI(api sdkEnv.Api) (*ActivityrunsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "activityruns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ActivityrunsClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/changedatacapture/client.go b/resource-manager/datafactory/2018-06-01/changedatacapture/client.go index 6dbd6cd3744..af6d2b41470 100644 --- a/resource-manager/datafactory/2018-06-01/changedatacapture/client.go +++ b/resource-manager/datafactory/2018-06-01/changedatacapture/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ChangeDataCaptureClient struct { Client *resourcemanager.Client } -func NewChangeDataCaptureClientWithBaseURI(api environments.Api) (*ChangeDataCaptureClient, error) { +func NewChangeDataCaptureClientWithBaseURI(api sdkEnv.Api) (*ChangeDataCaptureClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "changedatacapture", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ChangeDataCaptureClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/client.go b/resource-manager/datafactory/2018-06-01/client.go index 03ec9e55373..e35c9f7eafa 100644 --- a/resource-manager/datafactory/2018-06-01/client.go +++ b/resource-manager/datafactory/2018-06-01/client.go @@ -29,7 +29,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/datafactory/2018-06-01/triggerruns" "github.com/hashicorp/go-azure-sdk/resource-manager/datafactory/2018-06-01/triggers" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -57,7 +57,7 @@ type Client struct { Triggers *triggers.TriggersClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { activityrunsClient, err := activityruns.NewActivityrunsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Activityruns client: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/credentials/client.go b/resource-manager/datafactory/2018-06-01/credentials/client.go index 6ff1e7b184e..91343247c4c 100644 --- a/resource-manager/datafactory/2018-06-01/credentials/client.go +++ b/resource-manager/datafactory/2018-06-01/credentials/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CredentialsClient struct { Client *resourcemanager.Client } -func NewCredentialsClientWithBaseURI(api environments.Api) (*CredentialsClient, error) { +func NewCredentialsClientWithBaseURI(api sdkEnv.Api) (*CredentialsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "credentials", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CredentialsClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/dataflowdebugsession/client.go b/resource-manager/datafactory/2018-06-01/dataflowdebugsession/client.go index 441ab4c764a..fe2bace3e5a 100644 --- a/resource-manager/datafactory/2018-06-01/dataflowdebugsession/client.go +++ b/resource-manager/datafactory/2018-06-01/dataflowdebugsession/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataFlowDebugSessionClient struct { Client *resourcemanager.Client } -func NewDataFlowDebugSessionClientWithBaseURI(api environments.Api) (*DataFlowDebugSessionClient, error) { +func NewDataFlowDebugSessionClientWithBaseURI(api sdkEnv.Api) (*DataFlowDebugSessionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dataflowdebugsession", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataFlowDebugSessionClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/dataflows/client.go b/resource-manager/datafactory/2018-06-01/dataflows/client.go index 8d63a680997..3369d0da1da 100644 --- a/resource-manager/datafactory/2018-06-01/dataflows/client.go +++ b/resource-manager/datafactory/2018-06-01/dataflows/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataFlowsClient struct { Client *resourcemanager.Client } -func NewDataFlowsClientWithBaseURI(api environments.Api) (*DataFlowsClient, error) { +func NewDataFlowsClientWithBaseURI(api sdkEnv.Api) (*DataFlowsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dataflows", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataFlowsClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/datasets/client.go b/resource-manager/datafactory/2018-06-01/datasets/client.go index 899ed6fcaab..173a0f17582 100644 --- a/resource-manager/datafactory/2018-06-01/datasets/client.go +++ b/resource-manager/datafactory/2018-06-01/datasets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatasetsClient struct { Client *resourcemanager.Client } -func NewDatasetsClientWithBaseURI(api environments.Api) (*DatasetsClient, error) { +func NewDatasetsClientWithBaseURI(api sdkEnv.Api) (*DatasetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datasets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatasetsClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/exposurecontrol/client.go b/resource-manager/datafactory/2018-06-01/exposurecontrol/client.go index da434d1f089..1bbb421c2c8 100644 --- a/resource-manager/datafactory/2018-06-01/exposurecontrol/client.go +++ b/resource-manager/datafactory/2018-06-01/exposurecontrol/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExposureControlClient struct { Client *resourcemanager.Client } -func NewExposureControlClientWithBaseURI(api environments.Api) (*ExposureControlClient, error) { +func NewExposureControlClientWithBaseURI(api sdkEnv.Api) (*ExposureControlClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "exposurecontrol", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExposureControlClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/factories/client.go b/resource-manager/datafactory/2018-06-01/factories/client.go index ed0dbc1dcb9..4f6e6641564 100644 --- a/resource-manager/datafactory/2018-06-01/factories/client.go +++ b/resource-manager/datafactory/2018-06-01/factories/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FactoriesClient struct { Client *resourcemanager.Client } -func NewFactoriesClientWithBaseURI(api environments.Api) (*FactoriesClient, error) { +func NewFactoriesClientWithBaseURI(api sdkEnv.Api) (*FactoriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "factories", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FactoriesClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/globalparameters/client.go b/resource-manager/datafactory/2018-06-01/globalparameters/client.go index 5b43acbcdcd..b8712766142 100644 --- a/resource-manager/datafactory/2018-06-01/globalparameters/client.go +++ b/resource-manager/datafactory/2018-06-01/globalparameters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GlobalParametersClient struct { Client *resourcemanager.Client } -func NewGlobalParametersClientWithBaseURI(api environments.Api) (*GlobalParametersClient, error) { +func NewGlobalParametersClientWithBaseURI(api sdkEnv.Api) (*GlobalParametersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "globalparameters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GlobalParametersClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/integrationruntimenodes/client.go b/resource-manager/datafactory/2018-06-01/integrationruntimenodes/client.go index 7fa2599b558..3ce253c9ccf 100644 --- a/resource-manager/datafactory/2018-06-01/integrationruntimenodes/client.go +++ b/resource-manager/datafactory/2018-06-01/integrationruntimenodes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationRuntimeNodesClient struct { Client *resourcemanager.Client } -func NewIntegrationRuntimeNodesClientWithBaseURI(api environments.Api) (*IntegrationRuntimeNodesClient, error) { +func NewIntegrationRuntimeNodesClientWithBaseURI(api sdkEnv.Api) (*IntegrationRuntimeNodesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationruntimenodes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationRuntimeNodesClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/integrationruntimeobjectmetadata/client.go b/resource-manager/datafactory/2018-06-01/integrationruntimeobjectmetadata/client.go index df55aa59a1f..4bcad5e628e 100644 --- a/resource-manager/datafactory/2018-06-01/integrationruntimeobjectmetadata/client.go +++ b/resource-manager/datafactory/2018-06-01/integrationruntimeobjectmetadata/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationRuntimeObjectMetadataClient struct { Client *resourcemanager.Client } -func NewIntegrationRuntimeObjectMetadataClientWithBaseURI(api environments.Api) (*IntegrationRuntimeObjectMetadataClient, error) { +func NewIntegrationRuntimeObjectMetadataClientWithBaseURI(api sdkEnv.Api) (*IntegrationRuntimeObjectMetadataClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationruntimeobjectmetadata", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationRuntimeObjectMetadataClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/integrationruntimes/client.go b/resource-manager/datafactory/2018-06-01/integrationruntimes/client.go index 559bf07e0f3..937d0adb12d 100644 --- a/resource-manager/datafactory/2018-06-01/integrationruntimes/client.go +++ b/resource-manager/datafactory/2018-06-01/integrationruntimes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationRuntimesClient struct { Client *resourcemanager.Client } -func NewIntegrationRuntimesClientWithBaseURI(api environments.Api) (*IntegrationRuntimesClient, error) { +func NewIntegrationRuntimesClientWithBaseURI(api sdkEnv.Api) (*IntegrationRuntimesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationruntimes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationRuntimesClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/linkedservices/client.go b/resource-manager/datafactory/2018-06-01/linkedservices/client.go index 68f620c222c..950bbf3cf01 100644 --- a/resource-manager/datafactory/2018-06-01/linkedservices/client.go +++ b/resource-manager/datafactory/2018-06-01/linkedservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LinkedServicesClient struct { Client *resourcemanager.Client } -func NewLinkedServicesClientWithBaseURI(api environments.Api) (*LinkedServicesClient, error) { +func NewLinkedServicesClientWithBaseURI(api sdkEnv.Api) (*LinkedServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "linkedservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LinkedServicesClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/managedprivateendpoints/client.go b/resource-manager/datafactory/2018-06-01/managedprivateendpoints/client.go index d6803f28d6d..9d620ce0e91 100644 --- a/resource-manager/datafactory/2018-06-01/managedprivateendpoints/client.go +++ b/resource-manager/datafactory/2018-06-01/managedprivateendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedPrivateEndpointsClient struct { Client *resourcemanager.Client } -func NewManagedPrivateEndpointsClientWithBaseURI(api environments.Api) (*ManagedPrivateEndpointsClient, error) { +func NewManagedPrivateEndpointsClientWithBaseURI(api sdkEnv.Api) (*ManagedPrivateEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedprivateendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedPrivateEndpointsClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/client.go b/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/client.go index 1e5f286de6e..77898cfc4dc 100644 --- a/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/client.go +++ b/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedVirtualNetworksClient struct { Client *resourcemanager.Client } -func NewManagedVirtualNetworksClientWithBaseURI(api environments.Api) (*ManagedVirtualNetworksClient, error) { +func NewManagedVirtualNetworksClientWithBaseURI(api sdkEnv.Api) (*ManagedVirtualNetworksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedvirtualnetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedVirtualNetworksClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/pipelineruns/client.go b/resource-manager/datafactory/2018-06-01/pipelineruns/client.go index 1bf576f2a24..28ec00fc74b 100644 --- a/resource-manager/datafactory/2018-06-01/pipelineruns/client.go +++ b/resource-manager/datafactory/2018-06-01/pipelineruns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PipelineRunsClient struct { Client *resourcemanager.Client } -func NewPipelineRunsClientWithBaseURI(api environments.Api) (*PipelineRunsClient, error) { +func NewPipelineRunsClientWithBaseURI(api sdkEnv.Api) (*PipelineRunsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "pipelineruns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PipelineRunsClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/pipelines/client.go b/resource-manager/datafactory/2018-06-01/pipelines/client.go index 0b61ea7fcb1..288bf30a297 100644 --- a/resource-manager/datafactory/2018-06-01/pipelines/client.go +++ b/resource-manager/datafactory/2018-06-01/pipelines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PipelinesClient struct { Client *resourcemanager.Client } -func NewPipelinesClientWithBaseURI(api environments.Api) (*PipelinesClient, error) { +func NewPipelinesClientWithBaseURI(api sdkEnv.Api) (*PipelinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "pipelines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PipelinesClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/privateendpointconnections/client.go b/resource-manager/datafactory/2018-06-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/datafactory/2018-06-01/privateendpointconnections/client.go +++ b/resource-manager/datafactory/2018-06-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/privatelinkresources/client.go b/resource-manager/datafactory/2018-06-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/datafactory/2018-06-01/privatelinkresources/client.go +++ b/resource-manager/datafactory/2018-06-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/trigger/client.go b/resource-manager/datafactory/2018-06-01/trigger/client.go index a9e7525d802..5442c5e9be0 100644 --- a/resource-manager/datafactory/2018-06-01/trigger/client.go +++ b/resource-manager/datafactory/2018-06-01/trigger/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TriggerClient struct { Client *resourcemanager.Client } -func NewTriggerClientWithBaseURI(api environments.Api) (*TriggerClient, error) { +func NewTriggerClientWithBaseURI(api sdkEnv.Api) (*TriggerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "trigger", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TriggerClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/triggerruns/client.go b/resource-manager/datafactory/2018-06-01/triggerruns/client.go index 23b9867d0af..389cc7e7849 100644 --- a/resource-manager/datafactory/2018-06-01/triggerruns/client.go +++ b/resource-manager/datafactory/2018-06-01/triggerruns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TriggerrunsClient struct { Client *resourcemanager.Client } -func NewTriggerrunsClientWithBaseURI(api environments.Api) (*TriggerrunsClient, error) { +func NewTriggerrunsClientWithBaseURI(api sdkEnv.Api) (*TriggerrunsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "triggerruns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TriggerrunsClient: %+v", err) diff --git a/resource-manager/datafactory/2018-06-01/triggers/client.go b/resource-manager/datafactory/2018-06-01/triggers/client.go index 9a6deac9284..5fbc0c3a9f1 100644 --- a/resource-manager/datafactory/2018-06-01/triggers/client.go +++ b/resource-manager/datafactory/2018-06-01/triggers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TriggersClient struct { Client *resourcemanager.Client } -func NewTriggersClientWithBaseURI(api environments.Api) (*TriggersClient, error) { +func NewTriggersClientWithBaseURI(api sdkEnv.Api) (*TriggersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "triggers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TriggersClient: %+v", err) diff --git a/resource-manager/datalakeanalytics/2016-11-01/accounts/client.go b/resource-manager/datalakeanalytics/2016-11-01/accounts/client.go index c227130d6c6..443dca551fe 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/accounts/client.go +++ b/resource-manager/datalakeanalytics/2016-11-01/accounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccountsClient struct { Client *resourcemanager.Client } -func NewAccountsClientWithBaseURI(api environments.Api) (*AccountsClient, error) { +func NewAccountsClientWithBaseURI(api sdkEnv.Api) (*AccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "accounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccountsClient: %+v", err) diff --git a/resource-manager/datalakeanalytics/2016-11-01/client.go b/resource-manager/datalakeanalytics/2016-11-01/client.go index fd2c7a89884..e5c0f9d48e1 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/client.go +++ b/resource-manager/datalakeanalytics/2016-11-01/client.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/datalakeanalytics/2016-11-01/locations" "github.com/hashicorp/go-azure-sdk/resource-manager/datalakeanalytics/2016-11-01/storageaccounts" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -25,7 +25,7 @@ type Client struct { StorageAccounts *storageaccounts.StorageAccountsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { accountsClient, err := accounts.NewAccountsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Accounts client: %+v", err) diff --git a/resource-manager/datalakeanalytics/2016-11-01/computepolicies/client.go b/resource-manager/datalakeanalytics/2016-11-01/computepolicies/client.go index fdf94285613..0d6868d0682 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/computepolicies/client.go +++ b/resource-manager/datalakeanalytics/2016-11-01/computepolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ComputePoliciesClient struct { Client *resourcemanager.Client } -func NewComputePoliciesClientWithBaseURI(api environments.Api) (*ComputePoliciesClient, error) { +func NewComputePoliciesClientWithBaseURI(api sdkEnv.Api) (*ComputePoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "computepolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ComputePoliciesClient: %+v", err) diff --git a/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/client.go b/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/client.go index f1e111cd723..672e254b044 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/client.go +++ b/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataLakeStoreAccountsClient struct { Client *resourcemanager.Client } -func NewDataLakeStoreAccountsClientWithBaseURI(api environments.Api) (*DataLakeStoreAccountsClient, error) { +func NewDataLakeStoreAccountsClientWithBaseURI(api sdkEnv.Api) (*DataLakeStoreAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datalakestoreaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataLakeStoreAccountsClient: %+v", err) diff --git a/resource-manager/datalakeanalytics/2016-11-01/firewallrules/client.go b/resource-manager/datalakeanalytics/2016-11-01/firewallrules/client.go index 6493e429eb1..86eebdae36a 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/firewallrules/client.go +++ b/resource-manager/datalakeanalytics/2016-11-01/firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallRulesClient struct { Client *resourcemanager.Client } -func NewFirewallRulesClientWithBaseURI(api environments.Api) (*FirewallRulesClient, error) { +func NewFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) diff --git a/resource-manager/datalakeanalytics/2016-11-01/locations/client.go b/resource-manager/datalakeanalytics/2016-11-01/locations/client.go index 2317188109e..459b4dc0dc4 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/locations/client.go +++ b/resource-manager/datalakeanalytics/2016-11-01/locations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationsClient struct { Client *resourcemanager.Client } -func NewLocationsClientWithBaseURI(api environments.Api) (*LocationsClient, error) { +func NewLocationsClientWithBaseURI(api sdkEnv.Api) (*LocationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationsClient: %+v", err) diff --git a/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/client.go b/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/client.go index 6d86e81e728..85e7a567018 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/client.go +++ b/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StorageAccountsClient struct { Client *resourcemanager.Client } -func NewStorageAccountsClientWithBaseURI(api environments.Api) (*StorageAccountsClient, error) { +func NewStorageAccountsClientWithBaseURI(api sdkEnv.Api) (*StorageAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "storageaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StorageAccountsClient: %+v", err) diff --git a/resource-manager/datalakestore/2016-11-01/accounts/client.go b/resource-manager/datalakestore/2016-11-01/accounts/client.go index c227130d6c6..443dca551fe 100644 --- a/resource-manager/datalakestore/2016-11-01/accounts/client.go +++ b/resource-manager/datalakestore/2016-11-01/accounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccountsClient struct { Client *resourcemanager.Client } -func NewAccountsClientWithBaseURI(api environments.Api) (*AccountsClient, error) { +func NewAccountsClientWithBaseURI(api sdkEnv.Api) (*AccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "accounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccountsClient: %+v", err) diff --git a/resource-manager/datalakestore/2016-11-01/client.go b/resource-manager/datalakestore/2016-11-01/client.go index 48b8087da6e..c38df5b63f4 100644 --- a/resource-manager/datalakestore/2016-11-01/client.go +++ b/resource-manager/datalakestore/2016-11-01/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/datalakestore/2016-11-01/trustedidproviders" "github.com/hashicorp/go-azure-sdk/resource-manager/datalakestore/2016-11-01/virtualnetworkrules" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { VirtualNetworkRules *virtualnetworkrules.VirtualNetworkRulesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { accountsClient, err := accounts.NewAccountsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Accounts client: %+v", err) diff --git a/resource-manager/datalakestore/2016-11-01/firewallrules/client.go b/resource-manager/datalakestore/2016-11-01/firewallrules/client.go index 6493e429eb1..86eebdae36a 100644 --- a/resource-manager/datalakestore/2016-11-01/firewallrules/client.go +++ b/resource-manager/datalakestore/2016-11-01/firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallRulesClient struct { Client *resourcemanager.Client } -func NewFirewallRulesClientWithBaseURI(api environments.Api) (*FirewallRulesClient, error) { +func NewFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) diff --git a/resource-manager/datalakestore/2016-11-01/locations/client.go b/resource-manager/datalakestore/2016-11-01/locations/client.go index 2317188109e..459b4dc0dc4 100644 --- a/resource-manager/datalakestore/2016-11-01/locations/client.go +++ b/resource-manager/datalakestore/2016-11-01/locations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationsClient struct { Client *resourcemanager.Client } -func NewLocationsClientWithBaseURI(api environments.Api) (*LocationsClient, error) { +func NewLocationsClientWithBaseURI(api sdkEnv.Api) (*LocationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationsClient: %+v", err) diff --git a/resource-manager/datalakestore/2016-11-01/trustedidproviders/client.go b/resource-manager/datalakestore/2016-11-01/trustedidproviders/client.go index dd827a37348..9a087e5c31a 100644 --- a/resource-manager/datalakestore/2016-11-01/trustedidproviders/client.go +++ b/resource-manager/datalakestore/2016-11-01/trustedidproviders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TrustedIdProvidersClient struct { Client *resourcemanager.Client } -func NewTrustedIdProvidersClientWithBaseURI(api environments.Api) (*TrustedIdProvidersClient, error) { +func NewTrustedIdProvidersClientWithBaseURI(api sdkEnv.Api) (*TrustedIdProvidersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "trustedidproviders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TrustedIdProvidersClient: %+v", err) diff --git a/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/client.go b/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/client.go index b85d828ef86..6c65981bc1c 100644 --- a/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/client.go +++ b/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkRulesClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkRulesClientWithBaseURI(api environments.Api) (*VirtualNetworkRulesClient, error) { +func NewVirtualNetworkRulesClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworkrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkRulesClient: %+v", err) diff --git a/resource-manager/datamigration/2018-04-19/client.go b/resource-manager/datamigration/2018-04-19/client.go index c90b98066ba..cd26596e93f 100644 --- a/resource-manager/datamigration/2018-04-19/client.go +++ b/resource-manager/datamigration/2018-04-19/client.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/standardoperation" "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/taskresource" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -33,7 +33,7 @@ type Client struct { TaskResource *taskresource.TaskResourceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { customOperationClient, err := customoperation.NewCustomOperationClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CustomOperation client: %+v", err) diff --git a/resource-manager/datamigration/2018-04-19/customoperation/client.go b/resource-manager/datamigration/2018-04-19/customoperation/client.go index 6a42dd5d499..4c3b96684f6 100644 --- a/resource-manager/datamigration/2018-04-19/customoperation/client.go +++ b/resource-manager/datamigration/2018-04-19/customoperation/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CustomOperationClient struct { Client *resourcemanager.Client } -func NewCustomOperationClientWithBaseURI(api environments.Api) (*CustomOperationClient, error) { +func NewCustomOperationClientWithBaseURI(api sdkEnv.Api) (*CustomOperationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "customoperation", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CustomOperationClient: %+v", err) diff --git a/resource-manager/datamigration/2018-04-19/delete/client.go b/resource-manager/datamigration/2018-04-19/delete/client.go index c2e00994b74..7feeb7efcaf 100644 --- a/resource-manager/datamigration/2018-04-19/delete/client.go +++ b/resource-manager/datamigration/2018-04-19/delete/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DELETEClient struct { Client *resourcemanager.Client } -func NewDELETEClientWithBaseURI(api environments.Api) (*DELETEClient, error) { +func NewDELETEClientWithBaseURI(api sdkEnv.Api) (*DELETEClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "delete", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DELETEClient: %+v", err) diff --git a/resource-manager/datamigration/2018-04-19/get/client.go b/resource-manager/datamigration/2018-04-19/get/client.go index 87e28b74524..50de70f32af 100644 --- a/resource-manager/datamigration/2018-04-19/get/client.go +++ b/resource-manager/datamigration/2018-04-19/get/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GETClient struct { Client *resourcemanager.Client } -func NewGETClientWithBaseURI(api environments.Api) (*GETClient, error) { +func NewGETClientWithBaseURI(api sdkEnv.Api) (*GETClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "get", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GETClient: %+v", err) diff --git a/resource-manager/datamigration/2018-04-19/patch/client.go b/resource-manager/datamigration/2018-04-19/patch/client.go index f821ace4c83..0ac089fc824 100644 --- a/resource-manager/datamigration/2018-04-19/patch/client.go +++ b/resource-manager/datamigration/2018-04-19/patch/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PATCHClient struct { Client *resourcemanager.Client } -func NewPATCHClientWithBaseURI(api environments.Api) (*PATCHClient, error) { +func NewPATCHClientWithBaseURI(api sdkEnv.Api) (*PATCHClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "patch", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PATCHClient: %+v", err) diff --git a/resource-manager/datamigration/2018-04-19/post/client.go b/resource-manager/datamigration/2018-04-19/post/client.go index 5c269494682..77a33061901 100644 --- a/resource-manager/datamigration/2018-04-19/post/client.go +++ b/resource-manager/datamigration/2018-04-19/post/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type POSTClient struct { Client *resourcemanager.Client } -func NewPOSTClientWithBaseURI(api environments.Api) (*POSTClient, error) { +func NewPOSTClientWithBaseURI(api sdkEnv.Api) (*POSTClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "post", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating POSTClient: %+v", err) diff --git a/resource-manager/datamigration/2018-04-19/projectresource/client.go b/resource-manager/datamigration/2018-04-19/projectresource/client.go index 69289a68348..cb44e64170a 100644 --- a/resource-manager/datamigration/2018-04-19/projectresource/client.go +++ b/resource-manager/datamigration/2018-04-19/projectresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProjectResourceClient struct { Client *resourcemanager.Client } -func NewProjectResourceClientWithBaseURI(api environments.Api) (*ProjectResourceClient, error) { +func NewProjectResourceClientWithBaseURI(api sdkEnv.Api) (*ProjectResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "projectresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProjectResourceClient: %+v", err) diff --git a/resource-manager/datamigration/2018-04-19/put/client.go b/resource-manager/datamigration/2018-04-19/put/client.go index 3cebb510f93..3e377e36761 100644 --- a/resource-manager/datamigration/2018-04-19/put/client.go +++ b/resource-manager/datamigration/2018-04-19/put/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PUTClient struct { Client *resourcemanager.Client } -func NewPUTClientWithBaseURI(api environments.Api) (*PUTClient, error) { +func NewPUTClientWithBaseURI(api sdkEnv.Api) (*PUTClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "put", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PUTClient: %+v", err) diff --git a/resource-manager/datamigration/2018-04-19/serviceresource/client.go b/resource-manager/datamigration/2018-04-19/serviceresource/client.go index 076142ff70b..d482df14c70 100644 --- a/resource-manager/datamigration/2018-04-19/serviceresource/client.go +++ b/resource-manager/datamigration/2018-04-19/serviceresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServiceResourceClient struct { Client *resourcemanager.Client } -func NewServiceResourceClientWithBaseURI(api environments.Api) (*ServiceResourceClient, error) { +func NewServiceResourceClientWithBaseURI(api sdkEnv.Api) (*ServiceResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serviceresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServiceResourceClient: %+v", err) diff --git a/resource-manager/datamigration/2018-04-19/standardoperation/client.go b/resource-manager/datamigration/2018-04-19/standardoperation/client.go index e1c7efb92a5..379fd5180ba 100644 --- a/resource-manager/datamigration/2018-04-19/standardoperation/client.go +++ b/resource-manager/datamigration/2018-04-19/standardoperation/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StandardOperationClient struct { Client *resourcemanager.Client } -func NewStandardOperationClientWithBaseURI(api environments.Api) (*StandardOperationClient, error) { +func NewStandardOperationClientWithBaseURI(api sdkEnv.Api) (*StandardOperationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "standardoperation", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StandardOperationClient: %+v", err) diff --git a/resource-manager/datamigration/2018-04-19/taskresource/client.go b/resource-manager/datamigration/2018-04-19/taskresource/client.go index 051af2ffb2c..a93ce427d84 100644 --- a/resource-manager/datamigration/2018-04-19/taskresource/client.go +++ b/resource-manager/datamigration/2018-04-19/taskresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TaskResourceClient struct { Client *resourcemanager.Client } -func NewTaskResourceClientWithBaseURI(api environments.Api) (*TaskResourceClient, error) { +func NewTaskResourceClientWithBaseURI(api sdkEnv.Api) (*TaskResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "taskresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TaskResourceClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/client.go b/resource-manager/datamigration/2021-06-30/client.go index 4d963d7c726..61bd641085a 100644 --- a/resource-manager/datamigration/2021-06-30/client.go +++ b/resource-manager/datamigration/2021-06-30/client.go @@ -20,7 +20,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2021-06-30/standardoperation" "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2021-06-30/taskresource" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -39,7 +39,7 @@ type Client struct { TaskResource *taskresource.TaskResourceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { customOperationClient, err := customoperation.NewCustomOperationClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CustomOperation client: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/customoperation/client.go b/resource-manager/datamigration/2021-06-30/customoperation/client.go index 6a42dd5d499..4c3b96684f6 100644 --- a/resource-manager/datamigration/2021-06-30/customoperation/client.go +++ b/resource-manager/datamigration/2021-06-30/customoperation/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CustomOperationClient struct { Client *resourcemanager.Client } -func NewCustomOperationClientWithBaseURI(api environments.Api) (*CustomOperationClient, error) { +func NewCustomOperationClientWithBaseURI(api sdkEnv.Api) (*CustomOperationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "customoperation", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CustomOperationClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/delete/client.go b/resource-manager/datamigration/2021-06-30/delete/client.go index c2e00994b74..7feeb7efcaf 100644 --- a/resource-manager/datamigration/2021-06-30/delete/client.go +++ b/resource-manager/datamigration/2021-06-30/delete/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DELETEClient struct { Client *resourcemanager.Client } -func NewDELETEClientWithBaseURI(api environments.Api) (*DELETEClient, error) { +func NewDELETEClientWithBaseURI(api sdkEnv.Api) (*DELETEClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "delete", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DELETEClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/fieresource/client.go b/resource-manager/datamigration/2021-06-30/fieresource/client.go index fcb0c2f29d7..24edb3cd69b 100644 --- a/resource-manager/datamigration/2021-06-30/fieresource/client.go +++ b/resource-manager/datamigration/2021-06-30/fieresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FieResourceClient struct { Client *resourcemanager.Client } -func NewFieResourceClientWithBaseURI(api environments.Api) (*FieResourceClient, error) { +func NewFieResourceClientWithBaseURI(api sdkEnv.Api) (*FieResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fieresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FieResourceClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/fileresource/client.go b/resource-manager/datamigration/2021-06-30/fileresource/client.go index cbaf3457a04..470241a8562 100644 --- a/resource-manager/datamigration/2021-06-30/fileresource/client.go +++ b/resource-manager/datamigration/2021-06-30/fileresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FileResourceClient struct { Client *resourcemanager.Client } -func NewFileResourceClientWithBaseURI(api environments.Api) (*FileResourceClient, error) { +func NewFileResourceClientWithBaseURI(api sdkEnv.Api) (*FileResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fileresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FileResourceClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/get/client.go b/resource-manager/datamigration/2021-06-30/get/client.go index 87e28b74524..50de70f32af 100644 --- a/resource-manager/datamigration/2021-06-30/get/client.go +++ b/resource-manager/datamigration/2021-06-30/get/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GETClient struct { Client *resourcemanager.Client } -func NewGETClientWithBaseURI(api environments.Api) (*GETClient, error) { +func NewGETClientWithBaseURI(api sdkEnv.Api) (*GETClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "get", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GETClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/patch/client.go b/resource-manager/datamigration/2021-06-30/patch/client.go index f821ace4c83..0ac089fc824 100644 --- a/resource-manager/datamigration/2021-06-30/patch/client.go +++ b/resource-manager/datamigration/2021-06-30/patch/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PATCHClient struct { Client *resourcemanager.Client } -func NewPATCHClientWithBaseURI(api environments.Api) (*PATCHClient, error) { +func NewPATCHClientWithBaseURI(api sdkEnv.Api) (*PATCHClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "patch", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PATCHClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/post/client.go b/resource-manager/datamigration/2021-06-30/post/client.go index 5c269494682..77a33061901 100644 --- a/resource-manager/datamigration/2021-06-30/post/client.go +++ b/resource-manager/datamigration/2021-06-30/post/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type POSTClient struct { Client *resourcemanager.Client } -func NewPOSTClientWithBaseURI(api environments.Api) (*POSTClient, error) { +func NewPOSTClientWithBaseURI(api sdkEnv.Api) (*POSTClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "post", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating POSTClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/projectresource/client.go b/resource-manager/datamigration/2021-06-30/projectresource/client.go index 69289a68348..cb44e64170a 100644 --- a/resource-manager/datamigration/2021-06-30/projectresource/client.go +++ b/resource-manager/datamigration/2021-06-30/projectresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProjectResourceClient struct { Client *resourcemanager.Client } -func NewProjectResourceClientWithBaseURI(api environments.Api) (*ProjectResourceClient, error) { +func NewProjectResourceClientWithBaseURI(api sdkEnv.Api) (*ProjectResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "projectresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProjectResourceClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/put/client.go b/resource-manager/datamigration/2021-06-30/put/client.go index 3cebb510f93..3e377e36761 100644 --- a/resource-manager/datamigration/2021-06-30/put/client.go +++ b/resource-manager/datamigration/2021-06-30/put/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PUTClient struct { Client *resourcemanager.Client } -func NewPUTClientWithBaseURI(api environments.Api) (*PUTClient, error) { +func NewPUTClientWithBaseURI(api sdkEnv.Api) (*PUTClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "put", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PUTClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/serviceresource/client.go b/resource-manager/datamigration/2021-06-30/serviceresource/client.go index 076142ff70b..d482df14c70 100644 --- a/resource-manager/datamigration/2021-06-30/serviceresource/client.go +++ b/resource-manager/datamigration/2021-06-30/serviceresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServiceResourceClient struct { Client *resourcemanager.Client } -func NewServiceResourceClientWithBaseURI(api environments.Api) (*ServiceResourceClient, error) { +func NewServiceResourceClientWithBaseURI(api sdkEnv.Api) (*ServiceResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serviceresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServiceResourceClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/servicetaskresource/client.go b/resource-manager/datamigration/2021-06-30/servicetaskresource/client.go index 40e2ccb0351..c6087519cca 100644 --- a/resource-manager/datamigration/2021-06-30/servicetaskresource/client.go +++ b/resource-manager/datamigration/2021-06-30/servicetaskresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServiceTaskResourceClient struct { Client *resourcemanager.Client } -func NewServiceTaskResourceClientWithBaseURI(api environments.Api) (*ServiceTaskResourceClient, error) { +func NewServiceTaskResourceClientWithBaseURI(api sdkEnv.Api) (*ServiceTaskResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servicetaskresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServiceTaskResourceClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/standardoperation/client.go b/resource-manager/datamigration/2021-06-30/standardoperation/client.go index e1c7efb92a5..379fd5180ba 100644 --- a/resource-manager/datamigration/2021-06-30/standardoperation/client.go +++ b/resource-manager/datamigration/2021-06-30/standardoperation/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StandardOperationClient struct { Client *resourcemanager.Client } -func NewStandardOperationClientWithBaseURI(api environments.Api) (*StandardOperationClient, error) { +func NewStandardOperationClientWithBaseURI(api sdkEnv.Api) (*StandardOperationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "standardoperation", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StandardOperationClient: %+v", err) diff --git a/resource-manager/datamigration/2021-06-30/taskresource/client.go b/resource-manager/datamigration/2021-06-30/taskresource/client.go index 051af2ffb2c..a93ce427d84 100644 --- a/resource-manager/datamigration/2021-06-30/taskresource/client.go +++ b/resource-manager/datamigration/2021-06-30/taskresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TaskResourceClient struct { Client *resourcemanager.Client } -func NewTaskResourceClientWithBaseURI(api environments.Api) (*TaskResourceClient, error) { +func NewTaskResourceClientWithBaseURI(api sdkEnv.Api) (*TaskResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "taskresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TaskResourceClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-04-01/azurebackupjob/client.go b/resource-manager/dataprotection/2022-04-01/azurebackupjob/client.go index a74e2600fe5..835017d7f43 100644 --- a/resource-manager/dataprotection/2022-04-01/azurebackupjob/client.go +++ b/resource-manager/dataprotection/2022-04-01/azurebackupjob/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureBackupJobClient struct { Client *resourcemanager.Client } -func NewAzureBackupJobClientWithBaseURI(api environments.Api) (*AzureBackupJobClient, error) { +func NewAzureBackupJobClientWithBaseURI(api sdkEnv.Api) (*AzureBackupJobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azurebackupjob", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureBackupJobClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-04-01/azurebackupjobs/client.go b/resource-manager/dataprotection/2022-04-01/azurebackupjobs/client.go index 62b2f5cb9ae..2ab6ecc1a29 100644 --- a/resource-manager/dataprotection/2022-04-01/azurebackupjobs/client.go +++ b/resource-manager/dataprotection/2022-04-01/azurebackupjobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureBackupJobsClient struct { Client *resourcemanager.Client } -func NewAzureBackupJobsClientWithBaseURI(api environments.Api) (*AzureBackupJobsClient, error) { +func NewAzureBackupJobsClientWithBaseURI(api sdkEnv.Api) (*AzureBackupJobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azurebackupjobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureBackupJobsClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-04-01/backupinstances/client.go b/resource-manager/dataprotection/2022-04-01/backupinstances/client.go index 9822eb9f26d..95b06b36ebe 100644 --- a/resource-manager/dataprotection/2022-04-01/backupinstances/client.go +++ b/resource-manager/dataprotection/2022-04-01/backupinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupInstancesClient struct { Client *resourcemanager.Client } -func NewBackupInstancesClientWithBaseURI(api environments.Api) (*BackupInstancesClient, error) { +func NewBackupInstancesClientWithBaseURI(api sdkEnv.Api) (*BackupInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backupinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupInstancesClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-04-01/backuppolicies/client.go b/resource-manager/dataprotection/2022-04-01/backuppolicies/client.go index 446077de45c..aab528a3bf9 100644 --- a/resource-manager/dataprotection/2022-04-01/backuppolicies/client.go +++ b/resource-manager/dataprotection/2022-04-01/backuppolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupPoliciesClient struct { Client *resourcemanager.Client } -func NewBackupPoliciesClientWithBaseURI(api environments.Api) (*BackupPoliciesClient, error) { +func NewBackupPoliciesClientWithBaseURI(api sdkEnv.Api) (*BackupPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backuppolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupPoliciesClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-04-01/backupvaults/client.go b/resource-manager/dataprotection/2022-04-01/backupvaults/client.go index 75428ae3879..069b8e1ac1d 100644 --- a/resource-manager/dataprotection/2022-04-01/backupvaults/client.go +++ b/resource-manager/dataprotection/2022-04-01/backupvaults/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupVaultsClient struct { Client *resourcemanager.Client } -func NewBackupVaultsClientWithBaseURI(api environments.Api) (*BackupVaultsClient, error) { +func NewBackupVaultsClientWithBaseURI(api sdkEnv.Api) (*BackupVaultsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backupvaults", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupVaultsClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-04-01/client.go b/resource-manager/dataprotection/2022-04-01/client.go index 2a7565d86aa..e9f6d429420 100644 --- a/resource-manager/dataprotection/2022-04-01/client.go +++ b/resource-manager/dataprotection/2022-04-01/client.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/recoverypoint" "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -31,7 +31,7 @@ type Client struct { ResourceGuards *resourceguards.ResourceGuardsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { azureBackupJobClient, err := azurebackupjob.NewAzureBackupJobClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AzureBackupJob client: %+v", err) diff --git a/resource-manager/dataprotection/2022-04-01/dppfeaturesupport/client.go b/resource-manager/dataprotection/2022-04-01/dppfeaturesupport/client.go index 29add02e70f..132ef0290e5 100644 --- a/resource-manager/dataprotection/2022-04-01/dppfeaturesupport/client.go +++ b/resource-manager/dataprotection/2022-04-01/dppfeaturesupport/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DppFeatureSupportClient struct { Client *resourcemanager.Client } -func NewDppFeatureSupportClientWithBaseURI(api environments.Api) (*DppFeatureSupportClient, error) { +func NewDppFeatureSupportClientWithBaseURI(api sdkEnv.Api) (*DppFeatureSupportClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dppfeaturesupport", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DppFeatureSupportClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-04-01/findrestorabletimeranges/client.go b/resource-manager/dataprotection/2022-04-01/findrestorabletimeranges/client.go index cda26752f1e..e806ef9b179 100644 --- a/resource-manager/dataprotection/2022-04-01/findrestorabletimeranges/client.go +++ b/resource-manager/dataprotection/2022-04-01/findrestorabletimeranges/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FindRestorableTimeRangesClient struct { Client *resourcemanager.Client } -func NewFindRestorableTimeRangesClientWithBaseURI(api environments.Api) (*FindRestorableTimeRangesClient, error) { +func NewFindRestorableTimeRangesClientWithBaseURI(api sdkEnv.Api) (*FindRestorableTimeRangesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "findrestorabletimeranges", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FindRestorableTimeRangesClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-04-01/recoverypoint/client.go b/resource-manager/dataprotection/2022-04-01/recoverypoint/client.go index 9b44e53059f..0ec5839b42c 100644 --- a/resource-manager/dataprotection/2022-04-01/recoverypoint/client.go +++ b/resource-manager/dataprotection/2022-04-01/recoverypoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecoveryPointClient struct { Client *resourcemanager.Client } -func NewRecoveryPointClientWithBaseURI(api environments.Api) (*RecoveryPointClient, error) { +func NewRecoveryPointClientWithBaseURI(api sdkEnv.Api) (*RecoveryPointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recoverypoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecoveryPointClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-04-01/resourceguards/client.go b/resource-manager/dataprotection/2022-04-01/resourceguards/client.go index f18e7645891..3f0497d1a07 100644 --- a/resource-manager/dataprotection/2022-04-01/resourceguards/client.go +++ b/resource-manager/dataprotection/2022-04-01/resourceguards/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResourceGuardsClient struct { Client *resourcemanager.Client } -func NewResourceGuardsClientWithBaseURI(api environments.Api) (*ResourceGuardsClient, error) { +func NewResourceGuardsClientWithBaseURI(api sdkEnv.Api) (*ResourceGuardsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resourceguards", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResourceGuardsClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-05-01/azurebackupjob/client.go b/resource-manager/dataprotection/2022-05-01/azurebackupjob/client.go index a74e2600fe5..835017d7f43 100644 --- a/resource-manager/dataprotection/2022-05-01/azurebackupjob/client.go +++ b/resource-manager/dataprotection/2022-05-01/azurebackupjob/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureBackupJobClient struct { Client *resourcemanager.Client } -func NewAzureBackupJobClientWithBaseURI(api environments.Api) (*AzureBackupJobClient, error) { +func NewAzureBackupJobClientWithBaseURI(api sdkEnv.Api) (*AzureBackupJobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azurebackupjob", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureBackupJobClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-05-01/azurebackupjobs/client.go b/resource-manager/dataprotection/2022-05-01/azurebackupjobs/client.go index 62b2f5cb9ae..2ab6ecc1a29 100644 --- a/resource-manager/dataprotection/2022-05-01/azurebackupjobs/client.go +++ b/resource-manager/dataprotection/2022-05-01/azurebackupjobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureBackupJobsClient struct { Client *resourcemanager.Client } -func NewAzureBackupJobsClientWithBaseURI(api environments.Api) (*AzureBackupJobsClient, error) { +func NewAzureBackupJobsClientWithBaseURI(api sdkEnv.Api) (*AzureBackupJobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azurebackupjobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureBackupJobsClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-05-01/backupinstances/client.go b/resource-manager/dataprotection/2022-05-01/backupinstances/client.go index 9822eb9f26d..95b06b36ebe 100644 --- a/resource-manager/dataprotection/2022-05-01/backupinstances/client.go +++ b/resource-manager/dataprotection/2022-05-01/backupinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupInstancesClient struct { Client *resourcemanager.Client } -func NewBackupInstancesClientWithBaseURI(api environments.Api) (*BackupInstancesClient, error) { +func NewBackupInstancesClientWithBaseURI(api sdkEnv.Api) (*BackupInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backupinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupInstancesClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-05-01/backuppolicies/client.go b/resource-manager/dataprotection/2022-05-01/backuppolicies/client.go index 446077de45c..aab528a3bf9 100644 --- a/resource-manager/dataprotection/2022-05-01/backuppolicies/client.go +++ b/resource-manager/dataprotection/2022-05-01/backuppolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupPoliciesClient struct { Client *resourcemanager.Client } -func NewBackupPoliciesClientWithBaseURI(api environments.Api) (*BackupPoliciesClient, error) { +func NewBackupPoliciesClientWithBaseURI(api sdkEnv.Api) (*BackupPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backuppolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupPoliciesClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-05-01/backupvaults/client.go b/resource-manager/dataprotection/2022-05-01/backupvaults/client.go index 75428ae3879..069b8e1ac1d 100644 --- a/resource-manager/dataprotection/2022-05-01/backupvaults/client.go +++ b/resource-manager/dataprotection/2022-05-01/backupvaults/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupVaultsClient struct { Client *resourcemanager.Client } -func NewBackupVaultsClientWithBaseURI(api environments.Api) (*BackupVaultsClient, error) { +func NewBackupVaultsClientWithBaseURI(api sdkEnv.Api) (*BackupVaultsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backupvaults", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupVaultsClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-05-01/client.go b/resource-manager/dataprotection/2022-05-01/client.go index ec1c8f78947..1407f7dd035 100644 --- a/resource-manager/dataprotection/2022-05-01/client.go +++ b/resource-manager/dataprotection/2022-05-01/client.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-05-01/recoverypoint" "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-05-01/resourceguards" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -31,7 +31,7 @@ type Client struct { ResourceGuards *resourceguards.ResourceGuardsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { azureBackupJobClient, err := azurebackupjob.NewAzureBackupJobClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AzureBackupJob client: %+v", err) diff --git a/resource-manager/dataprotection/2022-05-01/dppfeaturesupport/client.go b/resource-manager/dataprotection/2022-05-01/dppfeaturesupport/client.go index 29add02e70f..132ef0290e5 100644 --- a/resource-manager/dataprotection/2022-05-01/dppfeaturesupport/client.go +++ b/resource-manager/dataprotection/2022-05-01/dppfeaturesupport/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DppFeatureSupportClient struct { Client *resourcemanager.Client } -func NewDppFeatureSupportClientWithBaseURI(api environments.Api) (*DppFeatureSupportClient, error) { +func NewDppFeatureSupportClientWithBaseURI(api sdkEnv.Api) (*DppFeatureSupportClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dppfeaturesupport", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DppFeatureSupportClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-05-01/findrestorabletimeranges/client.go b/resource-manager/dataprotection/2022-05-01/findrestorabletimeranges/client.go index cda26752f1e..e806ef9b179 100644 --- a/resource-manager/dataprotection/2022-05-01/findrestorabletimeranges/client.go +++ b/resource-manager/dataprotection/2022-05-01/findrestorabletimeranges/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FindRestorableTimeRangesClient struct { Client *resourcemanager.Client } -func NewFindRestorableTimeRangesClientWithBaseURI(api environments.Api) (*FindRestorableTimeRangesClient, error) { +func NewFindRestorableTimeRangesClientWithBaseURI(api sdkEnv.Api) (*FindRestorableTimeRangesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "findrestorabletimeranges", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FindRestorableTimeRangesClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-05-01/recoverypoint/client.go b/resource-manager/dataprotection/2022-05-01/recoverypoint/client.go index 9b44e53059f..0ec5839b42c 100644 --- a/resource-manager/dataprotection/2022-05-01/recoverypoint/client.go +++ b/resource-manager/dataprotection/2022-05-01/recoverypoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecoveryPointClient struct { Client *resourcemanager.Client } -func NewRecoveryPointClientWithBaseURI(api environments.Api) (*RecoveryPointClient, error) { +func NewRecoveryPointClientWithBaseURI(api sdkEnv.Api) (*RecoveryPointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recoverypoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecoveryPointClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-05-01/resourceguards/client.go b/resource-manager/dataprotection/2022-05-01/resourceguards/client.go index f18e7645891..3f0497d1a07 100644 --- a/resource-manager/dataprotection/2022-05-01/resourceguards/client.go +++ b/resource-manager/dataprotection/2022-05-01/resourceguards/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResourceGuardsClient struct { Client *resourcemanager.Client } -func NewResourceGuardsClientWithBaseURI(api environments.Api) (*ResourceGuardsClient, error) { +func NewResourceGuardsClientWithBaseURI(api sdkEnv.Api) (*ResourceGuardsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resourceguards", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResourceGuardsClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-12-01/azurebackupjob/client.go b/resource-manager/dataprotection/2022-12-01/azurebackupjob/client.go index a74e2600fe5..835017d7f43 100644 --- a/resource-manager/dataprotection/2022-12-01/azurebackupjob/client.go +++ b/resource-manager/dataprotection/2022-12-01/azurebackupjob/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureBackupJobClient struct { Client *resourcemanager.Client } -func NewAzureBackupJobClientWithBaseURI(api environments.Api) (*AzureBackupJobClient, error) { +func NewAzureBackupJobClientWithBaseURI(api sdkEnv.Api) (*AzureBackupJobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azurebackupjob", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureBackupJobClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-12-01/azurebackupjobs/client.go b/resource-manager/dataprotection/2022-12-01/azurebackupjobs/client.go index 62b2f5cb9ae..2ab6ecc1a29 100644 --- a/resource-manager/dataprotection/2022-12-01/azurebackupjobs/client.go +++ b/resource-manager/dataprotection/2022-12-01/azurebackupjobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureBackupJobsClient struct { Client *resourcemanager.Client } -func NewAzureBackupJobsClientWithBaseURI(api environments.Api) (*AzureBackupJobsClient, error) { +func NewAzureBackupJobsClientWithBaseURI(api sdkEnv.Api) (*AzureBackupJobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azurebackupjobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureBackupJobsClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-12-01/backupinstances/client.go b/resource-manager/dataprotection/2022-12-01/backupinstances/client.go index 9822eb9f26d..95b06b36ebe 100644 --- a/resource-manager/dataprotection/2022-12-01/backupinstances/client.go +++ b/resource-manager/dataprotection/2022-12-01/backupinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupInstancesClient struct { Client *resourcemanager.Client } -func NewBackupInstancesClientWithBaseURI(api environments.Api) (*BackupInstancesClient, error) { +func NewBackupInstancesClientWithBaseURI(api sdkEnv.Api) (*BackupInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backupinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupInstancesClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-12-01/backuppolicies/client.go b/resource-manager/dataprotection/2022-12-01/backuppolicies/client.go index 446077de45c..aab528a3bf9 100644 --- a/resource-manager/dataprotection/2022-12-01/backuppolicies/client.go +++ b/resource-manager/dataprotection/2022-12-01/backuppolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupPoliciesClient struct { Client *resourcemanager.Client } -func NewBackupPoliciesClientWithBaseURI(api environments.Api) (*BackupPoliciesClient, error) { +func NewBackupPoliciesClientWithBaseURI(api sdkEnv.Api) (*BackupPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backuppolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupPoliciesClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-12-01/backupvaults/client.go b/resource-manager/dataprotection/2022-12-01/backupvaults/client.go index 75428ae3879..069b8e1ac1d 100644 --- a/resource-manager/dataprotection/2022-12-01/backupvaults/client.go +++ b/resource-manager/dataprotection/2022-12-01/backupvaults/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupVaultsClient struct { Client *resourcemanager.Client } -func NewBackupVaultsClientWithBaseURI(api environments.Api) (*BackupVaultsClient, error) { +func NewBackupVaultsClientWithBaseURI(api sdkEnv.Api) (*BackupVaultsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backupvaults", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupVaultsClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-12-01/client.go b/resource-manager/dataprotection/2022-12-01/client.go index 73e50a33d22..3046efb1ce4 100644 --- a/resource-manager/dataprotection/2022-12-01/client.go +++ b/resource-manager/dataprotection/2022-12-01/client.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-12-01/recoverypoint" "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-12-01/resourceguards" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -33,7 +33,7 @@ type Client struct { ResourceGuards *resourceguards.ResourceGuardsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { azureBackupJobClient, err := azurebackupjob.NewAzureBackupJobClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AzureBackupJob client: %+v", err) diff --git a/resource-manager/dataprotection/2022-12-01/deletedbackupinstances/client.go b/resource-manager/dataprotection/2022-12-01/deletedbackupinstances/client.go index 8c8efb16baf..af1e96dce05 100644 --- a/resource-manager/dataprotection/2022-12-01/deletedbackupinstances/client.go +++ b/resource-manager/dataprotection/2022-12-01/deletedbackupinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeletedBackupInstancesClient struct { Client *resourcemanager.Client } -func NewDeletedBackupInstancesClientWithBaseURI(api environments.Api) (*DeletedBackupInstancesClient, error) { +func NewDeletedBackupInstancesClientWithBaseURI(api sdkEnv.Api) (*DeletedBackupInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "deletedbackupinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeletedBackupInstancesClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-12-01/dppfeaturesupport/client.go b/resource-manager/dataprotection/2022-12-01/dppfeaturesupport/client.go index 29add02e70f..132ef0290e5 100644 --- a/resource-manager/dataprotection/2022-12-01/dppfeaturesupport/client.go +++ b/resource-manager/dataprotection/2022-12-01/dppfeaturesupport/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DppFeatureSupportClient struct { Client *resourcemanager.Client } -func NewDppFeatureSupportClientWithBaseURI(api environments.Api) (*DppFeatureSupportClient, error) { +func NewDppFeatureSupportClientWithBaseURI(api sdkEnv.Api) (*DppFeatureSupportClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dppfeaturesupport", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DppFeatureSupportClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-12-01/findrestorabletimeranges/client.go b/resource-manager/dataprotection/2022-12-01/findrestorabletimeranges/client.go index cda26752f1e..e806ef9b179 100644 --- a/resource-manager/dataprotection/2022-12-01/findrestorabletimeranges/client.go +++ b/resource-manager/dataprotection/2022-12-01/findrestorabletimeranges/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FindRestorableTimeRangesClient struct { Client *resourcemanager.Client } -func NewFindRestorableTimeRangesClientWithBaseURI(api environments.Api) (*FindRestorableTimeRangesClient, error) { +func NewFindRestorableTimeRangesClientWithBaseURI(api sdkEnv.Api) (*FindRestorableTimeRangesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "findrestorabletimeranges", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FindRestorableTimeRangesClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-12-01/recoverypoint/client.go b/resource-manager/dataprotection/2022-12-01/recoverypoint/client.go index 9b44e53059f..0ec5839b42c 100644 --- a/resource-manager/dataprotection/2022-12-01/recoverypoint/client.go +++ b/resource-manager/dataprotection/2022-12-01/recoverypoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecoveryPointClient struct { Client *resourcemanager.Client } -func NewRecoveryPointClientWithBaseURI(api environments.Api) (*RecoveryPointClient, error) { +func NewRecoveryPointClientWithBaseURI(api sdkEnv.Api) (*RecoveryPointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recoverypoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecoveryPointClient: %+v", err) diff --git a/resource-manager/dataprotection/2022-12-01/resourceguards/client.go b/resource-manager/dataprotection/2022-12-01/resourceguards/client.go index f18e7645891..3f0497d1a07 100644 --- a/resource-manager/dataprotection/2022-12-01/resourceguards/client.go +++ b/resource-manager/dataprotection/2022-12-01/resourceguards/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResourceGuardsClient struct { Client *resourcemanager.Client } -func NewResourceGuardsClientWithBaseURI(api environments.Api) (*ResourceGuardsClient, error) { +func NewResourceGuardsClientWithBaseURI(api sdkEnv.Api) (*ResourceGuardsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resourceguards", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResourceGuardsClient: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/azurebackupjob/client.go b/resource-manager/dataprotection/2023-01-01/azurebackupjob/client.go index a74e2600fe5..835017d7f43 100644 --- a/resource-manager/dataprotection/2023-01-01/azurebackupjob/client.go +++ b/resource-manager/dataprotection/2023-01-01/azurebackupjob/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureBackupJobClient struct { Client *resourcemanager.Client } -func NewAzureBackupJobClientWithBaseURI(api environments.Api) (*AzureBackupJobClient, error) { +func NewAzureBackupJobClientWithBaseURI(api sdkEnv.Api) (*AzureBackupJobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azurebackupjob", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureBackupJobClient: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/azurebackupjobs/client.go b/resource-manager/dataprotection/2023-01-01/azurebackupjobs/client.go index 62b2f5cb9ae..2ab6ecc1a29 100644 --- a/resource-manager/dataprotection/2023-01-01/azurebackupjobs/client.go +++ b/resource-manager/dataprotection/2023-01-01/azurebackupjobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureBackupJobsClient struct { Client *resourcemanager.Client } -func NewAzureBackupJobsClientWithBaseURI(api environments.Api) (*AzureBackupJobsClient, error) { +func NewAzureBackupJobsClientWithBaseURI(api sdkEnv.Api) (*AzureBackupJobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azurebackupjobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureBackupJobsClient: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/backupinstances/client.go b/resource-manager/dataprotection/2023-01-01/backupinstances/client.go index 9822eb9f26d..95b06b36ebe 100644 --- a/resource-manager/dataprotection/2023-01-01/backupinstances/client.go +++ b/resource-manager/dataprotection/2023-01-01/backupinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupInstancesClient struct { Client *resourcemanager.Client } -func NewBackupInstancesClientWithBaseURI(api environments.Api) (*BackupInstancesClient, error) { +func NewBackupInstancesClientWithBaseURI(api sdkEnv.Api) (*BackupInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backupinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupInstancesClient: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/backuppolicies/client.go b/resource-manager/dataprotection/2023-01-01/backuppolicies/client.go index 446077de45c..aab528a3bf9 100644 --- a/resource-manager/dataprotection/2023-01-01/backuppolicies/client.go +++ b/resource-manager/dataprotection/2023-01-01/backuppolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupPoliciesClient struct { Client *resourcemanager.Client } -func NewBackupPoliciesClientWithBaseURI(api environments.Api) (*BackupPoliciesClient, error) { +func NewBackupPoliciesClientWithBaseURI(api sdkEnv.Api) (*BackupPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backuppolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupPoliciesClient: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/backupvaults/client.go b/resource-manager/dataprotection/2023-01-01/backupvaults/client.go index 75428ae3879..069b8e1ac1d 100644 --- a/resource-manager/dataprotection/2023-01-01/backupvaults/client.go +++ b/resource-manager/dataprotection/2023-01-01/backupvaults/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupVaultsClient struct { Client *resourcemanager.Client } -func NewBackupVaultsClientWithBaseURI(api environments.Api) (*BackupVaultsClient, error) { +func NewBackupVaultsClientWithBaseURI(api sdkEnv.Api) (*BackupVaultsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backupvaults", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupVaultsClient: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/client.go b/resource-manager/dataprotection/2023-01-01/client.go index 60a0323f6e4..868343dc557 100644 --- a/resource-manager/dataprotection/2023-01-01/client.go +++ b/resource-manager/dataprotection/2023-01-01/client.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2023-01-01/recoverypoint" "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2023-01-01/resourceguards" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -35,7 +35,7 @@ type Client struct { ResourceGuards *resourceguards.ResourceGuardsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { azureBackupJobClient, err := azurebackupjob.NewAzureBackupJobClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AzureBackupJob client: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/deletedbackupinstances/client.go b/resource-manager/dataprotection/2023-01-01/deletedbackupinstances/client.go index 8c8efb16baf..af1e96dce05 100644 --- a/resource-manager/dataprotection/2023-01-01/deletedbackupinstances/client.go +++ b/resource-manager/dataprotection/2023-01-01/deletedbackupinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeletedBackupInstancesClient struct { Client *resourcemanager.Client } -func NewDeletedBackupInstancesClientWithBaseURI(api environments.Api) (*DeletedBackupInstancesClient, error) { +func NewDeletedBackupInstancesClientWithBaseURI(api sdkEnv.Api) (*DeletedBackupInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "deletedbackupinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeletedBackupInstancesClient: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/dppfeaturesupport/client.go b/resource-manager/dataprotection/2023-01-01/dppfeaturesupport/client.go index 29add02e70f..132ef0290e5 100644 --- a/resource-manager/dataprotection/2023-01-01/dppfeaturesupport/client.go +++ b/resource-manager/dataprotection/2023-01-01/dppfeaturesupport/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DppFeatureSupportClient struct { Client *resourcemanager.Client } -func NewDppFeatureSupportClientWithBaseURI(api environments.Api) (*DppFeatureSupportClient, error) { +func NewDppFeatureSupportClientWithBaseURI(api sdkEnv.Api) (*DppFeatureSupportClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dppfeaturesupport", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DppFeatureSupportClient: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/dppresourceguardproxies/client.go b/resource-manager/dataprotection/2023-01-01/dppresourceguardproxies/client.go index cfb27cd589a..276710abedd 100644 --- a/resource-manager/dataprotection/2023-01-01/dppresourceguardproxies/client.go +++ b/resource-manager/dataprotection/2023-01-01/dppresourceguardproxies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DppResourceGuardProxiesClient struct { Client *resourcemanager.Client } -func NewDppResourceGuardProxiesClientWithBaseURI(api environments.Api) (*DppResourceGuardProxiesClient, error) { +func NewDppResourceGuardProxiesClientWithBaseURI(api sdkEnv.Api) (*DppResourceGuardProxiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dppresourceguardproxies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DppResourceGuardProxiesClient: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/findrestorabletimeranges/client.go b/resource-manager/dataprotection/2023-01-01/findrestorabletimeranges/client.go index cda26752f1e..e806ef9b179 100644 --- a/resource-manager/dataprotection/2023-01-01/findrestorabletimeranges/client.go +++ b/resource-manager/dataprotection/2023-01-01/findrestorabletimeranges/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FindRestorableTimeRangesClient struct { Client *resourcemanager.Client } -func NewFindRestorableTimeRangesClientWithBaseURI(api environments.Api) (*FindRestorableTimeRangesClient, error) { +func NewFindRestorableTimeRangesClientWithBaseURI(api sdkEnv.Api) (*FindRestorableTimeRangesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "findrestorabletimeranges", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FindRestorableTimeRangesClient: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/recoverypoint/client.go b/resource-manager/dataprotection/2023-01-01/recoverypoint/client.go index 9b44e53059f..0ec5839b42c 100644 --- a/resource-manager/dataprotection/2023-01-01/recoverypoint/client.go +++ b/resource-manager/dataprotection/2023-01-01/recoverypoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecoveryPointClient struct { Client *resourcemanager.Client } -func NewRecoveryPointClientWithBaseURI(api environments.Api) (*RecoveryPointClient, error) { +func NewRecoveryPointClientWithBaseURI(api sdkEnv.Api) (*RecoveryPointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recoverypoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecoveryPointClient: %+v", err) diff --git a/resource-manager/dataprotection/2023-01-01/resourceguards/client.go b/resource-manager/dataprotection/2023-01-01/resourceguards/client.go index f18e7645891..3f0497d1a07 100644 --- a/resource-manager/dataprotection/2023-01-01/resourceguards/client.go +++ b/resource-manager/dataprotection/2023-01-01/resourceguards/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResourceGuardsClient struct { Client *resourcemanager.Client } -func NewResourceGuardsClientWithBaseURI(api environments.Api) (*ResourceGuardsClient, error) { +func NewResourceGuardsClientWithBaseURI(api sdkEnv.Api) (*ResourceGuardsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resourceguards", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResourceGuardsClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/application/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/application/client.go index a2f3d7b0dcb..808f717a43d 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/application/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/application/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationClient struct { Client *resourcemanager.Client } -func NewApplicationClientWithBaseURI(api environments.Api) (*ApplicationClient, error) { +func NewApplicationClientWithBaseURI(api sdkEnv.Api) (*ApplicationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "application", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/client.go index af56c03687c..e952a85e645 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGroupClient struct { Client *resourcemanager.Client } -func NewApplicationGroupClientWithBaseURI(api environments.Api) (*ApplicationGroupClient, error) { +func NewApplicationGroupClientWithBaseURI(api sdkEnv.Api) (*ApplicationGroupClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgroup", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGroupClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/client.go index 296ad6c4198..4ca214f3bee 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/client.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/usersession" "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -37,7 +37,7 @@ type Client struct { Workspace *workspace.WorkspaceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { applicationClient, err := application.NewApplicationClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Application client: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/client.go index 0f6b416d629..4a8b97b768a 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DesktopClient struct { Client *resourcemanager.Client } -func NewDesktopClientWithBaseURI(api environments.Api) (*DesktopClient, error) { +func NewDesktopClientWithBaseURI(api sdkEnv.Api) (*DesktopClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "desktop", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DesktopClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/client.go index ec24fd0753c..0e94f4453c2 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HostPoolClient struct { Client *resourcemanager.Client } -func NewHostPoolClientWithBaseURI(api environments.Api) (*HostPoolClient, error) { +func NewHostPoolClientWithBaseURI(api sdkEnv.Api) (*HostPoolClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hostpool", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HostPoolClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/msiximage/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/msiximage/client.go index f9d5bf6617b..b6fa57dd8b5 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/msiximage/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/msiximage/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MsixImageClient struct { Client *resourcemanager.Client } -func NewMsixImageClientWithBaseURI(api environments.Api) (*MsixImageClient, error) { +func NewMsixImageClientWithBaseURI(api sdkEnv.Api) (*MsixImageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "msiximage", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MsixImageClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/client.go index 64525ac7e3d..db221f3d523 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MSIXPackageClient struct { Client *resourcemanager.Client } -func NewMSIXPackageClientWithBaseURI(api environments.Api) (*MSIXPackageClient, error) { +func NewMSIXPackageClientWithBaseURI(api sdkEnv.Api) (*MSIXPackageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "msixpackage", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MSIXPackageClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/client.go index 233caa2f8ff..1e4d6de39d2 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkClient struct { Client *resourcemanager.Client } -func NewPrivateLinkClientWithBaseURI(api environments.Api) (*PrivateLinkClient, error) { +func NewPrivateLinkClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelink", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/client.go index 3cc11f40698..a467861c2c8 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScalingPlanClient struct { Client *resourcemanager.Client } -func NewScalingPlanClientWithBaseURI(api environments.Api) (*ScalingPlanClient, error) { +func NewScalingPlanClientWithBaseURI(api sdkEnv.Api) (*ScalingPlanClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scalingplan", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScalingPlanClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/client.go index 23406f768a0..6c8e4ead593 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SessionHostClient struct { Client *resourcemanager.Client } -func NewSessionHostClientWithBaseURI(api environments.Api) (*SessionHostClient, error) { +func NewSessionHostClientWithBaseURI(api sdkEnv.Api) (*SessionHostClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sessionhost", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SessionHostClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/startmenuitem/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/startmenuitem/client.go index 89c79fb2238..5b3a98b5d5b 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/startmenuitem/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/startmenuitem/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StartMenuItemClient struct { Client *resourcemanager.Client } -func NewStartMenuItemClientWithBaseURI(api environments.Api) (*StartMenuItemClient, error) { +func NewStartMenuItemClientWithBaseURI(api sdkEnv.Api) (*StartMenuItemClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "startmenuitem", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StartMenuItemClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/client.go index 94a5462f7fe..da185ebd45e 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UserSessionClient struct { Client *resourcemanager.Client } -func NewUserSessionClientWithBaseURI(api environments.Api) (*UserSessionClient, error) { +func NewUserSessionClientWithBaseURI(api sdkEnv.Api) (*UserSessionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usersession", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UserSessionClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/client.go b/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/client.go index 5bd1393cfa2..9952a3db5ab 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/client.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspaceClient struct { Client *resourcemanager.Client } -func NewWorkspaceClientWithBaseURI(api environments.Api) (*WorkspaceClient, error) { +func NewWorkspaceClientWithBaseURI(api sdkEnv.Api) (*WorkspaceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspace", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspaceClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/application/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/application/client.go index a2f3d7b0dcb..808f717a43d 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/application/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/application/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationClient struct { Client *resourcemanager.Client } -func NewApplicationClientWithBaseURI(api environments.Api) (*ApplicationClient, error) { +func NewApplicationClientWithBaseURI(api sdkEnv.Api) (*ApplicationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "application", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/applicationgroup/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/applicationgroup/client.go index af56c03687c..e952a85e645 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/applicationgroup/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/applicationgroup/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGroupClient struct { Client *resourcemanager.Client } -func NewApplicationGroupClientWithBaseURI(api environments.Api) (*ApplicationGroupClient, error) { +func NewApplicationGroupClientWithBaseURI(api sdkEnv.Api) (*ApplicationGroupClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgroup", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGroupClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/client.go index 30b933bc15c..80e45e68cb0 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/client.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2022-02-10-preview/usersession" "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2022-02-10-preview/workspace" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -37,7 +37,7 @@ type Client struct { Workspace *workspace.WorkspaceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { applicationClient, err := application.NewApplicationClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Application client: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/client.go index 0f6b416d629..4a8b97b768a 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DesktopClient struct { Client *resourcemanager.Client } -func NewDesktopClientWithBaseURI(api environments.Api) (*DesktopClient, error) { +func NewDesktopClientWithBaseURI(api sdkEnv.Api) (*DesktopClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "desktop", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DesktopClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/hostpool/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/hostpool/client.go index ec24fd0753c..0e94f4453c2 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/hostpool/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/hostpool/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HostPoolClient struct { Client *resourcemanager.Client } -func NewHostPoolClientWithBaseURI(api environments.Api) (*HostPoolClient, error) { +func NewHostPoolClientWithBaseURI(api sdkEnv.Api) (*HostPoolClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hostpool", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HostPoolClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/msiximage/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/msiximage/client.go index f9d5bf6617b..b6fa57dd8b5 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/msiximage/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/msiximage/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MsixImageClient struct { Client *resourcemanager.Client } -func NewMsixImageClientWithBaseURI(api environments.Api) (*MsixImageClient, error) { +func NewMsixImageClientWithBaseURI(api sdkEnv.Api) (*MsixImageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "msiximage", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MsixImageClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/client.go index 64525ac7e3d..db221f3d523 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MSIXPackageClient struct { Client *resourcemanager.Client } -func NewMSIXPackageClientWithBaseURI(api environments.Api) (*MSIXPackageClient, error) { +func NewMSIXPackageClientWithBaseURI(api sdkEnv.Api) (*MSIXPackageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "msixpackage", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MSIXPackageClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/client.go index 233caa2f8ff..1e4d6de39d2 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkClient struct { Client *resourcemanager.Client } -func NewPrivateLinkClientWithBaseURI(api environments.Api) (*PrivateLinkClient, error) { +func NewPrivateLinkClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelink", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/client.go index 3cc11f40698..a467861c2c8 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScalingPlanClient struct { Client *resourcemanager.Client } -func NewScalingPlanClientWithBaseURI(api environments.Api) (*ScalingPlanClient, error) { +func NewScalingPlanClientWithBaseURI(api sdkEnv.Api) (*ScalingPlanClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scalingplan", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScalingPlanClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/client.go index 23406f768a0..6c8e4ead593 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SessionHostClient struct { Client *resourcemanager.Client } -func NewSessionHostClientWithBaseURI(api environments.Api) (*SessionHostClient, error) { +func NewSessionHostClientWithBaseURI(api sdkEnv.Api) (*SessionHostClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sessionhost", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SessionHostClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/startmenuitem/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/startmenuitem/client.go index 89c79fb2238..5b3a98b5d5b 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/startmenuitem/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/startmenuitem/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StartMenuItemClient struct { Client *resourcemanager.Client } -func NewStartMenuItemClientWithBaseURI(api environments.Api) (*StartMenuItemClient, error) { +func NewStartMenuItemClientWithBaseURI(api sdkEnv.Api) (*StartMenuItemClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "startmenuitem", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StartMenuItemClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/client.go index 94a5462f7fe..da185ebd45e 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UserSessionClient struct { Client *resourcemanager.Client } -func NewUserSessionClientWithBaseURI(api environments.Api) (*UserSessionClient, error) { +func NewUserSessionClientWithBaseURI(api sdkEnv.Api) (*UserSessionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usersession", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UserSessionClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/workspace/client.go b/resource-manager/desktopvirtualization/2022-02-10-preview/workspace/client.go index 5bd1393cfa2..9952a3db5ab 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/workspace/client.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/workspace/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspaceClient struct { Client *resourcemanager.Client } -func NewWorkspaceClientWithBaseURI(api environments.Api) (*WorkspaceClient, error) { +func NewWorkspaceClientWithBaseURI(api sdkEnv.Api) (*WorkspaceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspace", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspaceClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/application/client.go b/resource-manager/desktopvirtualization/2022-09-09/application/client.go index a2f3d7b0dcb..808f717a43d 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/application/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/application/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationClient struct { Client *resourcemanager.Client } -func NewApplicationClientWithBaseURI(api environments.Api) (*ApplicationClient, error) { +func NewApplicationClientWithBaseURI(api sdkEnv.Api) (*ApplicationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "application", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/applicationgroup/client.go b/resource-manager/desktopvirtualization/2022-09-09/applicationgroup/client.go index af56c03687c..e952a85e645 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/applicationgroup/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/applicationgroup/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGroupClient struct { Client *resourcemanager.Client } -func NewApplicationGroupClientWithBaseURI(api environments.Api) (*ApplicationGroupClient, error) { +func NewApplicationGroupClientWithBaseURI(api sdkEnv.Api) (*ApplicationGroupClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgroup", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGroupClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/client.go b/resource-manager/desktopvirtualization/2022-09-09/client.go index 684e46cb41f..46d99708100 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/client.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2022-09-09/usersession" "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2022-09-09/workspace" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -37,7 +37,7 @@ type Client struct { Workspace *workspace.WorkspaceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { applicationClient, err := application.NewApplicationClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Application client: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/desktop/client.go b/resource-manager/desktopvirtualization/2022-09-09/desktop/client.go index 0f6b416d629..4a8b97b768a 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/desktop/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/desktop/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DesktopClient struct { Client *resourcemanager.Client } -func NewDesktopClientWithBaseURI(api environments.Api) (*DesktopClient, error) { +func NewDesktopClientWithBaseURI(api sdkEnv.Api) (*DesktopClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "desktop", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DesktopClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/hostpool/client.go b/resource-manager/desktopvirtualization/2022-09-09/hostpool/client.go index ec24fd0753c..0e94f4453c2 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/hostpool/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/hostpool/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HostPoolClient struct { Client *resourcemanager.Client } -func NewHostPoolClientWithBaseURI(api environments.Api) (*HostPoolClient, error) { +func NewHostPoolClientWithBaseURI(api sdkEnv.Api) (*HostPoolClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hostpool", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HostPoolClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/msiximage/client.go b/resource-manager/desktopvirtualization/2022-09-09/msiximage/client.go index f9d5bf6617b..b6fa57dd8b5 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/msiximage/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/msiximage/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MsixImageClient struct { Client *resourcemanager.Client } -func NewMsixImageClientWithBaseURI(api environments.Api) (*MsixImageClient, error) { +func NewMsixImageClientWithBaseURI(api sdkEnv.Api) (*MsixImageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "msiximage", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MsixImageClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/msixpackage/client.go b/resource-manager/desktopvirtualization/2022-09-09/msixpackage/client.go index 64525ac7e3d..db221f3d523 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/msixpackage/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/msixpackage/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MSIXPackageClient struct { Client *resourcemanager.Client } -func NewMSIXPackageClientWithBaseURI(api environments.Api) (*MSIXPackageClient, error) { +func NewMSIXPackageClientWithBaseURI(api sdkEnv.Api) (*MSIXPackageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "msixpackage", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MSIXPackageClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/scalingplan/client.go b/resource-manager/desktopvirtualization/2022-09-09/scalingplan/client.go index 3cc11f40698..a467861c2c8 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/scalingplan/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/scalingplan/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScalingPlanClient struct { Client *resourcemanager.Client } -func NewScalingPlanClientWithBaseURI(api environments.Api) (*ScalingPlanClient, error) { +func NewScalingPlanClientWithBaseURI(api sdkEnv.Api) (*ScalingPlanClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scalingplan", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScalingPlanClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/client.go b/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/client.go index 7664fecaa9f..aa4727a5aaf 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScalingPlanPooledScheduleClient struct { Client *resourcemanager.Client } -func NewScalingPlanPooledScheduleClientWithBaseURI(api environments.Api) (*ScalingPlanPooledScheduleClient, error) { +func NewScalingPlanPooledScheduleClientWithBaseURI(api sdkEnv.Api) (*ScalingPlanPooledScheduleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scalingplanpooledschedule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScalingPlanPooledScheduleClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/sessionhost/client.go b/resource-manager/desktopvirtualization/2022-09-09/sessionhost/client.go index 23406f768a0..6c8e4ead593 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/sessionhost/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/sessionhost/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SessionHostClient struct { Client *resourcemanager.Client } -func NewSessionHostClientWithBaseURI(api environments.Api) (*SessionHostClient, error) { +func NewSessionHostClientWithBaseURI(api sdkEnv.Api) (*SessionHostClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sessionhost", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SessionHostClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/startmenuitem/client.go b/resource-manager/desktopvirtualization/2022-09-09/startmenuitem/client.go index 89c79fb2238..5b3a98b5d5b 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/startmenuitem/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/startmenuitem/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StartMenuItemClient struct { Client *resourcemanager.Client } -func NewStartMenuItemClientWithBaseURI(api environments.Api) (*StartMenuItemClient, error) { +func NewStartMenuItemClientWithBaseURI(api sdkEnv.Api) (*StartMenuItemClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "startmenuitem", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StartMenuItemClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/usersession/client.go b/resource-manager/desktopvirtualization/2022-09-09/usersession/client.go index 94a5462f7fe..da185ebd45e 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/usersession/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/usersession/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UserSessionClient struct { Client *resourcemanager.Client } -func NewUserSessionClientWithBaseURI(api environments.Api) (*UserSessionClient, error) { +func NewUserSessionClientWithBaseURI(api sdkEnv.Api) (*UserSessionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usersession", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UserSessionClient: %+v", err) diff --git a/resource-manager/desktopvirtualization/2022-09-09/workspace/client.go b/resource-manager/desktopvirtualization/2022-09-09/workspace/client.go index 5bd1393cfa2..9952a3db5ab 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/workspace/client.go +++ b/resource-manager/desktopvirtualization/2022-09-09/workspace/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspaceClient struct { Client *resourcemanager.Client } -func NewWorkspaceClientWithBaseURI(api environments.Api) (*WorkspaceClient, error) { +func NewWorkspaceClientWithBaseURI(api sdkEnv.Api) (*WorkspaceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspace", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspaceClient: %+v", err) diff --git a/resource-manager/deviceprovisioningservices/2022-02-05/client.go b/resource-manager/deviceprovisioningservices/2022-02-05/client.go index 99b2f1cf858..8e6dd85076a 100644 --- a/resource-manager/deviceprovisioningservices/2022-02-05/client.go +++ b/resource-manager/deviceprovisioningservices/2022-02-05/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/dpscertificate" "github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { IotDpsResource *iotdpsresource.IotDpsResourceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { dpsCertificateClient, err := dpscertificate.NewDpsCertificateClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DpsCertificate client: %+v", err) diff --git a/resource-manager/deviceprovisioningservices/2022-02-05/dpscertificate/client.go b/resource-manager/deviceprovisioningservices/2022-02-05/dpscertificate/client.go index 9bcbdae2f39..e1f536c5fcb 100644 --- a/resource-manager/deviceprovisioningservices/2022-02-05/dpscertificate/client.go +++ b/resource-manager/deviceprovisioningservices/2022-02-05/dpscertificate/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DpsCertificateClient struct { Client *resourcemanager.Client } -func NewDpsCertificateClientWithBaseURI(api environments.Api) (*DpsCertificateClient, error) { +func NewDpsCertificateClientWithBaseURI(api sdkEnv.Api) (*DpsCertificateClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dpscertificate", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DpsCertificateClient: %+v", err) diff --git a/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/client.go b/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/client.go index 3447cead3f5..bbf381d81d2 100644 --- a/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/client.go +++ b/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IotDpsResourceClient struct { Client *resourcemanager.Client } -func NewIotDpsResourceClientWithBaseURI(api environments.Api) (*IotDpsResourceClient, error) { +func NewIotDpsResourceClientWithBaseURI(api sdkEnv.Api) (*IotDpsResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "iotdpsresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IotDpsResourceClient: %+v", err) diff --git a/resource-manager/deviceprovisioningservices/2022-12-12/client.go b/resource-manager/deviceprovisioningservices/2022-12-12/client.go index 3a3e7f1cc17..3c2ddd95b84 100644 --- a/resource-manager/deviceprovisioningservices/2022-12-12/client.go +++ b/resource-manager/deviceprovisioningservices/2022-12-12/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-12-12/dpscertificate" "github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { IotDpsResource *iotdpsresource.IotDpsResourceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { dpsCertificateClient, err := dpscertificate.NewDpsCertificateClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DpsCertificate client: %+v", err) diff --git a/resource-manager/deviceprovisioningservices/2022-12-12/dpscertificate/client.go b/resource-manager/deviceprovisioningservices/2022-12-12/dpscertificate/client.go index 9bcbdae2f39..e1f536c5fcb 100644 --- a/resource-manager/deviceprovisioningservices/2022-12-12/dpscertificate/client.go +++ b/resource-manager/deviceprovisioningservices/2022-12-12/dpscertificate/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DpsCertificateClient struct { Client *resourcemanager.Client } -func NewDpsCertificateClientWithBaseURI(api environments.Api) (*DpsCertificateClient, error) { +func NewDpsCertificateClientWithBaseURI(api sdkEnv.Api) (*DpsCertificateClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dpscertificate", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DpsCertificateClient: %+v", err) diff --git a/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/client.go b/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/client.go index 3447cead3f5..bbf381d81d2 100644 --- a/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/client.go +++ b/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IotDpsResourceClient struct { Client *resourcemanager.Client } -func NewIotDpsResourceClientWithBaseURI(api environments.Api) (*IotDpsResourceClient, error) { +func NewIotDpsResourceClientWithBaseURI(api sdkEnv.Api) (*IotDpsResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "iotdpsresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IotDpsResourceClient: %+v", err) diff --git a/resource-manager/deviceupdate/2022-10-01/client.go b/resource-manager/deviceupdate/2022-10-01/client.go index d8ac55322b3..3a161f57529 100644 --- a/resource-manager/deviceupdate/2022-10-01/client.go +++ b/resource-manager/deviceupdate/2022-10-01/client.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/deviceupdate/2022-10-01/privateendpointconnections" "github.com/hashicorp/go-azure-sdk/resource-manager/deviceupdate/2022-10-01/privatelinkresources" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -21,7 +21,7 @@ type Client struct { PrivateLinkResources *privatelinkresources.PrivateLinkResourcesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { deviceupdatesClient, err := deviceupdates.NewDeviceupdatesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Deviceupdates client: %+v", err) diff --git a/resource-manager/deviceupdate/2022-10-01/deviceupdates/client.go b/resource-manager/deviceupdate/2022-10-01/deviceupdates/client.go index 1823789119d..d3191bc5f56 100644 --- a/resource-manager/deviceupdate/2022-10-01/deviceupdates/client.go +++ b/resource-manager/deviceupdate/2022-10-01/deviceupdates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeviceupdatesClient struct { Client *resourcemanager.Client } -func NewDeviceupdatesClientWithBaseURI(api environments.Api) (*DeviceupdatesClient, error) { +func NewDeviceupdatesClientWithBaseURI(api sdkEnv.Api) (*DeviceupdatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "deviceupdates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeviceupdatesClient: %+v", err) diff --git a/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/client.go b/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/client.go index 2c9fe576728..4c7a832e214 100644 --- a/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/client.go +++ b/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionProxiesClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionProxiesClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionProxiesClient, error) { +func NewPrivateEndpointConnectionProxiesClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionProxiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnectionproxies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionProxiesClient: %+v", err) diff --git a/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/client.go b/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/client.go +++ b/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/deviceupdate/2022-10-01/privatelinkresources/client.go b/resource-manager/deviceupdate/2022-10-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/deviceupdate/2022-10-01/privatelinkresources/client.go +++ b/resource-manager/deviceupdate/2022-10-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/deviceupdate/2023-07-01/client.go b/resource-manager/deviceupdate/2023-07-01/client.go index 1463c1732db..eabab816193 100644 --- a/resource-manager/deviceupdate/2023-07-01/client.go +++ b/resource-manager/deviceupdate/2023-07-01/client.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/deviceupdate/2023-07-01/privateendpointconnections" "github.com/hashicorp/go-azure-sdk/resource-manager/deviceupdate/2023-07-01/privatelinkresources" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -21,7 +21,7 @@ type Client struct { PrivateLinkResources *privatelinkresources.PrivateLinkResourcesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { deviceupdatesClient, err := deviceupdates.NewDeviceupdatesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Deviceupdates client: %+v", err) diff --git a/resource-manager/deviceupdate/2023-07-01/deviceupdates/client.go b/resource-manager/deviceupdate/2023-07-01/deviceupdates/client.go index 1823789119d..d3191bc5f56 100644 --- a/resource-manager/deviceupdate/2023-07-01/deviceupdates/client.go +++ b/resource-manager/deviceupdate/2023-07-01/deviceupdates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeviceupdatesClient struct { Client *resourcemanager.Client } -func NewDeviceupdatesClientWithBaseURI(api environments.Api) (*DeviceupdatesClient, error) { +func NewDeviceupdatesClientWithBaseURI(api sdkEnv.Api) (*DeviceupdatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "deviceupdates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeviceupdatesClient: %+v", err) diff --git a/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/client.go b/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/client.go index 2c9fe576728..4c7a832e214 100644 --- a/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/client.go +++ b/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionProxiesClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionProxiesClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionProxiesClient, error) { +func NewPrivateEndpointConnectionProxiesClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionProxiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnectionproxies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionProxiesClient: %+v", err) diff --git a/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/client.go b/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/client.go +++ b/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/deviceupdate/2023-07-01/privatelinkresources/client.go b/resource-manager/deviceupdate/2023-07-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/deviceupdate/2023-07-01/privatelinkresources/client.go +++ b/resource-manager/deviceupdate/2023-07-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/digitaltwins/2020-12-01/checknameavailability/client.go b/resource-manager/digitaltwins/2020-12-01/checknameavailability/client.go index 81c73505778..5610e27c123 100644 --- a/resource-manager/digitaltwins/2020-12-01/checknameavailability/client.go +++ b/resource-manager/digitaltwins/2020-12-01/checknameavailability/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityClient, error) { +func NewCheckNameAvailabilityClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailability", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityClient: %+v", err) diff --git a/resource-manager/digitaltwins/2020-12-01/client.go b/resource-manager/digitaltwins/2020-12-01/client.go index 19e89e1e75b..c043bc7d483 100644 --- a/resource-manager/digitaltwins/2020-12-01/client.go +++ b/resource-manager/digitaltwins/2020-12-01/client.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints" "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/privateendpoints" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -21,7 +21,7 @@ type Client struct { PrivateEndpoints *privateendpoints.PrivateEndpointsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { checkNameAvailabilityClient, err := checknameavailability.NewCheckNameAvailabilityClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CheckNameAvailability client: %+v", err) diff --git a/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/client.go b/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/client.go index 2209b372c95..d187e739014 100644 --- a/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/client.go +++ b/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DigitalTwinsInstanceClient struct { Client *resourcemanager.Client } -func NewDigitalTwinsInstanceClientWithBaseURI(api environments.Api) (*DigitalTwinsInstanceClient, error) { +func NewDigitalTwinsInstanceClientWithBaseURI(api sdkEnv.Api) (*DigitalTwinsInstanceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "digitaltwinsinstance", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DigitalTwinsInstanceClient: %+v", err) diff --git a/resource-manager/digitaltwins/2020-12-01/endpoints/client.go b/resource-manager/digitaltwins/2020-12-01/endpoints/client.go index d5d5f478257..7696c3b5ef5 100644 --- a/resource-manager/digitaltwins/2020-12-01/endpoints/client.go +++ b/resource-manager/digitaltwins/2020-12-01/endpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EndpointsClient struct { Client *resourcemanager.Client } -func NewEndpointsClientWithBaseURI(api environments.Api) (*EndpointsClient, error) { +func NewEndpointsClientWithBaseURI(api sdkEnv.Api) (*EndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "endpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EndpointsClient: %+v", err) diff --git a/resource-manager/digitaltwins/2020-12-01/privateendpoints/client.go b/resource-manager/digitaltwins/2020-12-01/privateendpoints/client.go index 8ef83ec0060..8300f305f02 100644 --- a/resource-manager/digitaltwins/2020-12-01/privateendpoints/client.go +++ b/resource-manager/digitaltwins/2020-12-01/privateendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointsClientWithBaseURI(api environments.Api) (*PrivateEndpointsClient, error) { +func NewPrivateEndpointsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointsClient: %+v", err) diff --git a/resource-manager/digitaltwins/2022-10-31/checknameavailability/client.go b/resource-manager/digitaltwins/2022-10-31/checknameavailability/client.go index 81c73505778..5610e27c123 100644 --- a/resource-manager/digitaltwins/2022-10-31/checknameavailability/client.go +++ b/resource-manager/digitaltwins/2022-10-31/checknameavailability/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityClient, error) { +func NewCheckNameAvailabilityClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailability", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityClient: %+v", err) diff --git a/resource-manager/digitaltwins/2022-10-31/client.go b/resource-manager/digitaltwins/2022-10-31/client.go index d5dd7d43cbe..f15a35a8ad2 100644 --- a/resource-manager/digitaltwins/2022-10-31/client.go +++ b/resource-manager/digitaltwins/2022-10-31/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/privateendpoints" "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { TimeSeriesDatabaseConnections *timeseriesdatabaseconnections.TimeSeriesDatabaseConnectionsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { checkNameAvailabilityClient, err := checknameavailability.NewCheckNameAvailabilityClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CheckNameAvailability client: %+v", err) diff --git a/resource-manager/digitaltwins/2022-10-31/digitaltwinsinstance/client.go b/resource-manager/digitaltwins/2022-10-31/digitaltwinsinstance/client.go index 2209b372c95..d187e739014 100644 --- a/resource-manager/digitaltwins/2022-10-31/digitaltwinsinstance/client.go +++ b/resource-manager/digitaltwins/2022-10-31/digitaltwinsinstance/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DigitalTwinsInstanceClient struct { Client *resourcemanager.Client } -func NewDigitalTwinsInstanceClientWithBaseURI(api environments.Api) (*DigitalTwinsInstanceClient, error) { +func NewDigitalTwinsInstanceClientWithBaseURI(api sdkEnv.Api) (*DigitalTwinsInstanceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "digitaltwinsinstance", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DigitalTwinsInstanceClient: %+v", err) diff --git a/resource-manager/digitaltwins/2022-10-31/endpoints/client.go b/resource-manager/digitaltwins/2022-10-31/endpoints/client.go index d5d5f478257..7696c3b5ef5 100644 --- a/resource-manager/digitaltwins/2022-10-31/endpoints/client.go +++ b/resource-manager/digitaltwins/2022-10-31/endpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EndpointsClient struct { Client *resourcemanager.Client } -func NewEndpointsClientWithBaseURI(api environments.Api) (*EndpointsClient, error) { +func NewEndpointsClientWithBaseURI(api sdkEnv.Api) (*EndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "endpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EndpointsClient: %+v", err) diff --git a/resource-manager/digitaltwins/2022-10-31/privateendpoints/client.go b/resource-manager/digitaltwins/2022-10-31/privateendpoints/client.go index 8ef83ec0060..8300f305f02 100644 --- a/resource-manager/digitaltwins/2022-10-31/privateendpoints/client.go +++ b/resource-manager/digitaltwins/2022-10-31/privateendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointsClientWithBaseURI(api environments.Api) (*PrivateEndpointsClient, error) { +func NewPrivateEndpointsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointsClient: %+v", err) diff --git a/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/client.go b/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/client.go index 7158faeb4d8..eb94785f78b 100644 --- a/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/client.go +++ b/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TimeSeriesDatabaseConnectionsClient struct { Client *resourcemanager.Client } -func NewTimeSeriesDatabaseConnectionsClientWithBaseURI(api environments.Api) (*TimeSeriesDatabaseConnectionsClient, error) { +func NewTimeSeriesDatabaseConnectionsClientWithBaseURI(api sdkEnv.Api) (*TimeSeriesDatabaseConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "timeseriesdatabaseconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TimeSeriesDatabaseConnectionsClient: %+v", err) diff --git a/resource-manager/digitaltwins/2023-01-31/checknameavailability/client.go b/resource-manager/digitaltwins/2023-01-31/checknameavailability/client.go index 81c73505778..5610e27c123 100644 --- a/resource-manager/digitaltwins/2023-01-31/checknameavailability/client.go +++ b/resource-manager/digitaltwins/2023-01-31/checknameavailability/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityClient, error) { +func NewCheckNameAvailabilityClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailability", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityClient: %+v", err) diff --git a/resource-manager/digitaltwins/2023-01-31/client.go b/resource-manager/digitaltwins/2023-01-31/client.go index 89b0d72da80..527891767d5 100644 --- a/resource-manager/digitaltwins/2023-01-31/client.go +++ b/resource-manager/digitaltwins/2023-01-31/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2023-01-31/privateendpoints" "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { TimeSeriesDatabaseConnections *timeseriesdatabaseconnections.TimeSeriesDatabaseConnectionsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { checkNameAvailabilityClient, err := checknameavailability.NewCheckNameAvailabilityClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CheckNameAvailability client: %+v", err) diff --git a/resource-manager/digitaltwins/2023-01-31/digitaltwinsinstance/client.go b/resource-manager/digitaltwins/2023-01-31/digitaltwinsinstance/client.go index 2209b372c95..d187e739014 100644 --- a/resource-manager/digitaltwins/2023-01-31/digitaltwinsinstance/client.go +++ b/resource-manager/digitaltwins/2023-01-31/digitaltwinsinstance/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DigitalTwinsInstanceClient struct { Client *resourcemanager.Client } -func NewDigitalTwinsInstanceClientWithBaseURI(api environments.Api) (*DigitalTwinsInstanceClient, error) { +func NewDigitalTwinsInstanceClientWithBaseURI(api sdkEnv.Api) (*DigitalTwinsInstanceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "digitaltwinsinstance", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DigitalTwinsInstanceClient: %+v", err) diff --git a/resource-manager/digitaltwins/2023-01-31/endpoints/client.go b/resource-manager/digitaltwins/2023-01-31/endpoints/client.go index d5d5f478257..7696c3b5ef5 100644 --- a/resource-manager/digitaltwins/2023-01-31/endpoints/client.go +++ b/resource-manager/digitaltwins/2023-01-31/endpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EndpointsClient struct { Client *resourcemanager.Client } -func NewEndpointsClientWithBaseURI(api environments.Api) (*EndpointsClient, error) { +func NewEndpointsClientWithBaseURI(api sdkEnv.Api) (*EndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "endpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EndpointsClient: %+v", err) diff --git a/resource-manager/digitaltwins/2023-01-31/privateendpoints/client.go b/resource-manager/digitaltwins/2023-01-31/privateendpoints/client.go index 8ef83ec0060..8300f305f02 100644 --- a/resource-manager/digitaltwins/2023-01-31/privateendpoints/client.go +++ b/resource-manager/digitaltwins/2023-01-31/privateendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointsClientWithBaseURI(api environments.Api) (*PrivateEndpointsClient, error) { +func NewPrivateEndpointsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointsClient: %+v", err) diff --git a/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/client.go b/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/client.go index 7158faeb4d8..eb94785f78b 100644 --- a/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/client.go +++ b/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TimeSeriesDatabaseConnectionsClient struct { Client *resourcemanager.Client } -func NewTimeSeriesDatabaseConnectionsClientWithBaseURI(api environments.Api) (*TimeSeriesDatabaseConnectionsClient, error) { +func NewTimeSeriesDatabaseConnectionsClientWithBaseURI(api sdkEnv.Api) (*TimeSeriesDatabaseConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "timeseriesdatabaseconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TimeSeriesDatabaseConnectionsClient: %+v", err) diff --git a/resource-manager/dns/2018-05-01/client.go b/resource-manager/dns/2018-05-01/client.go index fe15aa34846..8bd12632542 100644 --- a/resource-manager/dns/2018-05-01/client.go +++ b/resource-manager/dns/2018-05-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { Zones *zones.ZonesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { dnsClient, err := dns.NewDnsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Dns client: %+v", err) diff --git a/resource-manager/dns/2018-05-01/dns/client.go b/resource-manager/dns/2018-05-01/dns/client.go index 36d6586e050..4b89766c373 100644 --- a/resource-manager/dns/2018-05-01/dns/client.go +++ b/resource-manager/dns/2018-05-01/dns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DnsClient struct { Client *resourcemanager.Client } -func NewDnsClientWithBaseURI(api environments.Api) (*DnsClient, error) { +func NewDnsClientWithBaseURI(api sdkEnv.Api) (*DnsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DnsClient: %+v", err) diff --git a/resource-manager/dns/2018-05-01/recordsets/client.go b/resource-manager/dns/2018-05-01/recordsets/client.go index 8b876af8dd1..c8523090534 100644 --- a/resource-manager/dns/2018-05-01/recordsets/client.go +++ b/resource-manager/dns/2018-05-01/recordsets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecordSetsClient struct { Client *resourcemanager.Client } -func NewRecordSetsClientWithBaseURI(api environments.Api) (*RecordSetsClient, error) { +func NewRecordSetsClientWithBaseURI(api sdkEnv.Api) (*RecordSetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recordsets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecordSetsClient: %+v", err) diff --git a/resource-manager/dns/2018-05-01/zones/client.go b/resource-manager/dns/2018-05-01/zones/client.go index 5250b4ec726..1aa5c3100c2 100644 --- a/resource-manager/dns/2018-05-01/zones/client.go +++ b/resource-manager/dns/2018-05-01/zones/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ZonesClient struct { Client *resourcemanager.Client } -func NewZonesClientWithBaseURI(api environments.Api) (*ZonesClient, error) { +func NewZonesClientWithBaseURI(api sdkEnv.Api) (*ZonesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "zones", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ZonesClient: %+v", err) diff --git a/resource-manager/dnsresolver/2022-07-01/client.go b/resource-manager/dnsresolver/2022-07-01/client.go index f776d3815da..19e5eb1f8de 100644 --- a/resource-manager/dnsresolver/2022-07-01/client.go +++ b/resource-manager/dnsresolver/2022-07-01/client.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/outboundendpoints" "github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -25,7 +25,7 @@ type Client struct { VirtualNetworkLinks *virtualnetworklinks.VirtualNetworkLinksClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { dnsForwardingRulesetsClient, err := dnsforwardingrulesets.NewDnsForwardingRulesetsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DnsForwardingRulesets client: %+v", err) diff --git a/resource-manager/dnsresolver/2022-07-01/dnsforwardingrulesets/client.go b/resource-manager/dnsresolver/2022-07-01/dnsforwardingrulesets/client.go index 02beeb165c8..46c7c2ef63b 100644 --- a/resource-manager/dnsresolver/2022-07-01/dnsforwardingrulesets/client.go +++ b/resource-manager/dnsresolver/2022-07-01/dnsforwardingrulesets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DnsForwardingRulesetsClient struct { Client *resourcemanager.Client } -func NewDnsForwardingRulesetsClientWithBaseURI(api environments.Api) (*DnsForwardingRulesetsClient, error) { +func NewDnsForwardingRulesetsClientWithBaseURI(api sdkEnv.Api) (*DnsForwardingRulesetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dnsforwardingrulesets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DnsForwardingRulesetsClient: %+v", err) diff --git a/resource-manager/dnsresolver/2022-07-01/dnsresolvers/client.go b/resource-manager/dnsresolver/2022-07-01/dnsresolvers/client.go index c3247959c10..c195b6a0cb4 100644 --- a/resource-manager/dnsresolver/2022-07-01/dnsresolvers/client.go +++ b/resource-manager/dnsresolver/2022-07-01/dnsresolvers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DnsResolversClient struct { Client *resourcemanager.Client } -func NewDnsResolversClientWithBaseURI(api environments.Api) (*DnsResolversClient, error) { +func NewDnsResolversClientWithBaseURI(api sdkEnv.Api) (*DnsResolversClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dnsresolvers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DnsResolversClient: %+v", err) diff --git a/resource-manager/dnsresolver/2022-07-01/forwardingrules/client.go b/resource-manager/dnsresolver/2022-07-01/forwardingrules/client.go index 6bfdca57030..70fbd4f3f99 100644 --- a/resource-manager/dnsresolver/2022-07-01/forwardingrules/client.go +++ b/resource-manager/dnsresolver/2022-07-01/forwardingrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ForwardingRulesClient struct { Client *resourcemanager.Client } -func NewForwardingRulesClientWithBaseURI(api environments.Api) (*ForwardingRulesClient, error) { +func NewForwardingRulesClientWithBaseURI(api sdkEnv.Api) (*ForwardingRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "forwardingrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ForwardingRulesClient: %+v", err) diff --git a/resource-manager/dnsresolver/2022-07-01/inboundendpoints/client.go b/resource-manager/dnsresolver/2022-07-01/inboundendpoints/client.go index 2f5438558c6..b70fb5af9df 100644 --- a/resource-manager/dnsresolver/2022-07-01/inboundendpoints/client.go +++ b/resource-manager/dnsresolver/2022-07-01/inboundendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type InboundEndpointsClient struct { Client *resourcemanager.Client } -func NewInboundEndpointsClientWithBaseURI(api environments.Api) (*InboundEndpointsClient, error) { +func NewInboundEndpointsClientWithBaseURI(api sdkEnv.Api) (*InboundEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "inboundendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating InboundEndpointsClient: %+v", err) diff --git a/resource-manager/dnsresolver/2022-07-01/outboundendpoints/client.go b/resource-manager/dnsresolver/2022-07-01/outboundendpoints/client.go index fe2623d4a8f..19726e701d3 100644 --- a/resource-manager/dnsresolver/2022-07-01/outboundendpoints/client.go +++ b/resource-manager/dnsresolver/2022-07-01/outboundendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OutboundEndpointsClient struct { Client *resourcemanager.Client } -func NewOutboundEndpointsClientWithBaseURI(api environments.Api) (*OutboundEndpointsClient, error) { +func NewOutboundEndpointsClientWithBaseURI(api sdkEnv.Api) (*OutboundEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "outboundendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OutboundEndpointsClient: %+v", err) diff --git a/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/client.go b/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/client.go index c8954f679ae..4d56e5e3d42 100644 --- a/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/client.go +++ b/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkLinksClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkLinksClientWithBaseURI(api environments.Api) (*VirtualNetworkLinksClient, error) { +func NewVirtualNetworkLinksClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkLinksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworklinks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkLinksClient: %+v", err) diff --git a/resource-manager/dynatrace/2021-09-01/client.go b/resource-manager/dynatrace/2021-09-01/client.go index e35aea5b772..e9ef1152717 100644 --- a/resource-manager/dynatrace/2021-09-01/client.go +++ b/resource-manager/dynatrace/2021-09-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/dynatrace/2021-09-01/singlesignon" "github.com/hashicorp/go-azure-sdk/resource-manager/dynatrace/2021-09-01/tagrules" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { TagRules *tagrules.TagRulesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { monitorsClient, err := monitors.NewMonitorsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Monitors client: %+v", err) diff --git a/resource-manager/dynatrace/2021-09-01/monitors/client.go b/resource-manager/dynatrace/2021-09-01/monitors/client.go index 43af4ffbb85..f7c2a7b5509 100644 --- a/resource-manager/dynatrace/2021-09-01/monitors/client.go +++ b/resource-manager/dynatrace/2021-09-01/monitors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitorsClient struct { Client *resourcemanager.Client } -func NewMonitorsClientWithBaseURI(api environments.Api) (*MonitorsClient, error) { +func NewMonitorsClientWithBaseURI(api sdkEnv.Api) (*MonitorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitorsClient: %+v", err) diff --git a/resource-manager/dynatrace/2021-09-01/singlesignon/client.go b/resource-manager/dynatrace/2021-09-01/singlesignon/client.go index b37a7e2692a..ecca8e4d537 100644 --- a/resource-manager/dynatrace/2021-09-01/singlesignon/client.go +++ b/resource-manager/dynatrace/2021-09-01/singlesignon/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SingleSignOnClient struct { Client *resourcemanager.Client } -func NewSingleSignOnClientWithBaseURI(api environments.Api) (*SingleSignOnClient, error) { +func NewSingleSignOnClientWithBaseURI(api sdkEnv.Api) (*SingleSignOnClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "singlesignon", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SingleSignOnClient: %+v", err) diff --git a/resource-manager/dynatrace/2021-09-01/tagrules/client.go b/resource-manager/dynatrace/2021-09-01/tagrules/client.go index 6269a50dd72..ea7b43d3df4 100644 --- a/resource-manager/dynatrace/2021-09-01/tagrules/client.go +++ b/resource-manager/dynatrace/2021-09-01/tagrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TagRulesClient struct { Client *resourcemanager.Client } -func NewTagRulesClientWithBaseURI(api environments.Api) (*TagRulesClient, error) { +func NewTagRulesClientWithBaseURI(api sdkEnv.Api) (*TagRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tagrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TagRulesClient: %+v", err) diff --git a/resource-manager/dynatrace/2023-04-27/client.go b/resource-manager/dynatrace/2023-04-27/client.go index ed68ef40bd1..3fa4af90b04 100644 --- a/resource-manager/dynatrace/2023-04-27/client.go +++ b/resource-manager/dynatrace/2023-04-27/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/dynatrace/2023-04-27/singlesignon" "github.com/hashicorp/go-azure-sdk/resource-manager/dynatrace/2023-04-27/tagrules" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { TagRules *tagrules.TagRulesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { monitorsClient, err := monitors.NewMonitorsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Monitors client: %+v", err) diff --git a/resource-manager/dynatrace/2023-04-27/monitors/client.go b/resource-manager/dynatrace/2023-04-27/monitors/client.go index 43af4ffbb85..f7c2a7b5509 100644 --- a/resource-manager/dynatrace/2023-04-27/monitors/client.go +++ b/resource-manager/dynatrace/2023-04-27/monitors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitorsClient struct { Client *resourcemanager.Client } -func NewMonitorsClientWithBaseURI(api environments.Api) (*MonitorsClient, error) { +func NewMonitorsClientWithBaseURI(api sdkEnv.Api) (*MonitorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitorsClient: %+v", err) diff --git a/resource-manager/dynatrace/2023-04-27/singlesignon/client.go b/resource-manager/dynatrace/2023-04-27/singlesignon/client.go index b37a7e2692a..ecca8e4d537 100644 --- a/resource-manager/dynatrace/2023-04-27/singlesignon/client.go +++ b/resource-manager/dynatrace/2023-04-27/singlesignon/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SingleSignOnClient struct { Client *resourcemanager.Client } -func NewSingleSignOnClientWithBaseURI(api environments.Api) (*SingleSignOnClient, error) { +func NewSingleSignOnClientWithBaseURI(api sdkEnv.Api) (*SingleSignOnClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "singlesignon", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SingleSignOnClient: %+v", err) diff --git a/resource-manager/dynatrace/2023-04-27/tagrules/client.go b/resource-manager/dynatrace/2023-04-27/tagrules/client.go index 6269a50dd72..ea7b43d3df4 100644 --- a/resource-manager/dynatrace/2023-04-27/tagrules/client.go +++ b/resource-manager/dynatrace/2023-04-27/tagrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TagRulesClient struct { Client *resourcemanager.Client } -func NewTagRulesClientWithBaseURI(api environments.Api) (*TagRulesClient, error) { +func NewTagRulesClientWithBaseURI(api sdkEnv.Api) (*TagRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tagrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TagRulesClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/apikey/client.go b/resource-manager/elastic/2023-06-01/apikey/client.go index 023f2b7b74a..7e00b15aae5 100644 --- a/resource-manager/elastic/2023-06-01/apikey/client.go +++ b/resource-manager/elastic/2023-06-01/apikey/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApiKeyClient struct { Client *resourcemanager.Client } -func NewApiKeyClientWithBaseURI(api environments.Api) (*ApiKeyClient, error) { +func NewApiKeyClientWithBaseURI(api sdkEnv.Api) (*ApiKeyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "apikey", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApiKeyClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/client.go b/resource-manager/elastic/2023-06-01/client.go index 3f137e34274..302ddc9cd5e 100644 --- a/resource-manager/elastic/2023-06-01/client.go +++ b/resource-manager/elastic/2023-06-01/client.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2023-06-01/vmhhostlist" "github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2023-06-01/vmingestiondetails" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -37,7 +37,7 @@ type Client struct { VMIngestionDetails *vmingestiondetails.VMIngestionDetailsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { apiKeyClient, err := apikey.NewApiKeyClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ApiKey client: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/deploymentinfo/client.go b/resource-manager/elastic/2023-06-01/deploymentinfo/client.go index 5aa187bf7b1..7e7c85adc8a 100644 --- a/resource-manager/elastic/2023-06-01/deploymentinfo/client.go +++ b/resource-manager/elastic/2023-06-01/deploymentinfo/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeploymentInfoClient struct { Client *resourcemanager.Client } -func NewDeploymentInfoClientWithBaseURI(api environments.Api) (*DeploymentInfoClient, error) { +func NewDeploymentInfoClientWithBaseURI(api sdkEnv.Api) (*DeploymentInfoClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "deploymentinfo", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeploymentInfoClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/deploymentupdate/client.go b/resource-manager/elastic/2023-06-01/deploymentupdate/client.go index b652a7fb682..7b61c62118d 100644 --- a/resource-manager/elastic/2023-06-01/deploymentupdate/client.go +++ b/resource-manager/elastic/2023-06-01/deploymentupdate/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeploymentUpdateClient struct { Client *resourcemanager.Client } -func NewDeploymentUpdateClientWithBaseURI(api environments.Api) (*DeploymentUpdateClient, error) { +func NewDeploymentUpdateClientWithBaseURI(api sdkEnv.Api) (*DeploymentUpdateClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "deploymentupdate", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeploymentUpdateClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/elasticversions/client.go b/resource-manager/elastic/2023-06-01/elasticversions/client.go index aef1b45cdb0..c1b8e910cba 100644 --- a/resource-manager/elastic/2023-06-01/elasticversions/client.go +++ b/resource-manager/elastic/2023-06-01/elasticversions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ElasticVersionsClient struct { Client *resourcemanager.Client } -func NewElasticVersionsClientWithBaseURI(api environments.Api) (*ElasticVersionsClient, error) { +func NewElasticVersionsClientWithBaseURI(api sdkEnv.Api) (*ElasticVersionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "elasticversions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ElasticVersionsClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/monitoredresources/client.go b/resource-manager/elastic/2023-06-01/monitoredresources/client.go index 708d327579c..925ce7d53f7 100644 --- a/resource-manager/elastic/2023-06-01/monitoredresources/client.go +++ b/resource-manager/elastic/2023-06-01/monitoredresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitoredResourcesClient struct { Client *resourcemanager.Client } -func NewMonitoredResourcesClientWithBaseURI(api environments.Api) (*MonitoredResourcesClient, error) { +func NewMonitoredResourcesClientWithBaseURI(api sdkEnv.Api) (*MonitoredResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitoredresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitoredResourcesClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/monitorsresource/client.go b/resource-manager/elastic/2023-06-01/monitorsresource/client.go index 9dbf73eadda..08b44fb5569 100644 --- a/resource-manager/elastic/2023-06-01/monitorsresource/client.go +++ b/resource-manager/elastic/2023-06-01/monitorsresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitorsResourceClient struct { Client *resourcemanager.Client } -func NewMonitorsResourceClientWithBaseURI(api environments.Api) (*MonitorsResourceClient, error) { +func NewMonitorsResourceClientWithBaseURI(api sdkEnv.Api) (*MonitorsResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitorsresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitorsResourceClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/monitorupgradableversions/client.go b/resource-manager/elastic/2023-06-01/monitorupgradableversions/client.go index 5765f7c20f6..bcb2cab685d 100644 --- a/resource-manager/elastic/2023-06-01/monitorupgradableversions/client.go +++ b/resource-manager/elastic/2023-06-01/monitorupgradableversions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitorUpgradableVersionsClient struct { Client *resourcemanager.Client } -func NewMonitorUpgradableVersionsClientWithBaseURI(api environments.Api) (*MonitorUpgradableVersionsClient, error) { +func NewMonitorUpgradableVersionsClientWithBaseURI(api sdkEnv.Api) (*MonitorUpgradableVersionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitorupgradableversions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitorUpgradableVersionsClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/rules/client.go b/resource-manager/elastic/2023-06-01/rules/client.go index 1897d15f86a..1fce7789d65 100644 --- a/resource-manager/elastic/2023-06-01/rules/client.go +++ b/resource-manager/elastic/2023-06-01/rules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RulesClient struct { Client *resourcemanager.Client } -func NewRulesClientWithBaseURI(api environments.Api) (*RulesClient, error) { +func NewRulesClientWithBaseURI(api sdkEnv.Api) (*RulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "rules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RulesClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/trafficfilter/client.go b/resource-manager/elastic/2023-06-01/trafficfilter/client.go index ef26b535b1e..661048fae64 100644 --- a/resource-manager/elastic/2023-06-01/trafficfilter/client.go +++ b/resource-manager/elastic/2023-06-01/trafficfilter/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TrafficFilterClient struct { Client *resourcemanager.Client } -func NewTrafficFilterClientWithBaseURI(api environments.Api) (*TrafficFilterClient, error) { +func NewTrafficFilterClientWithBaseURI(api sdkEnv.Api) (*TrafficFilterClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "trafficfilter", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TrafficFilterClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/vmcollectionupdate/client.go b/resource-manager/elastic/2023-06-01/vmcollectionupdate/client.go index f9ced476de9..e86529ea5f2 100644 --- a/resource-manager/elastic/2023-06-01/vmcollectionupdate/client.go +++ b/resource-manager/elastic/2023-06-01/vmcollectionupdate/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VMCollectionUpdateClient struct { Client *resourcemanager.Client } -func NewVMCollectionUpdateClientWithBaseURI(api environments.Api) (*VMCollectionUpdateClient, error) { +func NewVMCollectionUpdateClientWithBaseURI(api sdkEnv.Api) (*VMCollectionUpdateClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vmcollectionupdate", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VMCollectionUpdateClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/vmhhostlist/client.go b/resource-manager/elastic/2023-06-01/vmhhostlist/client.go index 89924ceef58..b1b0b266cee 100644 --- a/resource-manager/elastic/2023-06-01/vmhhostlist/client.go +++ b/resource-manager/elastic/2023-06-01/vmhhostlist/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VMHHostListClient struct { Client *resourcemanager.Client } -func NewVMHHostListClientWithBaseURI(api environments.Api) (*VMHHostListClient, error) { +func NewVMHHostListClientWithBaseURI(api sdkEnv.Api) (*VMHHostListClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vmhhostlist", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VMHHostListClient: %+v", err) diff --git a/resource-manager/elastic/2023-06-01/vmingestiondetails/client.go b/resource-manager/elastic/2023-06-01/vmingestiondetails/client.go index 54d48415614..f000efb1964 100644 --- a/resource-manager/elastic/2023-06-01/vmingestiondetails/client.go +++ b/resource-manager/elastic/2023-06-01/vmingestiondetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VMIngestionDetailsClient struct { Client *resourcemanager.Client } -func NewVMIngestionDetailsClientWithBaseURI(api environments.Api) (*VMIngestionDetailsClient, error) { +func NewVMIngestionDetailsClientWithBaseURI(api sdkEnv.Api) (*VMIngestionDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vmingestiondetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VMIngestionDetailsClient: %+v", err) diff --git a/resource-manager/elasticsan/2021-11-20-preview/client.go b/resource-manager/elasticsan/2021-11-20-preview/client.go index 8e5ef2bdff1..b2fa88198e7 100644 --- a/resource-manager/elasticsan/2021-11-20-preview/client.go +++ b/resource-manager/elasticsan/2021-11-20-preview/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/elasticsan/2021-11-20-preview/volumegroups" "github.com/hashicorp/go-azure-sdk/resource-manager/elasticsan/2021-11-20-preview/volumes" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { Volumes *volumes.VolumesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { elasticSanClient, err := elasticsan.NewElasticSanClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ElasticSan client: %+v", err) diff --git a/resource-manager/elasticsan/2021-11-20-preview/elasticsan/client.go b/resource-manager/elasticsan/2021-11-20-preview/elasticsan/client.go index e7bff9c4b75..26ec5c17234 100644 --- a/resource-manager/elasticsan/2021-11-20-preview/elasticsan/client.go +++ b/resource-manager/elasticsan/2021-11-20-preview/elasticsan/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ElasticSanClient struct { Client *resourcemanager.Client } -func NewElasticSanClientWithBaseURI(api environments.Api) (*ElasticSanClient, error) { +func NewElasticSanClientWithBaseURI(api sdkEnv.Api) (*ElasticSanClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "elasticsan", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ElasticSanClient: %+v", err) diff --git a/resource-manager/elasticsan/2021-11-20-preview/elasticsans/client.go b/resource-manager/elasticsan/2021-11-20-preview/elasticsans/client.go index dfc931c1b77..f9cf68ee0ad 100644 --- a/resource-manager/elasticsan/2021-11-20-preview/elasticsans/client.go +++ b/resource-manager/elasticsan/2021-11-20-preview/elasticsans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ElasticSansClient struct { Client *resourcemanager.Client } -func NewElasticSansClientWithBaseURI(api environments.Api) (*ElasticSansClient, error) { +func NewElasticSansClientWithBaseURI(api sdkEnv.Api) (*ElasticSansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "elasticsans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ElasticSansClient: %+v", err) diff --git a/resource-manager/elasticsan/2021-11-20-preview/elasticsanskus/client.go b/resource-manager/elasticsan/2021-11-20-preview/elasticsanskus/client.go index 599c3c9e2ce..821d2d642a4 100644 --- a/resource-manager/elasticsan/2021-11-20-preview/elasticsanskus/client.go +++ b/resource-manager/elasticsan/2021-11-20-preview/elasticsanskus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ElasticSanSkusClient struct { Client *resourcemanager.Client } -func NewElasticSanSkusClientWithBaseURI(api environments.Api) (*ElasticSanSkusClient, error) { +func NewElasticSanSkusClientWithBaseURI(api sdkEnv.Api) (*ElasticSanSkusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "elasticsanskus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ElasticSanSkusClient: %+v", err) diff --git a/resource-manager/elasticsan/2021-11-20-preview/volumegroups/client.go b/resource-manager/elasticsan/2021-11-20-preview/volumegroups/client.go index c9b0b6c7aa5..21bfda0f382 100644 --- a/resource-manager/elasticsan/2021-11-20-preview/volumegroups/client.go +++ b/resource-manager/elasticsan/2021-11-20-preview/volumegroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumeGroupsClient struct { Client *resourcemanager.Client } -func NewVolumeGroupsClientWithBaseURI(api environments.Api) (*VolumeGroupsClient, error) { +func NewVolumeGroupsClientWithBaseURI(api sdkEnv.Api) (*VolumeGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumegroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumeGroupsClient: %+v", err) diff --git a/resource-manager/elasticsan/2021-11-20-preview/volumes/client.go b/resource-manager/elasticsan/2021-11-20-preview/volumes/client.go index b55d7772812..37cd09571b5 100644 --- a/resource-manager/elasticsan/2021-11-20-preview/volumes/client.go +++ b/resource-manager/elasticsan/2021-11-20-preview/volumes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesClient struct { Client *resourcemanager.Client } -func NewVolumesClientWithBaseURI(api environments.Api) (*VolumesClient, error) { +func NewVolumesClientWithBaseURI(api sdkEnv.Api) (*VolumesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/channels/client.go b/resource-manager/eventgrid/2022-06-15/channels/client.go index f70dca50e6b..c9698b50c3d 100644 --- a/resource-manager/eventgrid/2022-06-15/channels/client.go +++ b/resource-manager/eventgrid/2022-06-15/channels/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ChannelsClient struct { Client *resourcemanager.Client } -func NewChannelsClientWithBaseURI(api environments.Api) (*ChannelsClient, error) { +func NewChannelsClientWithBaseURI(api sdkEnv.Api) (*ChannelsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "channels", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ChannelsClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/client.go b/resource-manager/eventgrid/2022-06-15/client.go index 70b0e271829..16a635d3c8e 100644 --- a/resource-manager/eventgrid/2022-06-15/client.go +++ b/resource-manager/eventgrid/2022-06-15/client.go @@ -21,7 +21,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/eventgrid/2022-06-15/topictypes" "github.com/hashicorp/go-azure-sdk/resource-manager/eventgrid/2022-06-15/verifiedpartners" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -41,7 +41,7 @@ type Client struct { VerifiedPartners *verifiedpartners.VerifiedPartnersClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { channelsClient, err := channels.NewChannelsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Channels client: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/domains/client.go b/resource-manager/eventgrid/2022-06-15/domains/client.go index 4816b188ae1..35bdff62532 100644 --- a/resource-manager/eventgrid/2022-06-15/domains/client.go +++ b/resource-manager/eventgrid/2022-06-15/domains/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DomainsClient struct { Client *resourcemanager.Client } -func NewDomainsClientWithBaseURI(api environments.Api) (*DomainsClient, error) { +func NewDomainsClientWithBaseURI(api sdkEnv.Api) (*DomainsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "domains", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DomainsClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/domaintopics/client.go b/resource-manager/eventgrid/2022-06-15/domaintopics/client.go index aca593aa868..4ed4a81f897 100644 --- a/resource-manager/eventgrid/2022-06-15/domaintopics/client.go +++ b/resource-manager/eventgrid/2022-06-15/domaintopics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DomainTopicsClient struct { Client *resourcemanager.Client } -func NewDomainTopicsClientWithBaseURI(api environments.Api) (*DomainTopicsClient, error) { +func NewDomainTopicsClientWithBaseURI(api sdkEnv.Api) (*DomainTopicsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "domaintopics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DomainTopicsClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/client.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/client.go index e237968d155..2312252e2d8 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/client.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventSubscriptionsClient struct { Client *resourcemanager.Client } -func NewEventSubscriptionsClientWithBaseURI(api environments.Api) (*EventSubscriptionsClient, error) { +func NewEventSubscriptionsClientWithBaseURI(api sdkEnv.Api) (*EventSubscriptionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eventsubscriptions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventSubscriptionsClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/partnerconfigurations/client.go b/resource-manager/eventgrid/2022-06-15/partnerconfigurations/client.go index e1ddd147878..93c834a0f03 100644 --- a/resource-manager/eventgrid/2022-06-15/partnerconfigurations/client.go +++ b/resource-manager/eventgrid/2022-06-15/partnerconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PartnerConfigurationsClient struct { Client *resourcemanager.Client } -func NewPartnerConfigurationsClientWithBaseURI(api environments.Api) (*PartnerConfigurationsClient, error) { +func NewPartnerConfigurationsClientWithBaseURI(api sdkEnv.Api) (*PartnerConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "partnerconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PartnerConfigurationsClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/partnernamespaces/client.go b/resource-manager/eventgrid/2022-06-15/partnernamespaces/client.go index 0ebe0c1e57c..8ea6d9f752b 100644 --- a/resource-manager/eventgrid/2022-06-15/partnernamespaces/client.go +++ b/resource-manager/eventgrid/2022-06-15/partnernamespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PartnerNamespacesClient struct { Client *resourcemanager.Client } -func NewPartnerNamespacesClientWithBaseURI(api environments.Api) (*PartnerNamespacesClient, error) { +func NewPartnerNamespacesClientWithBaseURI(api sdkEnv.Api) (*PartnerNamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "partnernamespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PartnerNamespacesClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/partnerregistrations/client.go b/resource-manager/eventgrid/2022-06-15/partnerregistrations/client.go index 72d4e3ced08..c990a80e290 100644 --- a/resource-manager/eventgrid/2022-06-15/partnerregistrations/client.go +++ b/resource-manager/eventgrid/2022-06-15/partnerregistrations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PartnerRegistrationsClient struct { Client *resourcemanager.Client } -func NewPartnerRegistrationsClientWithBaseURI(api environments.Api) (*PartnerRegistrationsClient, error) { +func NewPartnerRegistrationsClientWithBaseURI(api sdkEnv.Api) (*PartnerRegistrationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "partnerregistrations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PartnerRegistrationsClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/partnertopics/client.go b/resource-manager/eventgrid/2022-06-15/partnertopics/client.go index 6c01a716307..5c40656a180 100644 --- a/resource-manager/eventgrid/2022-06-15/partnertopics/client.go +++ b/resource-manager/eventgrid/2022-06-15/partnertopics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PartnerTopicsClient struct { Client *resourcemanager.Client } -func NewPartnerTopicsClientWithBaseURI(api environments.Api) (*PartnerTopicsClient, error) { +func NewPartnerTopicsClientWithBaseURI(api sdkEnv.Api) (*PartnerTopicsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "partnertopics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PartnerTopicsClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/privateendpointconnections/client.go b/resource-manager/eventgrid/2022-06-15/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/eventgrid/2022-06-15/privateendpointconnections/client.go +++ b/resource-manager/eventgrid/2022-06-15/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/privatelinkresources/client.go b/resource-manager/eventgrid/2022-06-15/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/eventgrid/2022-06-15/privatelinkresources/client.go +++ b/resource-manager/eventgrid/2022-06-15/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/systemtopics/client.go b/resource-manager/eventgrid/2022-06-15/systemtopics/client.go index f7f50f6e6d8..0f93fcc1652 100644 --- a/resource-manager/eventgrid/2022-06-15/systemtopics/client.go +++ b/resource-manager/eventgrid/2022-06-15/systemtopics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SystemTopicsClient struct { Client *resourcemanager.Client } -func NewSystemTopicsClientWithBaseURI(api environments.Api) (*SystemTopicsClient, error) { +func NewSystemTopicsClientWithBaseURI(api sdkEnv.Api) (*SystemTopicsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "systemtopics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SystemTopicsClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/topics/client.go b/resource-manager/eventgrid/2022-06-15/topics/client.go index ab4d8b6b5f9..8bc788102fd 100644 --- a/resource-manager/eventgrid/2022-06-15/topics/client.go +++ b/resource-manager/eventgrid/2022-06-15/topics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TopicsClient struct { Client *resourcemanager.Client } -func NewTopicsClientWithBaseURI(api environments.Api) (*TopicsClient, error) { +func NewTopicsClientWithBaseURI(api sdkEnv.Api) (*TopicsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "topics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TopicsClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/topictypes/client.go b/resource-manager/eventgrid/2022-06-15/topictypes/client.go index a258a77357b..2a7fba35448 100644 --- a/resource-manager/eventgrid/2022-06-15/topictypes/client.go +++ b/resource-manager/eventgrid/2022-06-15/topictypes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TopicTypesClient struct { Client *resourcemanager.Client } -func NewTopicTypesClientWithBaseURI(api environments.Api) (*TopicTypesClient, error) { +func NewTopicTypesClientWithBaseURI(api sdkEnv.Api) (*TopicTypesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "topictypes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TopicTypesClient: %+v", err) diff --git a/resource-manager/eventgrid/2022-06-15/verifiedpartners/client.go b/resource-manager/eventgrid/2022-06-15/verifiedpartners/client.go index d8f73c01979..5a3427705ab 100644 --- a/resource-manager/eventgrid/2022-06-15/verifiedpartners/client.go +++ b/resource-manager/eventgrid/2022-06-15/verifiedpartners/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VerifiedPartnersClient struct { Client *resourcemanager.Client } -func NewVerifiedPartnersClientWithBaseURI(api environments.Api) (*VerifiedPartnersClient, error) { +func NewVerifiedPartnersClientWithBaseURI(api sdkEnv.Api) (*VerifiedPartnersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "verifiedpartners", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VerifiedPartnersClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/client.go b/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/client.go index b4e4f1e51a8..9569ddf325e 100644 --- a/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/client.go +++ b/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AuthorizationRulesDisasterRecoveryConfigsClient struct { Client *resourcemanager.Client } -func NewAuthorizationRulesDisasterRecoveryConfigsClientWithBaseURI(api environments.Api) (*AuthorizationRulesDisasterRecoveryConfigsClient, error) { +func NewAuthorizationRulesDisasterRecoveryConfigsClientWithBaseURI(api sdkEnv.Api) (*AuthorizationRulesDisasterRecoveryConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "authorizationrulesdisasterrecoveryconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AuthorizationRulesDisasterRecoveryConfigsClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/client.go b/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/client.go index 86589fc7fd3..5e6ddf54227 100644 --- a/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/client.go +++ b/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AuthorizationRulesEventHubsClient struct { Client *resourcemanager.Client } -func NewAuthorizationRulesEventHubsClientWithBaseURI(api environments.Api) (*AuthorizationRulesEventHubsClient, error) { +func NewAuthorizationRulesEventHubsClientWithBaseURI(api sdkEnv.Api) (*AuthorizationRulesEventHubsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "authorizationruleseventhubs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AuthorizationRulesEventHubsClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/client.go b/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/client.go index 37ff67c140c..9a3c224b13c 100644 --- a/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/client.go +++ b/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AuthorizationRulesNamespacesClient struct { Client *resourcemanager.Client } -func NewAuthorizationRulesNamespacesClientWithBaseURI(api environments.Api) (*AuthorizationRulesNamespacesClient, error) { +func NewAuthorizationRulesNamespacesClientWithBaseURI(api sdkEnv.Api) (*AuthorizationRulesNamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "authorizationrulesnamespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AuthorizationRulesNamespacesClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/client.go b/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/client.go index c9a1159adcd..9e9bf643f57 100644 --- a/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/client.go +++ b/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityDisasterRecoveryConfigsClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityDisasterRecoveryConfigsClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityDisasterRecoveryConfigsClient, error) { +func NewCheckNameAvailabilityDisasterRecoveryConfigsClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityDisasterRecoveryConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailabilitydisasterrecoveryconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityDisasterRecoveryConfigsClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/checknameavailabilitynamespaces/client.go b/resource-manager/eventhub/2021-11-01/checknameavailabilitynamespaces/client.go index dab7e158c17..7baf052fa52 100644 --- a/resource-manager/eventhub/2021-11-01/checknameavailabilitynamespaces/client.go +++ b/resource-manager/eventhub/2021-11-01/checknameavailabilitynamespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityNamespacesClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityNamespacesClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityNamespacesClient, error) { +func NewCheckNameAvailabilityNamespacesClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityNamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailabilitynamespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityNamespacesClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/client.go b/resource-manager/eventhub/2021-11-01/client.go index aaf849811a6..94bb9f5b2a2 100644 --- a/resource-manager/eventhub/2021-11-01/client.go +++ b/resource-manager/eventhub/2021-11-01/client.go @@ -24,7 +24,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets" "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -47,7 +47,7 @@ type Client struct { SchemaRegistry *schemaregistry.SchemaRegistryClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { authorizationRulesDisasterRecoveryConfigsClient, err := authorizationrulesdisasterrecoveryconfigs.NewAuthorizationRulesDisasterRecoveryConfigsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AuthorizationRulesDisasterRecoveryConfigs client: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/consumergroups/client.go b/resource-manager/eventhub/2021-11-01/consumergroups/client.go index 36974a5eb62..43e1b557e18 100644 --- a/resource-manager/eventhub/2021-11-01/consumergroups/client.go +++ b/resource-manager/eventhub/2021-11-01/consumergroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConsumerGroupsClient struct { Client *resourcemanager.Client } -func NewConsumerGroupsClientWithBaseURI(api environments.Api) (*ConsumerGroupsClient, error) { +func NewConsumerGroupsClientWithBaseURI(api sdkEnv.Api) (*ConsumerGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "consumergroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConsumerGroupsClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/client.go b/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/client.go index 3faf5be9484..b6f5e0db9ba 100644 --- a/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/client.go +++ b/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DisasterRecoveryConfigsClient struct { Client *resourcemanager.Client } -func NewDisasterRecoveryConfigsClientWithBaseURI(api environments.Api) (*DisasterRecoveryConfigsClient, error) { +func NewDisasterRecoveryConfigsClientWithBaseURI(api sdkEnv.Api) (*DisasterRecoveryConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "disasterrecoveryconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DisasterRecoveryConfigsClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/eventhubs/client.go b/resource-manager/eventhub/2021-11-01/eventhubs/client.go index 81e902a74cb..dd5f638a5d8 100644 --- a/resource-manager/eventhub/2021-11-01/eventhubs/client.go +++ b/resource-manager/eventhub/2021-11-01/eventhubs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventHubsClient struct { Client *resourcemanager.Client } -func NewEventHubsClientWithBaseURI(api environments.Api) (*EventHubsClient, error) { +func NewEventHubsClientWithBaseURI(api sdkEnv.Api) (*EventHubsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eventhubs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventHubsClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/eventhubsclusters/client.go b/resource-manager/eventhub/2021-11-01/eventhubsclusters/client.go index f035dd75fd3..a87af487d17 100644 --- a/resource-manager/eventhub/2021-11-01/eventhubsclusters/client.go +++ b/resource-manager/eventhub/2021-11-01/eventhubsclusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventHubsClustersClient struct { Client *resourcemanager.Client } -func NewEventHubsClustersClientWithBaseURI(api environments.Api) (*EventHubsClustersClient, error) { +func NewEventHubsClustersClientWithBaseURI(api sdkEnv.Api) (*EventHubsClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eventhubsclusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventHubsClustersClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/eventhubsclustersavailableclusterregions/client.go b/resource-manager/eventhub/2021-11-01/eventhubsclustersavailableclusterregions/client.go index 29627c2842f..6acb224cf2f 100644 --- a/resource-manager/eventhub/2021-11-01/eventhubsclustersavailableclusterregions/client.go +++ b/resource-manager/eventhub/2021-11-01/eventhubsclustersavailableclusterregions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventHubsClustersAvailableClusterRegionsClient struct { Client *resourcemanager.Client } -func NewEventHubsClustersAvailableClusterRegionsClientWithBaseURI(api environments.Api) (*EventHubsClustersAvailableClusterRegionsClient, error) { +func NewEventHubsClustersAvailableClusterRegionsClientWithBaseURI(api sdkEnv.Api) (*EventHubsClustersAvailableClusterRegionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eventhubsclustersavailableclusterregions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventHubsClustersAvailableClusterRegionsClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/eventhubsclustersconfiguration/client.go b/resource-manager/eventhub/2021-11-01/eventhubsclustersconfiguration/client.go index fc005057793..e06e4215086 100644 --- a/resource-manager/eventhub/2021-11-01/eventhubsclustersconfiguration/client.go +++ b/resource-manager/eventhub/2021-11-01/eventhubsclustersconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventHubsClustersConfigurationClient struct { Client *resourcemanager.Client } -func NewEventHubsClustersConfigurationClientWithBaseURI(api environments.Api) (*EventHubsClustersConfigurationClient, error) { +func NewEventHubsClustersConfigurationClientWithBaseURI(api sdkEnv.Api) (*EventHubsClustersConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eventhubsclustersconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventHubsClustersConfigurationClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/eventhubsclustersnamespace/client.go b/resource-manager/eventhub/2021-11-01/eventhubsclustersnamespace/client.go index 0292a129e8a..f2dfa1c5674 100644 --- a/resource-manager/eventhub/2021-11-01/eventhubsclustersnamespace/client.go +++ b/resource-manager/eventhub/2021-11-01/eventhubsclustersnamespace/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventHubsClustersNamespaceClient struct { Client *resourcemanager.Client } -func NewEventHubsClustersNamespaceClientWithBaseURI(api environments.Api) (*EventHubsClustersNamespaceClient, error) { +func NewEventHubsClustersNamespaceClientWithBaseURI(api sdkEnv.Api) (*EventHubsClustersNamespaceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eventhubsclustersnamespace", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventHubsClustersNamespaceClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/namespaces/client.go b/resource-manager/eventhub/2021-11-01/namespaces/client.go index 6b0ae358115..a991037b3a6 100644 --- a/resource-manager/eventhub/2021-11-01/namespaces/client.go +++ b/resource-manager/eventhub/2021-11-01/namespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesClient struct { Client *resourcemanager.Client } -func NewNamespacesClientWithBaseURI(api environments.Api) (*NamespacesClient, error) { +func NewNamespacesClientWithBaseURI(api sdkEnv.Api) (*NamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/client.go b/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/client.go index b6799829ed0..e29cce4a732 100644 --- a/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/client.go +++ b/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { +func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/namespacesprivatelinkresources/client.go b/resource-manager/eventhub/2021-11-01/namespacesprivatelinkresources/client.go index 91bf1934f90..04bc3afdfd7 100644 --- a/resource-manager/eventhub/2021-11-01/namespacesprivatelinkresources/client.go +++ b/resource-manager/eventhub/2021-11-01/namespacesprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*NamespacesPrivateLinkResourcesClient, error) { +func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/networkrulesets/client.go b/resource-manager/eventhub/2021-11-01/networkrulesets/client.go index dc327b2d388..7386bf9f15b 100644 --- a/resource-manager/eventhub/2021-11-01/networkrulesets/client.go +++ b/resource-manager/eventhub/2021-11-01/networkrulesets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkRuleSetsClient struct { Client *resourcemanager.Client } -func NewNetworkRuleSetsClientWithBaseURI(api environments.Api) (*NetworkRuleSetsClient, error) { +func NewNetworkRuleSetsClientWithBaseURI(api sdkEnv.Api) (*NetworkRuleSetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkrulesets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkRuleSetsClient: %+v", err) diff --git a/resource-manager/eventhub/2021-11-01/schemaregistry/client.go b/resource-manager/eventhub/2021-11-01/schemaregistry/client.go index 531d5e32d5d..32a0c1ea271 100644 --- a/resource-manager/eventhub/2021-11-01/schemaregistry/client.go +++ b/resource-manager/eventhub/2021-11-01/schemaregistry/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SchemaRegistryClient struct { Client *resourcemanager.Client } -func NewSchemaRegistryClientWithBaseURI(api environments.Api) (*SchemaRegistryClient, error) { +func NewSchemaRegistryClientWithBaseURI(api sdkEnv.Api) (*SchemaRegistryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "schemaregistry", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SchemaRegistryClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/applicationgroup/client.go b/resource-manager/eventhub/2022-01-01-preview/applicationgroup/client.go index af56c03687c..e952a85e645 100644 --- a/resource-manager/eventhub/2022-01-01-preview/applicationgroup/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/applicationgroup/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGroupClient struct { Client *resourcemanager.Client } -func NewApplicationGroupClientWithBaseURI(api environments.Api) (*ApplicationGroupClient, error) { +func NewApplicationGroupClientWithBaseURI(api sdkEnv.Api) (*ApplicationGroupClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgroup", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGroupClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/client.go b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/client.go index b4e4f1e51a8..9569ddf325e 100644 --- a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AuthorizationRulesDisasterRecoveryConfigsClient struct { Client *resourcemanager.Client } -func NewAuthorizationRulesDisasterRecoveryConfigsClientWithBaseURI(api environments.Api) (*AuthorizationRulesDisasterRecoveryConfigsClient, error) { +func NewAuthorizationRulesDisasterRecoveryConfigsClientWithBaseURI(api sdkEnv.Api) (*AuthorizationRulesDisasterRecoveryConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "authorizationrulesdisasterrecoveryconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AuthorizationRulesDisasterRecoveryConfigsClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/client.go b/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/client.go index 86589fc7fd3..5e6ddf54227 100644 --- a/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AuthorizationRulesEventHubsClient struct { Client *resourcemanager.Client } -func NewAuthorizationRulesEventHubsClientWithBaseURI(api environments.Api) (*AuthorizationRulesEventHubsClient, error) { +func NewAuthorizationRulesEventHubsClientWithBaseURI(api sdkEnv.Api) (*AuthorizationRulesEventHubsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "authorizationruleseventhubs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AuthorizationRulesEventHubsClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/client.go b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/client.go index 37ff67c140c..9a3c224b13c 100644 --- a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AuthorizationRulesNamespacesClient struct { Client *resourcemanager.Client } -func NewAuthorizationRulesNamespacesClientWithBaseURI(api environments.Api) (*AuthorizationRulesNamespacesClient, error) { +func NewAuthorizationRulesNamespacesClientWithBaseURI(api sdkEnv.Api) (*AuthorizationRulesNamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "authorizationrulesnamespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AuthorizationRulesNamespacesClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitydisasterrecoveryconfigs/client.go b/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitydisasterrecoveryconfigs/client.go index c9a1159adcd..9e9bf643f57 100644 --- a/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitydisasterrecoveryconfigs/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitydisasterrecoveryconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityDisasterRecoveryConfigsClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityDisasterRecoveryConfigsClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityDisasterRecoveryConfigsClient, error) { +func NewCheckNameAvailabilityDisasterRecoveryConfigsClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityDisasterRecoveryConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailabilitydisasterrecoveryconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityDisasterRecoveryConfigsClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitynamespaces/client.go b/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitynamespaces/client.go index dab7e158c17..7baf052fa52 100644 --- a/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitynamespaces/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitynamespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityNamespacesClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityNamespacesClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityNamespacesClient, error) { +func NewCheckNameAvailabilityNamespacesClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityNamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailabilitynamespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityNamespacesClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/client.go b/resource-manager/eventhub/2022-01-01-preview/client.go index 8531f074653..7944420d331 100644 --- a/resource-manager/eventhub/2022-01-01-preview/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/client.go @@ -26,7 +26,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/networkrulesets" "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/schemaregistry" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -51,7 +51,7 @@ type Client struct { SchemaRegistry *schemaregistry.SchemaRegistryClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { applicationGroupClient, err := applicationgroup.NewApplicationGroupClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ApplicationGroup client: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/consumergroups/client.go b/resource-manager/eventhub/2022-01-01-preview/consumergroups/client.go index 36974a5eb62..43e1b557e18 100644 --- a/resource-manager/eventhub/2022-01-01-preview/consumergroups/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/consumergroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConsumerGroupsClient struct { Client *resourcemanager.Client } -func NewConsumerGroupsClientWithBaseURI(api environments.Api) (*ConsumerGroupsClient, error) { +func NewConsumerGroupsClientWithBaseURI(api sdkEnv.Api) (*ConsumerGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "consumergroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConsumerGroupsClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/client.go b/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/client.go index 3faf5be9484..b6f5e0db9ba 100644 --- a/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DisasterRecoveryConfigsClient struct { Client *resourcemanager.Client } -func NewDisasterRecoveryConfigsClientWithBaseURI(api environments.Api) (*DisasterRecoveryConfigsClient, error) { +func NewDisasterRecoveryConfigsClientWithBaseURI(api sdkEnv.Api) (*DisasterRecoveryConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "disasterrecoveryconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DisasterRecoveryConfigsClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/eventhubs/client.go b/resource-manager/eventhub/2022-01-01-preview/eventhubs/client.go index 81e902a74cb..dd5f638a5d8 100644 --- a/resource-manager/eventhub/2022-01-01-preview/eventhubs/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/eventhubs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventHubsClient struct { Client *resourcemanager.Client } -func NewEventHubsClientWithBaseURI(api environments.Api) (*EventHubsClient, error) { +func NewEventHubsClientWithBaseURI(api sdkEnv.Api) (*EventHubsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eventhubs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventHubsClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/eventhubsclusters/client.go b/resource-manager/eventhub/2022-01-01-preview/eventhubsclusters/client.go index f035dd75fd3..a87af487d17 100644 --- a/resource-manager/eventhub/2022-01-01-preview/eventhubsclusters/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/eventhubsclusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventHubsClustersClient struct { Client *resourcemanager.Client } -func NewEventHubsClustersClientWithBaseURI(api environments.Api) (*EventHubsClustersClient, error) { +func NewEventHubsClustersClientWithBaseURI(api sdkEnv.Api) (*EventHubsClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eventhubsclusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventHubsClustersClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersavailableclusterregions/client.go b/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersavailableclusterregions/client.go index 29627c2842f..6acb224cf2f 100644 --- a/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersavailableclusterregions/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersavailableclusterregions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventHubsClustersAvailableClusterRegionsClient struct { Client *resourcemanager.Client } -func NewEventHubsClustersAvailableClusterRegionsClientWithBaseURI(api environments.Api) (*EventHubsClustersAvailableClusterRegionsClient, error) { +func NewEventHubsClustersAvailableClusterRegionsClientWithBaseURI(api sdkEnv.Api) (*EventHubsClustersAvailableClusterRegionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eventhubsclustersavailableclusterregions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventHubsClustersAvailableClusterRegionsClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersconfiguration/client.go b/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersconfiguration/client.go index fc005057793..e06e4215086 100644 --- a/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersconfiguration/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventHubsClustersConfigurationClient struct { Client *resourcemanager.Client } -func NewEventHubsClustersConfigurationClientWithBaseURI(api environments.Api) (*EventHubsClustersConfigurationClient, error) { +func NewEventHubsClustersConfigurationClientWithBaseURI(api sdkEnv.Api) (*EventHubsClustersConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eventhubsclustersconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventHubsClustersConfigurationClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersnamespace/client.go b/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersnamespace/client.go index 0292a129e8a..f2dfa1c5674 100644 --- a/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersnamespace/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersnamespace/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EventHubsClustersNamespaceClient struct { Client *resourcemanager.Client } -func NewEventHubsClustersNamespaceClientWithBaseURI(api environments.Api) (*EventHubsClustersNamespaceClient, error) { +func NewEventHubsClustersNamespaceClientWithBaseURI(api sdkEnv.Api) (*EventHubsClustersNamespaceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "eventhubsclustersnamespace", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EventHubsClustersNamespaceClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/namespaces/client.go b/resource-manager/eventhub/2022-01-01-preview/namespaces/client.go index 6b0ae358115..a991037b3a6 100644 --- a/resource-manager/eventhub/2022-01-01-preview/namespaces/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/namespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesClient struct { Client *resourcemanager.Client } -func NewNamespacesClientWithBaseURI(api environments.Api) (*NamespacesClient, error) { +func NewNamespacesClientWithBaseURI(api sdkEnv.Api) (*NamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/client.go b/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/client.go index d783bb1715f..b26897afcf6 100644 --- a/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesNetworkSecurityPerimeterConfigurationsClient struct { Client *resourcemanager.Client } -func NewNamespacesNetworkSecurityPerimeterConfigurationsClientWithBaseURI(api environments.Api) (*NamespacesNetworkSecurityPerimeterConfigurationsClient, error) { +func NewNamespacesNetworkSecurityPerimeterConfigurationsClientWithBaseURI(api sdkEnv.Api) (*NamespacesNetworkSecurityPerimeterConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesnetworksecurityperimeterconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesNetworkSecurityPerimeterConfigurationsClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/client.go b/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/client.go index b6799829ed0..e29cce4a732 100644 --- a/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { +func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/namespacesprivatelinkresources/client.go b/resource-manager/eventhub/2022-01-01-preview/namespacesprivatelinkresources/client.go index 91bf1934f90..04bc3afdfd7 100644 --- a/resource-manager/eventhub/2022-01-01-preview/namespacesprivatelinkresources/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/namespacesprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*NamespacesPrivateLinkResourcesClient, error) { +func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/networkrulesets/client.go b/resource-manager/eventhub/2022-01-01-preview/networkrulesets/client.go index dc327b2d388..7386bf9f15b 100644 --- a/resource-manager/eventhub/2022-01-01-preview/networkrulesets/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/networkrulesets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkRuleSetsClient struct { Client *resourcemanager.Client } -func NewNetworkRuleSetsClientWithBaseURI(api environments.Api) (*NetworkRuleSetsClient, error) { +func NewNetworkRuleSetsClientWithBaseURI(api sdkEnv.Api) (*NetworkRuleSetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkrulesets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkRuleSetsClient: %+v", err) diff --git a/resource-manager/eventhub/2022-01-01-preview/schemaregistry/client.go b/resource-manager/eventhub/2022-01-01-preview/schemaregistry/client.go index 531d5e32d5d..32a0c1ea271 100644 --- a/resource-manager/eventhub/2022-01-01-preview/schemaregistry/client.go +++ b/resource-manager/eventhub/2022-01-01-preview/schemaregistry/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SchemaRegistryClient struct { Client *resourcemanager.Client } -func NewSchemaRegistryClientWithBaseURI(api environments.Api) (*SchemaRegistryClient, error) { +func NewSchemaRegistryClientWithBaseURI(api sdkEnv.Api) (*SchemaRegistryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "schemaregistry", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SchemaRegistryClient: %+v", err) diff --git a/resource-manager/extendedlocation/2021-08-15/client.go b/resource-manager/extendedlocation/2021-08-15/client.go index d5b1829fd76..58bede8a9ca 100644 --- a/resource-manager/extendedlocation/2021-08-15/client.go +++ b/resource-manager/extendedlocation/2021-08-15/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { CustomLocations *customlocations.CustomLocationsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { customLocationsClient, err := customlocations.NewCustomLocationsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CustomLocations client: %+v", err) diff --git a/resource-manager/extendedlocation/2021-08-15/customlocations/client.go b/resource-manager/extendedlocation/2021-08-15/customlocations/client.go index 06c1164c9a0..150727f4478 100644 --- a/resource-manager/extendedlocation/2021-08-15/customlocations/client.go +++ b/resource-manager/extendedlocation/2021-08-15/customlocations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CustomLocationsClient struct { Client *resourcemanager.Client } -func NewCustomLocationsClientWithBaseURI(api environments.Api) (*CustomLocationsClient, error) { +func NewCustomLocationsClientWithBaseURI(api sdkEnv.Api) (*CustomLocationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "customlocations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CustomLocationsClient: %+v", err) diff --git a/resource-manager/fluidrelay/2022-05-26/client.go b/resource-manager/fluidrelay/2022-05-26/client.go index 5b2f623018b..9cb86e08185 100644 --- a/resource-manager/fluidrelay/2022-05-26/client.go +++ b/resource-manager/fluidrelay/2022-05-26/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers" "github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { FluidRelayServers *fluidrelayservers.FluidRelayServersClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { fluidRelayContainersClient, err := fluidrelaycontainers.NewFluidRelayContainersClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building FluidRelayContainers client: %+v", err) diff --git a/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/client.go b/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/client.go index 9053c255a82..98eb16ba072 100644 --- a/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/client.go +++ b/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluidRelayContainersClient struct { Client *resourcemanager.Client } -func NewFluidRelayContainersClientWithBaseURI(api environments.Api) (*FluidRelayContainersClient, error) { +func NewFluidRelayContainersClientWithBaseURI(api sdkEnv.Api) (*FluidRelayContainersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fluidrelaycontainers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluidRelayContainersClient: %+v", err) diff --git a/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/client.go b/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/client.go index 967346e1df9..487e7bca6ed 100644 --- a/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/client.go +++ b/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluidRelayServersClient struct { Client *resourcemanager.Client } -func NewFluidRelayServersClientWithBaseURI(api environments.Api) (*FluidRelayServersClient, error) { +func NewFluidRelayServersClientWithBaseURI(api sdkEnv.Api) (*FluidRelayServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fluidrelayservers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluidRelayServersClient: %+v", err) diff --git a/resource-manager/fluidrelay/2022-06-01/client.go b/resource-manager/fluidrelay/2022-06-01/client.go index 717e234b418..321cfd4c86e 100644 --- a/resource-manager/fluidrelay/2022-06-01/client.go +++ b/resource-manager/fluidrelay/2022-06-01/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers" "github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-06-01/fluidrelayservers" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { FluidRelayServers *fluidrelayservers.FluidRelayServersClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { fluidRelayContainersClient, err := fluidrelaycontainers.NewFluidRelayContainersClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building FluidRelayContainers client: %+v", err) diff --git a/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/client.go b/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/client.go index 9053c255a82..98eb16ba072 100644 --- a/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/client.go +++ b/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluidRelayContainersClient struct { Client *resourcemanager.Client } -func NewFluidRelayContainersClientWithBaseURI(api environments.Api) (*FluidRelayContainersClient, error) { +func NewFluidRelayContainersClientWithBaseURI(api sdkEnv.Api) (*FluidRelayContainersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fluidrelaycontainers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluidRelayContainersClient: %+v", err) diff --git a/resource-manager/fluidrelay/2022-06-01/fluidrelayservers/client.go b/resource-manager/fluidrelay/2022-06-01/fluidrelayservers/client.go index 967346e1df9..487e7bca6ed 100644 --- a/resource-manager/fluidrelay/2022-06-01/fluidrelayservers/client.go +++ b/resource-manager/fluidrelay/2022-06-01/fluidrelayservers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluidRelayServersClient struct { Client *resourcemanager.Client } -func NewFluidRelayServersClientWithBaseURI(api environments.Api) (*FluidRelayServersClient, error) { +func NewFluidRelayServersClientWithBaseURI(api sdkEnv.Api) (*FluidRelayServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fluidrelayservers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluidRelayServersClient: %+v", err) diff --git a/resource-manager/graphservices/2023-04-13/client.go b/resource-manager/graphservices/2023-04-13/client.go index a9d2fd0fa47..0210e4a7a95 100644 --- a/resource-manager/graphservices/2023-04-13/client.go +++ b/resource-manager/graphservices/2023-04-13/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/graphservices/2023-04-13/graphservicesprods" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { Graphservicesprods *graphservicesprods.GraphservicesprodsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { graphservicesprodsClient, err := graphservicesprods.NewGraphservicesprodsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Graphservicesprods client: %+v", err) diff --git a/resource-manager/graphservices/2023-04-13/graphservicesprods/client.go b/resource-manager/graphservices/2023-04-13/graphservicesprods/client.go index c9d5b4a7c1a..3d0fc62f617 100644 --- a/resource-manager/graphservices/2023-04-13/graphservicesprods/client.go +++ b/resource-manager/graphservices/2023-04-13/graphservicesprods/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GraphservicesprodsClient struct { Client *resourcemanager.Client } -func NewGraphservicesprodsClientWithBaseURI(api environments.Api) (*GraphservicesprodsClient, error) { +func NewGraphservicesprodsClientWithBaseURI(api sdkEnv.Api) (*GraphservicesprodsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "graphservicesprods", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GraphservicesprodsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2020-06-25/client.go b/resource-manager/guestconfiguration/2020-06-25/client.go index 553444edf8b..c053cd0a08a 100644 --- a/resource-manager/guestconfiguration/2020-06-25/client.go +++ b/resource-manager/guestconfiguration/2020-06-25/client.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports" "github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -25,7 +25,7 @@ type Client struct { GuestConfigurationHCRPAssignments *guestconfigurationhcrpassignments.GuestConfigurationHCRPAssignmentsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { guestConfigurationAssignmentHCRPReportsClient, err := guestconfigurationassignmenthcrpreports.NewGuestConfigurationAssignmentHCRPReportsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building GuestConfigurationAssignmentHCRPReports client: %+v", err) diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/client.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/client.go index ad21680cc69..73a4654923d 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/client.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationAssignmentHCRPReportsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationAssignmentHCRPReportsClientWithBaseURI(api environments.Api) (*GuestConfigurationAssignmentHCRPReportsClient, error) { +func NewGuestConfigurationAssignmentHCRPReportsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationAssignmentHCRPReportsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationassignmenthcrpreports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationAssignmentHCRPReportsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/client.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/client.go index 90f298032af..9e17e81811b 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/client.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationAssignmentReportsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationAssignmentReportsClientWithBaseURI(api environments.Api) (*GuestConfigurationAssignmentReportsClient, error) { +func NewGuestConfigurationAssignmentReportsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationAssignmentReportsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationassignmentreports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationAssignmentReportsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/client.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/client.go index 4ac5b5d34dd..fe0e896d3a1 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/client.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationAssignmentsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationAssignmentsClientWithBaseURI(api environments.Api) (*GuestConfigurationAssignmentsClient, error) { +func NewGuestConfigurationAssignmentsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationAssignmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationassignments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationAssignmentsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/client.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/client.go index fa800a52ff6..a482483bcee 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/client.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationConnectedVMwarevSphereAssignmentsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationConnectedVMwarevSphereAssignmentsClientWithBaseURI(api environments.Api) (*GuestConfigurationConnectedVMwarevSphereAssignmentsClient, error) { +func NewGuestConfigurationConnectedVMwarevSphereAssignmentsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationConnectedVMwarevSphereAssignmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationconnectedvmwarevsphereassignments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationConnectedVMwarevSphereAssignmentsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/client.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/client.go index c0280d56cb5..7b994e63c9b 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/client.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationConnectedVMwarevSphereAssignmentsReportsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationConnectedVMwarevSphereAssignmentsReportsClientWithBaseURI(api environments.Api) (*GuestConfigurationConnectedVMwarevSphereAssignmentsReportsClient, error) { +func NewGuestConfigurationConnectedVMwarevSphereAssignmentsReportsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationConnectedVMwarevSphereAssignmentsReportsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationconnectedvmwarevsphereassignmentsreports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationConnectedVMwarevSphereAssignmentsReportsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/client.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/client.go index 1c6b544dcc5..387d303a45f 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/client.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationHCRPAssignmentsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationHCRPAssignmentsClientWithBaseURI(api environments.Api) (*GuestConfigurationHCRPAssignmentsClient, error) { +func NewGuestConfigurationHCRPAssignmentsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationHCRPAssignmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationhcrpassignments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationHCRPAssignmentsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2022-01-25/client.go b/resource-manager/guestconfiguration/2022-01-25/client.go index c5a527dbc0d..59e039a4410 100644 --- a/resource-manager/guestconfiguration/2022-01-25/client.go +++ b/resource-manager/guestconfiguration/2022-01-25/client.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports" "github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -25,7 +25,7 @@ type Client struct { GuestConfigurationHCRPAssignments *guestconfigurationhcrpassignments.GuestConfigurationHCRPAssignmentsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { guestConfigurationAssignmentHCRPReportsClient, err := guestconfigurationassignmenthcrpreports.NewGuestConfigurationAssignmentHCRPReportsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building GuestConfigurationAssignmentHCRPReports client: %+v", err) diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/client.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/client.go index ad21680cc69..73a4654923d 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/client.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationAssignmentHCRPReportsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationAssignmentHCRPReportsClientWithBaseURI(api environments.Api) (*GuestConfigurationAssignmentHCRPReportsClient, error) { +func NewGuestConfigurationAssignmentHCRPReportsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationAssignmentHCRPReportsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationassignmenthcrpreports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationAssignmentHCRPReportsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/client.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/client.go index 90f298032af..9e17e81811b 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/client.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationAssignmentReportsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationAssignmentReportsClientWithBaseURI(api environments.Api) (*GuestConfigurationAssignmentReportsClient, error) { +func NewGuestConfigurationAssignmentReportsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationAssignmentReportsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationassignmentreports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationAssignmentReportsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/client.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/client.go index 4ac5b5d34dd..fe0e896d3a1 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/client.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationAssignmentsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationAssignmentsClientWithBaseURI(api environments.Api) (*GuestConfigurationAssignmentsClient, error) { +func NewGuestConfigurationAssignmentsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationAssignmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationassignments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationAssignmentsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/client.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/client.go index fa800a52ff6..a482483bcee 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/client.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationConnectedVMwarevSphereAssignmentsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationConnectedVMwarevSphereAssignmentsClientWithBaseURI(api environments.Api) (*GuestConfigurationConnectedVMwarevSphereAssignmentsClient, error) { +func NewGuestConfigurationConnectedVMwarevSphereAssignmentsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationConnectedVMwarevSphereAssignmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationconnectedvmwarevsphereassignments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationConnectedVMwarevSphereAssignmentsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/client.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/client.go index c0280d56cb5..7b994e63c9b 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/client.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationConnectedVMwarevSphereAssignmentsReportsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationConnectedVMwarevSphereAssignmentsReportsClientWithBaseURI(api environments.Api) (*GuestConfigurationConnectedVMwarevSphereAssignmentsReportsClient, error) { +func NewGuestConfigurationConnectedVMwarevSphereAssignmentsReportsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationConnectedVMwarevSphereAssignmentsReportsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationconnectedvmwarevsphereassignmentsreports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationConnectedVMwarevSphereAssignmentsReportsClient: %+v", err) diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/client.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/client.go index 1c6b544dcc5..387d303a45f 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/client.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GuestConfigurationHCRPAssignmentsClient struct { Client *resourcemanager.Client } -func NewGuestConfigurationHCRPAssignmentsClientWithBaseURI(api environments.Api) (*GuestConfigurationHCRPAssignmentsClient, error) { +func NewGuestConfigurationHCRPAssignmentsClientWithBaseURI(api sdkEnv.Api) (*GuestConfigurationHCRPAssignmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationhcrpassignments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GuestConfigurationHCRPAssignmentsClient: %+v", err) diff --git a/resource-manager/hdinsight/2018-06-01-preview/applications/client.go b/resource-manager/hdinsight/2018-06-01-preview/applications/client.go index 4cedd2657e7..a857cb09244 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/applications/client.go +++ b/resource-manager/hdinsight/2018-06-01-preview/applications/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationsClient struct { Client *resourcemanager.Client } -func NewApplicationsClientWithBaseURI(api environments.Api) (*ApplicationsClient, error) { +func NewApplicationsClientWithBaseURI(api sdkEnv.Api) (*ApplicationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applications", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationsClient: %+v", err) diff --git a/resource-manager/hdinsight/2018-06-01-preview/client.go b/resource-manager/hdinsight/2018-06-01-preview/client.go index 3ed8806514d..66f6bf7af78 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/client.go +++ b/resource-manager/hdinsight/2018-06-01-preview/client.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory" "github.com/hashicorp/go-azure-sdk/resource-manager/hdinsight/2018-06-01-preview/virtualmachines" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -31,7 +31,7 @@ type Client struct { VirtualMachines *virtualmachines.VirtualMachinesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { applicationsClient, err := applications.NewApplicationsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Applications client: %+v", err) diff --git a/resource-manager/hdinsight/2018-06-01-preview/clusters/client.go b/resource-manager/hdinsight/2018-06-01-preview/clusters/client.go index d6411c267f7..41e352f752c 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/clusters/client.go +++ b/resource-manager/hdinsight/2018-06-01-preview/clusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ClustersClient struct { Client *resourcemanager.Client } -func NewClustersClientWithBaseURI(api environments.Api) (*ClustersClient, error) { +func NewClustersClientWithBaseURI(api sdkEnv.Api) (*ClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "clusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ClustersClient: %+v", err) diff --git a/resource-manager/hdinsight/2018-06-01-preview/configurations/client.go b/resource-manager/hdinsight/2018-06-01-preview/configurations/client.go index c2b3df6d8b8..b4d8c5d31c3 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/configurations/client.go +++ b/resource-manager/hdinsight/2018-06-01-preview/configurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationsClient struct { Client *resourcemanager.Client } -func NewConfigurationsClientWithBaseURI(api environments.Api) (*ConfigurationsClient, error) { +func NewConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationsClient: %+v", err) diff --git a/resource-manager/hdinsight/2018-06-01-preview/extensions/client.go b/resource-manager/hdinsight/2018-06-01-preview/extensions/client.go index e88614623e6..eb7b3d07cb1 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/extensions/client.go +++ b/resource-manager/hdinsight/2018-06-01-preview/extensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExtensionsClient struct { Client *resourcemanager.Client } -func NewExtensionsClientWithBaseURI(api environments.Api) (*ExtensionsClient, error) { +func NewExtensionsClientWithBaseURI(api sdkEnv.Api) (*ExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "extensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExtensionsClient: %+v", err) diff --git a/resource-manager/hdinsight/2018-06-01-preview/promote/client.go b/resource-manager/hdinsight/2018-06-01-preview/promote/client.go index ba45bdbb06c..5875092f96e 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/promote/client.go +++ b/resource-manager/hdinsight/2018-06-01-preview/promote/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PromoteClient struct { Client *resourcemanager.Client } -func NewPromoteClientWithBaseURI(api environments.Api) (*PromoteClient, error) { +func NewPromoteClientWithBaseURI(api sdkEnv.Api) (*PromoteClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "promote", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PromoteClient: %+v", err) diff --git a/resource-manager/hdinsight/2018-06-01-preview/regions/client.go b/resource-manager/hdinsight/2018-06-01-preview/regions/client.go index 8b971983196..61d64579099 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/regions/client.go +++ b/resource-manager/hdinsight/2018-06-01-preview/regions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RegionsClient struct { Client *resourcemanager.Client } -func NewRegionsClientWithBaseURI(api environments.Api) (*RegionsClient, error) { +func NewRegionsClientWithBaseURI(api sdkEnv.Api) (*RegionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "regions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RegionsClient: %+v", err) diff --git a/resource-manager/hdinsight/2018-06-01-preview/scriptactions/client.go b/resource-manager/hdinsight/2018-06-01-preview/scriptactions/client.go index 660ba5b8d05..f66e6b16bc8 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/scriptactions/client.go +++ b/resource-manager/hdinsight/2018-06-01-preview/scriptactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScriptActionsClient struct { Client *resourcemanager.Client } -func NewScriptActionsClientWithBaseURI(api environments.Api) (*ScriptActionsClient, error) { +func NewScriptActionsClientWithBaseURI(api sdkEnv.Api) (*ScriptActionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scriptactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScriptActionsClient: %+v", err) diff --git a/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/client.go b/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/client.go index 6886618f98c..e385a137b35 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/client.go +++ b/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScriptExecutionHistoryClient struct { Client *resourcemanager.Client } -func NewScriptExecutionHistoryClientWithBaseURI(api environments.Api) (*ScriptExecutionHistoryClient, error) { +func NewScriptExecutionHistoryClientWithBaseURI(api sdkEnv.Api) (*ScriptExecutionHistoryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scriptexecutionhistory", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScriptExecutionHistoryClient: %+v", err) diff --git a/resource-manager/hdinsight/2018-06-01-preview/virtualmachines/client.go b/resource-manager/hdinsight/2018-06-01-preview/virtualmachines/client.go index ddde210da17..d9b2555ade0 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/virtualmachines/client.go +++ b/resource-manager/hdinsight/2018-06-01-preview/virtualmachines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualMachinesClient struct { Client *resourcemanager.Client } -func NewVirtualMachinesClientWithBaseURI(api environments.Api) (*VirtualMachinesClient, error) { +func NewVirtualMachinesClientWithBaseURI(api sdkEnv.Api) (*VirtualMachinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualmachines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualMachinesClient: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/applications/client.go b/resource-manager/hdinsight/2021-06-01/applications/client.go index 4cedd2657e7..a857cb09244 100644 --- a/resource-manager/hdinsight/2021-06-01/applications/client.go +++ b/resource-manager/hdinsight/2021-06-01/applications/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationsClient struct { Client *resourcemanager.Client } -func NewApplicationsClientWithBaseURI(api environments.Api) (*ApplicationsClient, error) { +func NewApplicationsClientWithBaseURI(api sdkEnv.Api) (*ApplicationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applications", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationsClient: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/client.go b/resource-manager/hdinsight/2021-06-01/client.go index b7702e2c2bd..fb46573a605 100644 --- a/resource-manager/hdinsight/2021-06-01/client.go +++ b/resource-manager/hdinsight/2021-06-01/client.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory" "github.com/hashicorp/go-azure-sdk/resource-manager/hdinsight/2021-06-01/virtualmachines" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -35,7 +35,7 @@ type Client struct { VirtualMachines *virtualmachines.VirtualMachinesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { applicationsClient, err := applications.NewApplicationsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Applications client: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/clusters/client.go b/resource-manager/hdinsight/2021-06-01/clusters/client.go index d6411c267f7..41e352f752c 100644 --- a/resource-manager/hdinsight/2021-06-01/clusters/client.go +++ b/resource-manager/hdinsight/2021-06-01/clusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ClustersClient struct { Client *resourcemanager.Client } -func NewClustersClientWithBaseURI(api environments.Api) (*ClustersClient, error) { +func NewClustersClientWithBaseURI(api sdkEnv.Api) (*ClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "clusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ClustersClient: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/configurations/client.go b/resource-manager/hdinsight/2021-06-01/configurations/client.go index c2b3df6d8b8..b4d8c5d31c3 100644 --- a/resource-manager/hdinsight/2021-06-01/configurations/client.go +++ b/resource-manager/hdinsight/2021-06-01/configurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationsClient struct { Client *resourcemanager.Client } -func NewConfigurationsClientWithBaseURI(api environments.Api) (*ConfigurationsClient, error) { +func NewConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationsClient: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/extensions/client.go b/resource-manager/hdinsight/2021-06-01/extensions/client.go index e88614623e6..eb7b3d07cb1 100644 --- a/resource-manager/hdinsight/2021-06-01/extensions/client.go +++ b/resource-manager/hdinsight/2021-06-01/extensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExtensionsClient struct { Client *resourcemanager.Client } -func NewExtensionsClientWithBaseURI(api environments.Api) (*ExtensionsClient, error) { +func NewExtensionsClientWithBaseURI(api sdkEnv.Api) (*ExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "extensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExtensionsClient: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/privateendpointconnections/client.go b/resource-manager/hdinsight/2021-06-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/hdinsight/2021-06-01/privateendpointconnections/client.go +++ b/resource-manager/hdinsight/2021-06-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/privatelinkresources/client.go b/resource-manager/hdinsight/2021-06-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/hdinsight/2021-06-01/privatelinkresources/client.go +++ b/resource-manager/hdinsight/2021-06-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/promote/client.go b/resource-manager/hdinsight/2021-06-01/promote/client.go index ba45bdbb06c..5875092f96e 100644 --- a/resource-manager/hdinsight/2021-06-01/promote/client.go +++ b/resource-manager/hdinsight/2021-06-01/promote/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PromoteClient struct { Client *resourcemanager.Client } -func NewPromoteClientWithBaseURI(api environments.Api) (*PromoteClient, error) { +func NewPromoteClientWithBaseURI(api sdkEnv.Api) (*PromoteClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "promote", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PromoteClient: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/regions/client.go b/resource-manager/hdinsight/2021-06-01/regions/client.go index 8b971983196..61d64579099 100644 --- a/resource-manager/hdinsight/2021-06-01/regions/client.go +++ b/resource-manager/hdinsight/2021-06-01/regions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RegionsClient struct { Client *resourcemanager.Client } -func NewRegionsClientWithBaseURI(api environments.Api) (*RegionsClient, error) { +func NewRegionsClientWithBaseURI(api sdkEnv.Api) (*RegionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "regions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RegionsClient: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/scriptactions/client.go b/resource-manager/hdinsight/2021-06-01/scriptactions/client.go index 660ba5b8d05..f66e6b16bc8 100644 --- a/resource-manager/hdinsight/2021-06-01/scriptactions/client.go +++ b/resource-manager/hdinsight/2021-06-01/scriptactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScriptActionsClient struct { Client *resourcemanager.Client } -func NewScriptActionsClientWithBaseURI(api environments.Api) (*ScriptActionsClient, error) { +func NewScriptActionsClientWithBaseURI(api sdkEnv.Api) (*ScriptActionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scriptactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScriptActionsClient: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/client.go b/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/client.go index 6886618f98c..e385a137b35 100644 --- a/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/client.go +++ b/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScriptExecutionHistoryClient struct { Client *resourcemanager.Client } -func NewScriptExecutionHistoryClientWithBaseURI(api environments.Api) (*ScriptExecutionHistoryClient, error) { +func NewScriptExecutionHistoryClientWithBaseURI(api sdkEnv.Api) (*ScriptExecutionHistoryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scriptexecutionhistory", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScriptExecutionHistoryClient: %+v", err) diff --git a/resource-manager/hdinsight/2021-06-01/virtualmachines/client.go b/resource-manager/hdinsight/2021-06-01/virtualmachines/client.go index ddde210da17..d9b2555ade0 100644 --- a/resource-manager/hdinsight/2021-06-01/virtualmachines/client.go +++ b/resource-manager/hdinsight/2021-06-01/virtualmachines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualMachinesClient struct { Client *resourcemanager.Client } -func NewVirtualMachinesClientWithBaseURI(api environments.Api) (*VirtualMachinesClient, error) { +func NewVirtualMachinesClientWithBaseURI(api sdkEnv.Api) (*VirtualMachinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualmachines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualMachinesClient: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/client.go b/resource-manager/healthcareapis/2022-12-01/client.go index 2d4846c81db..3e13f2b6e14 100644 --- a/resource-manager/healthcareapis/2022-12-01/client.go +++ b/resource-manager/healthcareapis/2022-12-01/client.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources" "github.com/hashicorp/go-azure-sdk/resource-manager/healthcareapis/2022-12-01/workspaces" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -35,7 +35,7 @@ type Client struct { Workspaces *workspaces.WorkspacesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { collectionClient, err := collection.NewCollectionClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Collection client: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/collection/client.go b/resource-manager/healthcareapis/2022-12-01/collection/client.go index a179c69f20b..305130082d3 100644 --- a/resource-manager/healthcareapis/2022-12-01/collection/client.go +++ b/resource-manager/healthcareapis/2022-12-01/collection/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CollectionClient struct { Client *resourcemanager.Client } -func NewCollectionClientWithBaseURI(api environments.Api) (*CollectionClient, error) { +func NewCollectionClientWithBaseURI(api sdkEnv.Api) (*CollectionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "collection", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CollectionClient: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/dicomservices/client.go b/resource-manager/healthcareapis/2022-12-01/dicomservices/client.go index 8bc9c929e4a..9d5cd4dc921 100644 --- a/resource-manager/healthcareapis/2022-12-01/dicomservices/client.go +++ b/resource-manager/healthcareapis/2022-12-01/dicomservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DicomServicesClient struct { Client *resourcemanager.Client } -func NewDicomServicesClientWithBaseURI(api environments.Api) (*DicomServicesClient, error) { +func NewDicomServicesClientWithBaseURI(api sdkEnv.Api) (*DicomServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dicomservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DicomServicesClient: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/fhirservices/client.go b/resource-manager/healthcareapis/2022-12-01/fhirservices/client.go index acbcad3966c..62628e9a017 100644 --- a/resource-manager/healthcareapis/2022-12-01/fhirservices/client.go +++ b/resource-manager/healthcareapis/2022-12-01/fhirservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FhirServicesClient struct { Client *resourcemanager.Client } -func NewFhirServicesClientWithBaseURI(api environments.Api) (*FhirServicesClient, error) { +func NewFhirServicesClientWithBaseURI(api sdkEnv.Api) (*FhirServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fhirservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FhirServicesClient: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/iotconnectors/client.go b/resource-manager/healthcareapis/2022-12-01/iotconnectors/client.go index 8eb966b134f..998decec51a 100644 --- a/resource-manager/healthcareapis/2022-12-01/iotconnectors/client.go +++ b/resource-manager/healthcareapis/2022-12-01/iotconnectors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IotConnectorsClient struct { Client *resourcemanager.Client } -func NewIotConnectorsClientWithBaseURI(api environments.Api) (*IotConnectorsClient, error) { +func NewIotConnectorsClientWithBaseURI(api sdkEnv.Api) (*IotConnectorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "iotconnectors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IotConnectorsClient: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/client.go b/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/client.go +++ b/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/privatelinkresources/client.go b/resource-manager/healthcareapis/2022-12-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/healthcareapis/2022-12-01/privatelinkresources/client.go +++ b/resource-manager/healthcareapis/2022-12-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/proxy/client.go b/resource-manager/healthcareapis/2022-12-01/proxy/client.go index 982cd2a3359..c7a905d2710 100644 --- a/resource-manager/healthcareapis/2022-12-01/proxy/client.go +++ b/resource-manager/healthcareapis/2022-12-01/proxy/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProxyClient struct { Client *resourcemanager.Client } -func NewProxyClientWithBaseURI(api environments.Api) (*ProxyClient, error) { +func NewProxyClientWithBaseURI(api sdkEnv.Api) (*ProxyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "proxy", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProxyClient: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/resource/client.go b/resource-manager/healthcareapis/2022-12-01/resource/client.go index 5137ab3e771..1152509990e 100644 --- a/resource-manager/healthcareapis/2022-12-01/resource/client.go +++ b/resource-manager/healthcareapis/2022-12-01/resource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResourceClient struct { Client *resourcemanager.Client } -func NewResourceClientWithBaseURI(api environments.Api) (*ResourceClient, error) { +func NewResourceClientWithBaseURI(api sdkEnv.Api) (*ResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResourceClient: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/client.go b/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/client.go index 584fd609d85..3f9d225e74b 100644 --- a/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/client.go +++ b/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { +func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/client.go b/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/client.go index b5b7cfe9b1c..bc6558ba9f8 100644 --- a/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/client.go +++ b/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api environments.Api) (*WorkspacePrivateLinkResourcesClient, error) { +func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/healthcareapis/2022-12-01/workspaces/client.go b/resource-manager/healthcareapis/2022-12-01/workspaces/client.go index bf91cd2dee7..868fd830b2a 100644 --- a/resource-manager/healthcareapis/2022-12-01/workspaces/client.go +++ b/resource-manager/healthcareapis/2022-12-01/workspaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacesClient struct { Client *resourcemanager.Client } -func NewWorkspacesClientWithBaseURI(api environments.Api) (*WorkspacesClient, error) { +func NewWorkspacesClientWithBaseURI(api sdkEnv.Api) (*WorkspacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacesClient: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/client.go b/resource-manager/healthcareapis/2023-02-28/client.go index 969deca75fd..8e9c2099bfe 100644 --- a/resource-manager/healthcareapis/2023-02-28/client.go +++ b/resource-manager/healthcareapis/2023-02-28/client.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources" "github.com/hashicorp/go-azure-sdk/resource-manager/healthcareapis/2023-02-28/workspaces" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -35,7 +35,7 @@ type Client struct { Workspaces *workspaces.WorkspacesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { collectionClient, err := collection.NewCollectionClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Collection client: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/collection/client.go b/resource-manager/healthcareapis/2023-02-28/collection/client.go index a179c69f20b..305130082d3 100644 --- a/resource-manager/healthcareapis/2023-02-28/collection/client.go +++ b/resource-manager/healthcareapis/2023-02-28/collection/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CollectionClient struct { Client *resourcemanager.Client } -func NewCollectionClientWithBaseURI(api environments.Api) (*CollectionClient, error) { +func NewCollectionClientWithBaseURI(api sdkEnv.Api) (*CollectionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "collection", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CollectionClient: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/dicomservices/client.go b/resource-manager/healthcareapis/2023-02-28/dicomservices/client.go index 8bc9c929e4a..9d5cd4dc921 100644 --- a/resource-manager/healthcareapis/2023-02-28/dicomservices/client.go +++ b/resource-manager/healthcareapis/2023-02-28/dicomservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DicomServicesClient struct { Client *resourcemanager.Client } -func NewDicomServicesClientWithBaseURI(api environments.Api) (*DicomServicesClient, error) { +func NewDicomServicesClientWithBaseURI(api sdkEnv.Api) (*DicomServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dicomservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DicomServicesClient: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/fhirservices/client.go b/resource-manager/healthcareapis/2023-02-28/fhirservices/client.go index acbcad3966c..62628e9a017 100644 --- a/resource-manager/healthcareapis/2023-02-28/fhirservices/client.go +++ b/resource-manager/healthcareapis/2023-02-28/fhirservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FhirServicesClient struct { Client *resourcemanager.Client } -func NewFhirServicesClientWithBaseURI(api environments.Api) (*FhirServicesClient, error) { +func NewFhirServicesClientWithBaseURI(api sdkEnv.Api) (*FhirServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fhirservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FhirServicesClient: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/iotconnectors/client.go b/resource-manager/healthcareapis/2023-02-28/iotconnectors/client.go index 8eb966b134f..998decec51a 100644 --- a/resource-manager/healthcareapis/2023-02-28/iotconnectors/client.go +++ b/resource-manager/healthcareapis/2023-02-28/iotconnectors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IotConnectorsClient struct { Client *resourcemanager.Client } -func NewIotConnectorsClientWithBaseURI(api environments.Api) (*IotConnectorsClient, error) { +func NewIotConnectorsClientWithBaseURI(api sdkEnv.Api) (*IotConnectorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "iotconnectors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IotConnectorsClient: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/client.go b/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/client.go +++ b/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/privatelinkresources/client.go b/resource-manager/healthcareapis/2023-02-28/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/healthcareapis/2023-02-28/privatelinkresources/client.go +++ b/resource-manager/healthcareapis/2023-02-28/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/proxy/client.go b/resource-manager/healthcareapis/2023-02-28/proxy/client.go index 982cd2a3359..c7a905d2710 100644 --- a/resource-manager/healthcareapis/2023-02-28/proxy/client.go +++ b/resource-manager/healthcareapis/2023-02-28/proxy/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProxyClient struct { Client *resourcemanager.Client } -func NewProxyClientWithBaseURI(api environments.Api) (*ProxyClient, error) { +func NewProxyClientWithBaseURI(api sdkEnv.Api) (*ProxyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "proxy", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProxyClient: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/resource/client.go b/resource-manager/healthcareapis/2023-02-28/resource/client.go index 5137ab3e771..1152509990e 100644 --- a/resource-manager/healthcareapis/2023-02-28/resource/client.go +++ b/resource-manager/healthcareapis/2023-02-28/resource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResourceClient struct { Client *resourcemanager.Client } -func NewResourceClientWithBaseURI(api environments.Api) (*ResourceClient, error) { +func NewResourceClientWithBaseURI(api sdkEnv.Api) (*ResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResourceClient: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/client.go b/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/client.go index 584fd609d85..3f9d225e74b 100644 --- a/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/client.go +++ b/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { +func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/client.go b/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/client.go index b5b7cfe9b1c..bc6558ba9f8 100644 --- a/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/client.go +++ b/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api environments.Api) (*WorkspacePrivateLinkResourcesClient, error) { +func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/healthcareapis/2023-02-28/workspaces/client.go b/resource-manager/healthcareapis/2023-02-28/workspaces/client.go index bf91cd2dee7..868fd830b2a 100644 --- a/resource-manager/healthcareapis/2023-02-28/workspaces/client.go +++ b/resource-manager/healthcareapis/2023-02-28/workspaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacesClient struct { Client *resourcemanager.Client } -func NewWorkspacesClientWithBaseURI(api environments.Api) (*WorkspacesClient, error) { +func NewWorkspacesClientWithBaseURI(api sdkEnv.Api) (*WorkspacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacesClient: %+v", err) diff --git a/resource-manager/iotcentral/2021-11-01-preview/apps/client.go b/resource-manager/iotcentral/2021-11-01-preview/apps/client.go index 88e655f47bc..5c5452db769 100644 --- a/resource-manager/iotcentral/2021-11-01-preview/apps/client.go +++ b/resource-manager/iotcentral/2021-11-01-preview/apps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AppsClient struct { Client *resourcemanager.Client } -func NewAppsClientWithBaseURI(api environments.Api) (*AppsClient, error) { +func NewAppsClientWithBaseURI(api sdkEnv.Api) (*AppsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "apps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AppsClient: %+v", err) diff --git a/resource-manager/iotcentral/2021-11-01-preview/client.go b/resource-manager/iotcentral/2021-11-01-preview/client.go index 6475efaf617..8fbe5c0d231 100644 --- a/resource-manager/iotcentral/2021-11-01-preview/client.go +++ b/resource-manager/iotcentral/2021-11-01-preview/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps" "github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/networking" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { Networking *networking.NetworkingClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { appsClient, err := apps.NewAppsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Apps client: %+v", err) diff --git a/resource-manager/iotcentral/2021-11-01-preview/networking/client.go b/resource-manager/iotcentral/2021-11-01-preview/networking/client.go index 74cb577006c..7c6a6a696d9 100644 --- a/resource-manager/iotcentral/2021-11-01-preview/networking/client.go +++ b/resource-manager/iotcentral/2021-11-01-preview/networking/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkingClient struct { Client *resourcemanager.Client } -func NewNetworkingClientWithBaseURI(api environments.Api) (*NetworkingClient, error) { +func NewNetworkingClientWithBaseURI(api sdkEnv.Api) (*NetworkingClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networking", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkingClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/client.go b/resource-manager/kubernetesconfiguration/2022-03-01/client.go index c0d295cc9bb..9bca25c1363 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/client.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/client.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-03-01/operationsinacluster" "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-03-01/sourcecontrolconfiguration" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -29,7 +29,7 @@ type Client struct { SourceControlConfiguration *sourcecontrolconfiguration.SourceControlConfigurationClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { clusterExtensionsClient, err := clusterextensions.NewClusterExtensionsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ClusterExtensions client: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/clusterextensions/client.go b/resource-manager/kubernetesconfiguration/2022-03-01/clusterextensions/client.go index e80078b757d..bf646c76a91 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/clusterextensions/client.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/clusterextensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ClusterExtensionsClient struct { Client *resourcemanager.Client } -func NewClusterExtensionsClientWithBaseURI(api environments.Api) (*ClusterExtensionsClient, error) { +func NewClusterExtensionsClientWithBaseURI(api sdkEnv.Api) (*ClusterExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "clusterextensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ClusterExtensionsClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/extensionoperationstatus/client.go b/resource-manager/kubernetesconfiguration/2022-03-01/extensionoperationstatus/client.go index e7d6b87b5da..9e9fe7e5daf 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/extensionoperationstatus/client.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/extensionoperationstatus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExtensionOperationStatusClient struct { Client *resourcemanager.Client } -func NewExtensionOperationStatusClientWithBaseURI(api environments.Api) (*ExtensionOperationStatusClient, error) { +func NewExtensionOperationStatusClientWithBaseURI(api sdkEnv.Api) (*ExtensionOperationStatusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "extensionoperationstatus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExtensionOperationStatusClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/extensions/client.go b/resource-manager/kubernetesconfiguration/2022-03-01/extensions/client.go index e88614623e6..eb7b3d07cb1 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/extensions/client.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/extensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExtensionsClient struct { Client *resourcemanager.Client } -func NewExtensionsClientWithBaseURI(api environments.Api) (*ExtensionsClient, error) { +func NewExtensionsClientWithBaseURI(api sdkEnv.Api) (*ExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "extensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExtensionsClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/flux/client.go b/resource-manager/kubernetesconfiguration/2022-03-01/flux/client.go index f15d04c2b52..4e7092b465d 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/flux/client.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/flux/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluxClient struct { Client *resourcemanager.Client } -func NewFluxClientWithBaseURI(api environments.Api) (*FluxClient, error) { +func NewFluxClientWithBaseURI(api sdkEnv.Api) (*FluxClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "flux", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluxClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfiguration/client.go b/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfiguration/client.go index fcdee8ba677..1eed9eebb06 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfiguration/client.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluxConfigurationClient struct { Client *resourcemanager.Client } -func NewFluxConfigurationClientWithBaseURI(api environments.Api) (*FluxConfigurationClient, error) { +func NewFluxConfigurationClientWithBaseURI(api sdkEnv.Api) (*FluxConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fluxconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluxConfigurationClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfigurationoperationstatus/client.go b/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfigurationoperationstatus/client.go index ee213ceb117..b8677326ef7 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfigurationoperationstatus/client.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfigurationoperationstatus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluxConfigurationOperationStatusClient struct { Client *resourcemanager.Client } -func NewFluxConfigurationOperationStatusClientWithBaseURI(api environments.Api) (*FluxConfigurationOperationStatusClient, error) { +func NewFluxConfigurationOperationStatusClientWithBaseURI(api sdkEnv.Api) (*FluxConfigurationOperationStatusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fluxconfigurationoperationstatus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluxConfigurationOperationStatusClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/operationsinacluster/client.go b/resource-manager/kubernetesconfiguration/2022-03-01/operationsinacluster/client.go index a5e9b3a4a34..67ca7342566 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/operationsinacluster/client.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/operationsinacluster/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationsInAClusterClient struct { Client *resourcemanager.Client } -func NewOperationsInAClusterClientWithBaseURI(api environments.Api) (*OperationsInAClusterClient, error) { +func NewOperationsInAClusterClientWithBaseURI(api sdkEnv.Api) (*OperationsInAClusterClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operationsinacluster", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationsInAClusterClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/sourcecontrolconfiguration/client.go b/resource-manager/kubernetesconfiguration/2022-03-01/sourcecontrolconfiguration/client.go index b26ba186842..c3efad3af56 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/sourcecontrolconfiguration/client.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/sourcecontrolconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SourceControlConfigurationClient struct { Client *resourcemanager.Client } -func NewSourceControlConfigurationClientWithBaseURI(api environments.Api) (*SourceControlConfigurationClient, error) { +func NewSourceControlConfigurationClientWithBaseURI(api sdkEnv.Api) (*SourceControlConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sourcecontrolconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SourceControlConfigurationClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/client.go b/resource-manager/kubernetesconfiguration/2022-11-01/client.go index 9f77334c04b..f4112f59459 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/client.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/client.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/operationsinacluster" "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/sourcecontrolconfiguration" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -29,7 +29,7 @@ type Client struct { SourceControlConfiguration *sourcecontrolconfiguration.SourceControlConfigurationClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { clusterExtensionsClient, err := clusterextensions.NewClusterExtensionsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ClusterExtensions client: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/clusterextensions/client.go b/resource-manager/kubernetesconfiguration/2022-11-01/clusterextensions/client.go index e80078b757d..bf646c76a91 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/clusterextensions/client.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/clusterextensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ClusterExtensionsClient struct { Client *resourcemanager.Client } -func NewClusterExtensionsClientWithBaseURI(api environments.Api) (*ClusterExtensionsClient, error) { +func NewClusterExtensionsClientWithBaseURI(api sdkEnv.Api) (*ClusterExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "clusterextensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ClusterExtensionsClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/extensionoperationstatus/client.go b/resource-manager/kubernetesconfiguration/2022-11-01/extensionoperationstatus/client.go index e7d6b87b5da..9e9fe7e5daf 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/extensionoperationstatus/client.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/extensionoperationstatus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExtensionOperationStatusClient struct { Client *resourcemanager.Client } -func NewExtensionOperationStatusClientWithBaseURI(api environments.Api) (*ExtensionOperationStatusClient, error) { +func NewExtensionOperationStatusClientWithBaseURI(api sdkEnv.Api) (*ExtensionOperationStatusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "extensionoperationstatus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExtensionOperationStatusClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/extensions/client.go b/resource-manager/kubernetesconfiguration/2022-11-01/extensions/client.go index e88614623e6..eb7b3d07cb1 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/extensions/client.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/extensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExtensionsClient struct { Client *resourcemanager.Client } -func NewExtensionsClientWithBaseURI(api environments.Api) (*ExtensionsClient, error) { +func NewExtensionsClientWithBaseURI(api sdkEnv.Api) (*ExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "extensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExtensionsClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/flux/client.go b/resource-manager/kubernetesconfiguration/2022-11-01/flux/client.go index f15d04c2b52..4e7092b465d 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/flux/client.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/flux/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluxClient struct { Client *resourcemanager.Client } -func NewFluxClientWithBaseURI(api environments.Api) (*FluxClient, error) { +func NewFluxClientWithBaseURI(api sdkEnv.Api) (*FluxClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "flux", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluxClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/client.go b/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/client.go index fcdee8ba677..1eed9eebb06 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/client.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluxConfigurationClient struct { Client *resourcemanager.Client } -func NewFluxConfigurationClientWithBaseURI(api environments.Api) (*FluxConfigurationClient, error) { +func NewFluxConfigurationClientWithBaseURI(api sdkEnv.Api) (*FluxConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fluxconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluxConfigurationClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfigurationoperationstatus/client.go b/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfigurationoperationstatus/client.go index ee213ceb117..b8677326ef7 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfigurationoperationstatus/client.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfigurationoperationstatus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluxConfigurationOperationStatusClient struct { Client *resourcemanager.Client } -func NewFluxConfigurationOperationStatusClientWithBaseURI(api environments.Api) (*FluxConfigurationOperationStatusClient, error) { +func NewFluxConfigurationOperationStatusClientWithBaseURI(api sdkEnv.Api) (*FluxConfigurationOperationStatusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fluxconfigurationoperationstatus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluxConfigurationOperationStatusClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/operationsinacluster/client.go b/resource-manager/kubernetesconfiguration/2022-11-01/operationsinacluster/client.go index a5e9b3a4a34..67ca7342566 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/operationsinacluster/client.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/operationsinacluster/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationsInAClusterClient struct { Client *resourcemanager.Client } -func NewOperationsInAClusterClientWithBaseURI(api environments.Api) (*OperationsInAClusterClient, error) { +func NewOperationsInAClusterClientWithBaseURI(api sdkEnv.Api) (*OperationsInAClusterClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operationsinacluster", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationsInAClusterClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/sourcecontrolconfiguration/client.go b/resource-manager/kubernetesconfiguration/2022-11-01/sourcecontrolconfiguration/client.go index b26ba186842..c3efad3af56 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/sourcecontrolconfiguration/client.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/sourcecontrolconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SourceControlConfigurationClient struct { Client *resourcemanager.Client } -func NewSourceControlConfigurationClientWithBaseURI(api environments.Api) (*SourceControlConfigurationClient, error) { +func NewSourceControlConfigurationClientWithBaseURI(api sdkEnv.Api) (*SourceControlConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sourcecontrolconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SourceControlConfigurationClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/client.go b/resource-manager/kubernetesconfiguration/2023-05-01/client.go index cdd869c7e43..f06b278510f 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/client.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/client.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/operationsinacluster" "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/sourcecontrolconfiguration" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -29,7 +29,7 @@ type Client struct { SourceControlConfiguration *sourcecontrolconfiguration.SourceControlConfigurationClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { clusterExtensionsClient, err := clusterextensions.NewClusterExtensionsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ClusterExtensions client: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/clusterextensions/client.go b/resource-manager/kubernetesconfiguration/2023-05-01/clusterextensions/client.go index e80078b757d..bf646c76a91 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/clusterextensions/client.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/clusterextensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ClusterExtensionsClient struct { Client *resourcemanager.Client } -func NewClusterExtensionsClientWithBaseURI(api environments.Api) (*ClusterExtensionsClient, error) { +func NewClusterExtensionsClientWithBaseURI(api sdkEnv.Api) (*ClusterExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "clusterextensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ClusterExtensionsClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/extensionoperationstatus/client.go b/resource-manager/kubernetesconfiguration/2023-05-01/extensionoperationstatus/client.go index e7d6b87b5da..9e9fe7e5daf 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/extensionoperationstatus/client.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/extensionoperationstatus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExtensionOperationStatusClient struct { Client *resourcemanager.Client } -func NewExtensionOperationStatusClientWithBaseURI(api environments.Api) (*ExtensionOperationStatusClient, error) { +func NewExtensionOperationStatusClientWithBaseURI(api sdkEnv.Api) (*ExtensionOperationStatusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "extensionoperationstatus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExtensionOperationStatusClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/extensions/client.go b/resource-manager/kubernetesconfiguration/2023-05-01/extensions/client.go index e88614623e6..eb7b3d07cb1 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/extensions/client.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/extensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExtensionsClient struct { Client *resourcemanager.Client } -func NewExtensionsClientWithBaseURI(api environments.Api) (*ExtensionsClient, error) { +func NewExtensionsClientWithBaseURI(api sdkEnv.Api) (*ExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "extensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExtensionsClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/flux/client.go b/resource-manager/kubernetesconfiguration/2023-05-01/flux/client.go index f15d04c2b52..4e7092b465d 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/flux/client.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/flux/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluxClient struct { Client *resourcemanager.Client } -func NewFluxClientWithBaseURI(api environments.Api) (*FluxClient, error) { +func NewFluxClientWithBaseURI(api sdkEnv.Api) (*FluxClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "flux", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluxClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/client.go b/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/client.go index fcdee8ba677..1eed9eebb06 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/client.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluxConfigurationClient struct { Client *resourcemanager.Client } -func NewFluxConfigurationClientWithBaseURI(api environments.Api) (*FluxConfigurationClient, error) { +func NewFluxConfigurationClientWithBaseURI(api sdkEnv.Api) (*FluxConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fluxconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluxConfigurationClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfigurationoperationstatus/client.go b/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfigurationoperationstatus/client.go index ee213ceb117..b8677326ef7 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfigurationoperationstatus/client.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfigurationoperationstatus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FluxConfigurationOperationStatusClient struct { Client *resourcemanager.Client } -func NewFluxConfigurationOperationStatusClientWithBaseURI(api environments.Api) (*FluxConfigurationOperationStatusClient, error) { +func NewFluxConfigurationOperationStatusClientWithBaseURI(api sdkEnv.Api) (*FluxConfigurationOperationStatusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fluxconfigurationoperationstatus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FluxConfigurationOperationStatusClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/operationsinacluster/client.go b/resource-manager/kubernetesconfiguration/2023-05-01/operationsinacluster/client.go index a5e9b3a4a34..67ca7342566 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/operationsinacluster/client.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/operationsinacluster/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationsInAClusterClient struct { Client *resourcemanager.Client } -func NewOperationsInAClusterClientWithBaseURI(api environments.Api) (*OperationsInAClusterClient, error) { +func NewOperationsInAClusterClientWithBaseURI(api sdkEnv.Api) (*OperationsInAClusterClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operationsinacluster", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationsInAClusterClient: %+v", err) diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/sourcecontrolconfiguration/client.go b/resource-manager/kubernetesconfiguration/2023-05-01/sourcecontrolconfiguration/client.go index b26ba186842..c3efad3af56 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/sourcecontrolconfiguration/client.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/sourcecontrolconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SourceControlConfigurationClient struct { Client *resourcemanager.Client } -func NewSourceControlConfigurationClientWithBaseURI(api environments.Api) (*SourceControlConfigurationClient, error) { +func NewSourceControlConfigurationClientWithBaseURI(api sdkEnv.Api) (*SourceControlConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sourcecontrolconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SourceControlConfigurationClient: %+v", err) diff --git a/resource-manager/labservices/2021-10-01-preview/client.go b/resource-manager/labservices/2021-10-01-preview/client.go index a5cd1f1476d..93b2a420959 100644 --- a/resource-manager/labservices/2021-10-01-preview/client.go +++ b/resource-manager/labservices/2021-10-01-preview/client.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2021-10-01-preview/user" "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2021-10-01-preview/virtualmachine" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -25,7 +25,7 @@ type Client struct { VirtualMachine *virtualmachine.VirtualMachineClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { imageClient, err := image.NewImageClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Image client: %+v", err) diff --git a/resource-manager/labservices/2021-10-01-preview/image/client.go b/resource-manager/labservices/2021-10-01-preview/image/client.go index d016d4d62ab..27e868eb89e 100644 --- a/resource-manager/labservices/2021-10-01-preview/image/client.go +++ b/resource-manager/labservices/2021-10-01-preview/image/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ImageClient struct { Client *resourcemanager.Client } -func NewImageClientWithBaseURI(api environments.Api) (*ImageClient, error) { +func NewImageClientWithBaseURI(api sdkEnv.Api) (*ImageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "image", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ImageClient: %+v", err) diff --git a/resource-manager/labservices/2021-10-01-preview/lab/client.go b/resource-manager/labservices/2021-10-01-preview/lab/client.go index de930587f66..14158f88532 100644 --- a/resource-manager/labservices/2021-10-01-preview/lab/client.go +++ b/resource-manager/labservices/2021-10-01-preview/lab/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LabClient struct { Client *resourcemanager.Client } -func NewLabClientWithBaseURI(api environments.Api) (*LabClient, error) { +func NewLabClientWithBaseURI(api sdkEnv.Api) (*LabClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "lab", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LabClient: %+v", err) diff --git a/resource-manager/labservices/2021-10-01-preview/labplan/client.go b/resource-manager/labservices/2021-10-01-preview/labplan/client.go index c2fe664f0d4..10612fa4074 100644 --- a/resource-manager/labservices/2021-10-01-preview/labplan/client.go +++ b/resource-manager/labservices/2021-10-01-preview/labplan/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LabPlanClient struct { Client *resourcemanager.Client } -func NewLabPlanClientWithBaseURI(api environments.Api) (*LabPlanClient, error) { +func NewLabPlanClientWithBaseURI(api sdkEnv.Api) (*LabPlanClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "labplan", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LabPlanClient: %+v", err) diff --git a/resource-manager/labservices/2021-10-01-preview/schedule/client.go b/resource-manager/labservices/2021-10-01-preview/schedule/client.go index 60e00b447ce..1c5441b1037 100644 --- a/resource-manager/labservices/2021-10-01-preview/schedule/client.go +++ b/resource-manager/labservices/2021-10-01-preview/schedule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScheduleClient struct { Client *resourcemanager.Client } -func NewScheduleClientWithBaseURI(api environments.Api) (*ScheduleClient, error) { +func NewScheduleClientWithBaseURI(api sdkEnv.Api) (*ScheduleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "schedule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScheduleClient: %+v", err) diff --git a/resource-manager/labservices/2021-10-01-preview/user/client.go b/resource-manager/labservices/2021-10-01-preview/user/client.go index 68cdf855892..35a8027a782 100644 --- a/resource-manager/labservices/2021-10-01-preview/user/client.go +++ b/resource-manager/labservices/2021-10-01-preview/user/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UserClient struct { Client *resourcemanager.Client } -func NewUserClientWithBaseURI(api environments.Api) (*UserClient, error) { +func NewUserClientWithBaseURI(api sdkEnv.Api) (*UserClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "user", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UserClient: %+v", err) diff --git a/resource-manager/labservices/2021-10-01-preview/virtualmachine/client.go b/resource-manager/labservices/2021-10-01-preview/virtualmachine/client.go index b57c424fe32..1f4cf22b5fc 100644 --- a/resource-manager/labservices/2021-10-01-preview/virtualmachine/client.go +++ b/resource-manager/labservices/2021-10-01-preview/virtualmachine/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualMachineClient struct { Client *resourcemanager.Client } -func NewVirtualMachineClientWithBaseURI(api environments.Api) (*VirtualMachineClient, error) { +func NewVirtualMachineClientWithBaseURI(api sdkEnv.Api) (*VirtualMachineClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualmachine", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualMachineClient: %+v", err) diff --git a/resource-manager/labservices/2022-08-01/client.go b/resource-manager/labservices/2022-08-01/client.go index 0f6936c272e..44466ecad67 100644 --- a/resource-manager/labservices/2022-08-01/client.go +++ b/resource-manager/labservices/2022-08-01/client.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/user" "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/virtualmachine" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -29,7 +29,7 @@ type Client struct { VirtualMachine *virtualmachine.VirtualMachineClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { imageClient, err := image.NewImageClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Image client: %+v", err) diff --git a/resource-manager/labservices/2022-08-01/image/client.go b/resource-manager/labservices/2022-08-01/image/client.go index d016d4d62ab..27e868eb89e 100644 --- a/resource-manager/labservices/2022-08-01/image/client.go +++ b/resource-manager/labservices/2022-08-01/image/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ImageClient struct { Client *resourcemanager.Client } -func NewImageClientWithBaseURI(api environments.Api) (*ImageClient, error) { +func NewImageClientWithBaseURI(api sdkEnv.Api) (*ImageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "image", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ImageClient: %+v", err) diff --git a/resource-manager/labservices/2022-08-01/lab/client.go b/resource-manager/labservices/2022-08-01/lab/client.go index de930587f66..14158f88532 100644 --- a/resource-manager/labservices/2022-08-01/lab/client.go +++ b/resource-manager/labservices/2022-08-01/lab/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LabClient struct { Client *resourcemanager.Client } -func NewLabClientWithBaseURI(api environments.Api) (*LabClient, error) { +func NewLabClientWithBaseURI(api sdkEnv.Api) (*LabClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "lab", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LabClient: %+v", err) diff --git a/resource-manager/labservices/2022-08-01/labplan/client.go b/resource-manager/labservices/2022-08-01/labplan/client.go index c2fe664f0d4..10612fa4074 100644 --- a/resource-manager/labservices/2022-08-01/labplan/client.go +++ b/resource-manager/labservices/2022-08-01/labplan/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LabPlanClient struct { Client *resourcemanager.Client } -func NewLabPlanClientWithBaseURI(api environments.Api) (*LabPlanClient, error) { +func NewLabPlanClientWithBaseURI(api sdkEnv.Api) (*LabPlanClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "labplan", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LabPlanClient: %+v", err) diff --git a/resource-manager/labservices/2022-08-01/schedule/client.go b/resource-manager/labservices/2022-08-01/schedule/client.go index 60e00b447ce..1c5441b1037 100644 --- a/resource-manager/labservices/2022-08-01/schedule/client.go +++ b/resource-manager/labservices/2022-08-01/schedule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScheduleClient struct { Client *resourcemanager.Client } -func NewScheduleClientWithBaseURI(api environments.Api) (*ScheduleClient, error) { +func NewScheduleClientWithBaseURI(api sdkEnv.Api) (*ScheduleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "schedule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScheduleClient: %+v", err) diff --git a/resource-manager/labservices/2022-08-01/skus/client.go b/resource-manager/labservices/2022-08-01/skus/client.go index a561bc4ec71..ee82463b163 100644 --- a/resource-manager/labservices/2022-08-01/skus/client.go +++ b/resource-manager/labservices/2022-08-01/skus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SkusClient struct { Client *resourcemanager.Client } -func NewSkusClientWithBaseURI(api environments.Api) (*SkusClient, error) { +func NewSkusClientWithBaseURI(api sdkEnv.Api) (*SkusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "skus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SkusClient: %+v", err) diff --git a/resource-manager/labservices/2022-08-01/usages/client.go b/resource-manager/labservices/2022-08-01/usages/client.go index 99b2625224d..9319b1a1f51 100644 --- a/resource-manager/labservices/2022-08-01/usages/client.go +++ b/resource-manager/labservices/2022-08-01/usages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsagesClient struct { Client *resourcemanager.Client } -func NewUsagesClientWithBaseURI(api environments.Api) (*UsagesClient, error) { +func NewUsagesClientWithBaseURI(api sdkEnv.Api) (*UsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsagesClient: %+v", err) diff --git a/resource-manager/labservices/2022-08-01/user/client.go b/resource-manager/labservices/2022-08-01/user/client.go index 68cdf855892..35a8027a782 100644 --- a/resource-manager/labservices/2022-08-01/user/client.go +++ b/resource-manager/labservices/2022-08-01/user/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UserClient struct { Client *resourcemanager.Client } -func NewUserClientWithBaseURI(api environments.Api) (*UserClient, error) { +func NewUserClientWithBaseURI(api sdkEnv.Api) (*UserClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "user", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UserClient: %+v", err) diff --git a/resource-manager/labservices/2022-08-01/virtualmachine/client.go b/resource-manager/labservices/2022-08-01/virtualmachine/client.go index b57c424fe32..1f4cf22b5fc 100644 --- a/resource-manager/labservices/2022-08-01/virtualmachine/client.go +++ b/resource-manager/labservices/2022-08-01/virtualmachine/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualMachineClient struct { Client *resourcemanager.Client } -func NewVirtualMachineClientWithBaseURI(api environments.Api) (*VirtualMachineClient, error) { +func NewVirtualMachineClientWithBaseURI(api sdkEnv.Api) (*VirtualMachineClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualmachine", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualMachineClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/client.go b/resource-manager/logic/2019-05-01/client.go index 12f397baf20..9e80d4afb37 100644 --- a/resource-manager/logic/2019-05-01/client.go +++ b/resource-manager/logic/2019-05-01/client.go @@ -29,7 +29,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers" "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowversions" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -57,7 +57,7 @@ type Client struct { Workflows *workflows.WorkflowsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { integrationAccountAgreementsClient, err := integrationaccountagreements.NewIntegrationAccountAgreementsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building IntegrationAccountAgreements client: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationaccountagreements/client.go b/resource-manager/logic/2019-05-01/integrationaccountagreements/client.go index 5befc3eb810..d31de4b5683 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountagreements/client.go +++ b/resource-manager/logic/2019-05-01/integrationaccountagreements/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationAccountAgreementsClient struct { Client *resourcemanager.Client } -func NewIntegrationAccountAgreementsClientWithBaseURI(api environments.Api) (*IntegrationAccountAgreementsClient, error) { +func NewIntegrationAccountAgreementsClientWithBaseURI(api sdkEnv.Api) (*IntegrationAccountAgreementsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationaccountagreements", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationAccountAgreementsClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationaccountassemblies/client.go b/resource-manager/logic/2019-05-01/integrationaccountassemblies/client.go index fb50d348e43..c7986e10b8b 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountassemblies/client.go +++ b/resource-manager/logic/2019-05-01/integrationaccountassemblies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationAccountAssembliesClient struct { Client *resourcemanager.Client } -func NewIntegrationAccountAssembliesClientWithBaseURI(api environments.Api) (*IntegrationAccountAssembliesClient, error) { +func NewIntegrationAccountAssembliesClientWithBaseURI(api sdkEnv.Api) (*IntegrationAccountAssembliesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationaccountassemblies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationAccountAssembliesClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/client.go b/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/client.go index ffeca987349..6bfab1a5e66 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/client.go +++ b/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationAccountBatchConfigurationsClient struct { Client *resourcemanager.Client } -func NewIntegrationAccountBatchConfigurationsClientWithBaseURI(api environments.Api) (*IntegrationAccountBatchConfigurationsClient, error) { +func NewIntegrationAccountBatchConfigurationsClientWithBaseURI(api sdkEnv.Api) (*IntegrationAccountBatchConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationaccountbatchconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationAccountBatchConfigurationsClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationaccountcertificates/client.go b/resource-manager/logic/2019-05-01/integrationaccountcertificates/client.go index 6ca45e0ac62..3f1b4ac57a5 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountcertificates/client.go +++ b/resource-manager/logic/2019-05-01/integrationaccountcertificates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationAccountCertificatesClient struct { Client *resourcemanager.Client } -func NewIntegrationAccountCertificatesClientWithBaseURI(api environments.Api) (*IntegrationAccountCertificatesClient, error) { +func NewIntegrationAccountCertificatesClientWithBaseURI(api sdkEnv.Api) (*IntegrationAccountCertificatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationaccountcertificates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationAccountCertificatesClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationaccountmaps/client.go b/resource-manager/logic/2019-05-01/integrationaccountmaps/client.go index bbddc56748e..b67cf2f01a0 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountmaps/client.go +++ b/resource-manager/logic/2019-05-01/integrationaccountmaps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationAccountMapsClient struct { Client *resourcemanager.Client } -func NewIntegrationAccountMapsClientWithBaseURI(api environments.Api) (*IntegrationAccountMapsClient, error) { +func NewIntegrationAccountMapsClientWithBaseURI(api sdkEnv.Api) (*IntegrationAccountMapsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationaccountmaps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationAccountMapsClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationaccountpartners/client.go b/resource-manager/logic/2019-05-01/integrationaccountpartners/client.go index 4d8a11ea7b5..ade0a6c7435 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountpartners/client.go +++ b/resource-manager/logic/2019-05-01/integrationaccountpartners/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationAccountPartnersClient struct { Client *resourcemanager.Client } -func NewIntegrationAccountPartnersClientWithBaseURI(api environments.Api) (*IntegrationAccountPartnersClient, error) { +func NewIntegrationAccountPartnersClientWithBaseURI(api sdkEnv.Api) (*IntegrationAccountPartnersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationaccountpartners", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationAccountPartnersClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationaccounts/client.go b/resource-manager/logic/2019-05-01/integrationaccounts/client.go index adf44f3de5a..dbc0b50f822 100644 --- a/resource-manager/logic/2019-05-01/integrationaccounts/client.go +++ b/resource-manager/logic/2019-05-01/integrationaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationAccountsClient struct { Client *resourcemanager.Client } -func NewIntegrationAccountsClientWithBaseURI(api environments.Api) (*IntegrationAccountsClient, error) { +func NewIntegrationAccountsClientWithBaseURI(api sdkEnv.Api) (*IntegrationAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationAccountsClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationaccountschemas/client.go b/resource-manager/logic/2019-05-01/integrationaccountschemas/client.go index 3e761e85785..745b9f0767e 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountschemas/client.go +++ b/resource-manager/logic/2019-05-01/integrationaccountschemas/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationAccountSchemasClient struct { Client *resourcemanager.Client } -func NewIntegrationAccountSchemasClientWithBaseURI(api environments.Api) (*IntegrationAccountSchemasClient, error) { +func NewIntegrationAccountSchemasClientWithBaseURI(api sdkEnv.Api) (*IntegrationAccountSchemasClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationaccountschemas", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationAccountSchemasClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationaccountsessions/client.go b/resource-manager/logic/2019-05-01/integrationaccountsessions/client.go index 465acd7d6da..9e48b9be86c 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountsessions/client.go +++ b/resource-manager/logic/2019-05-01/integrationaccountsessions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationAccountSessionsClient struct { Client *resourcemanager.Client } -func NewIntegrationAccountSessionsClientWithBaseURI(api environments.Api) (*IntegrationAccountSessionsClient, error) { +func NewIntegrationAccountSessionsClientWithBaseURI(api sdkEnv.Api) (*IntegrationAccountSessionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationaccountsessions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationAccountSessionsClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapi/client.go b/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapi/client.go index 5f4f0bbb0bc..cd624a39642 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapi/client.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapi/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationServiceEnvironmentManagedApiClient struct { Client *resourcemanager.Client } -func NewIntegrationServiceEnvironmentManagedApiClientWithBaseURI(api environments.Api) (*IntegrationServiceEnvironmentManagedApiClient, error) { +func NewIntegrationServiceEnvironmentManagedApiClientWithBaseURI(api sdkEnv.Api) (*IntegrationServiceEnvironmentManagedApiClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationserviceenvironmentmanagedapi", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationServiceEnvironmentManagedApiClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/client.go b/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/client.go index 6437d3a8a87..3df6bf64cbc 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/client.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationServiceEnvironmentManagedApisClient struct { Client *resourcemanager.Client } -func NewIntegrationServiceEnvironmentManagedApisClientWithBaseURI(api environments.Api) (*IntegrationServiceEnvironmentManagedApisClient, error) { +func NewIntegrationServiceEnvironmentManagedApisClientWithBaseURI(api sdkEnv.Api) (*IntegrationServiceEnvironmentManagedApisClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationserviceenvironmentmanagedapis", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationServiceEnvironmentManagedApisClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironmentnetworkhealth/client.go b/resource-manager/logic/2019-05-01/integrationserviceenvironmentnetworkhealth/client.go index a263c695b86..bedb86538f0 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironmentnetworkhealth/client.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironmentnetworkhealth/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationServiceEnvironmentNetworkHealthClient struct { Client *resourcemanager.Client } -func NewIntegrationServiceEnvironmentNetworkHealthClientWithBaseURI(api environments.Api) (*IntegrationServiceEnvironmentNetworkHealthClient, error) { +func NewIntegrationServiceEnvironmentNetworkHealthClientWithBaseURI(api sdkEnv.Api) (*IntegrationServiceEnvironmentNetworkHealthClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationserviceenvironmentnetworkhealth", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationServiceEnvironmentNetworkHealthClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironmentrestart/client.go b/resource-manager/logic/2019-05-01/integrationserviceenvironmentrestart/client.go index 65c0bbb3eae..5f1b56c3913 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironmentrestart/client.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironmentrestart/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationServiceEnvironmentRestartClient struct { Client *resourcemanager.Client } -func NewIntegrationServiceEnvironmentRestartClientWithBaseURI(api environments.Api) (*IntegrationServiceEnvironmentRestartClient, error) { +func NewIntegrationServiceEnvironmentRestartClientWithBaseURI(api sdkEnv.Api) (*IntegrationServiceEnvironmentRestartClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationserviceenvironmentrestart", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationServiceEnvironmentRestartClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironments/client.go b/resource-manager/logic/2019-05-01/integrationserviceenvironments/client.go index 44774305b0c..e927e85145f 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironments/client.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationServiceEnvironmentsClient struct { Client *resourcemanager.Client } -func NewIntegrationServiceEnvironmentsClientWithBaseURI(api environments.Api) (*IntegrationServiceEnvironmentsClient, error) { +func NewIntegrationServiceEnvironmentsClientWithBaseURI(api sdkEnv.Api) (*IntegrationServiceEnvironmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationserviceenvironments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationServiceEnvironmentsClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironmentskus/client.go b/resource-manager/logic/2019-05-01/integrationserviceenvironmentskus/client.go index 987b23a28b2..ea69139a348 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironmentskus/client.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironmentskus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IntegrationServiceEnvironmentSkusClient struct { Client *resourcemanager.Client } -func NewIntegrationServiceEnvironmentSkusClientWithBaseURI(api environments.Api) (*IntegrationServiceEnvironmentSkusClient, error) { +func NewIntegrationServiceEnvironmentSkusClientWithBaseURI(api sdkEnv.Api) (*IntegrationServiceEnvironmentSkusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "integrationserviceenvironmentskus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IntegrationServiceEnvironmentSkusClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/workflowrunactions/client.go b/resource-manager/logic/2019-05-01/workflowrunactions/client.go index b831f4e826e..499879042af 100644 --- a/resource-manager/logic/2019-05-01/workflowrunactions/client.go +++ b/resource-manager/logic/2019-05-01/workflowrunactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowRunActionsClient struct { Client *resourcemanager.Client } -func NewWorkflowRunActionsClientWithBaseURI(api environments.Api) (*WorkflowRunActionsClient, error) { +func NewWorkflowRunActionsClientWithBaseURI(api sdkEnv.Api) (*WorkflowRunActionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowrunactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowRunActionsClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/workflowrunoperations/client.go b/resource-manager/logic/2019-05-01/workflowrunoperations/client.go index b71bf834dfd..6d24e775d4c 100644 --- a/resource-manager/logic/2019-05-01/workflowrunoperations/client.go +++ b/resource-manager/logic/2019-05-01/workflowrunoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowRunOperationsClient struct { Client *resourcemanager.Client } -func NewWorkflowRunOperationsClientWithBaseURI(api environments.Api) (*WorkflowRunOperationsClient, error) { +func NewWorkflowRunOperationsClientWithBaseURI(api sdkEnv.Api) (*WorkflowRunOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowrunoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowRunOperationsClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/workflowruns/client.go b/resource-manager/logic/2019-05-01/workflowruns/client.go index 43b565b2cd6..92e78dac372 100644 --- a/resource-manager/logic/2019-05-01/workflowruns/client.go +++ b/resource-manager/logic/2019-05-01/workflowruns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowRunsClient struct { Client *resourcemanager.Client } -func NewWorkflowRunsClientWithBaseURI(api environments.Api) (*WorkflowRunsClient, error) { +func NewWorkflowRunsClientWithBaseURI(api sdkEnv.Api) (*WorkflowRunsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowruns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowRunsClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/workflows/client.go b/resource-manager/logic/2019-05-01/workflows/client.go index b86cd23219c..90fe462cb29 100644 --- a/resource-manager/logic/2019-05-01/workflows/client.go +++ b/resource-manager/logic/2019-05-01/workflows/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowsClient struct { Client *resourcemanager.Client } -func NewWorkflowsClientWithBaseURI(api environments.Api) (*WorkflowsClient, error) { +func NewWorkflowsClientWithBaseURI(api sdkEnv.Api) (*WorkflowsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflows", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowsClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/workflowtriggerhistories/client.go b/resource-manager/logic/2019-05-01/workflowtriggerhistories/client.go index 2616be06d78..8cf7ef3f4a1 100644 --- a/resource-manager/logic/2019-05-01/workflowtriggerhistories/client.go +++ b/resource-manager/logic/2019-05-01/workflowtriggerhistories/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowTriggerHistoriesClient struct { Client *resourcemanager.Client } -func NewWorkflowTriggerHistoriesClientWithBaseURI(api environments.Api) (*WorkflowTriggerHistoriesClient, error) { +func NewWorkflowTriggerHistoriesClientWithBaseURI(api sdkEnv.Api) (*WorkflowTriggerHistoriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowtriggerhistories", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowTriggerHistoriesClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/workflowtriggers/client.go b/resource-manager/logic/2019-05-01/workflowtriggers/client.go index b3c445df3bd..6cbb113de0c 100644 --- a/resource-manager/logic/2019-05-01/workflowtriggers/client.go +++ b/resource-manager/logic/2019-05-01/workflowtriggers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowTriggersClient struct { Client *resourcemanager.Client } -func NewWorkflowTriggersClientWithBaseURI(api environments.Api) (*WorkflowTriggersClient, error) { +func NewWorkflowTriggersClientWithBaseURI(api sdkEnv.Api) (*WorkflowTriggersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowtriggers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowTriggersClient: %+v", err) diff --git a/resource-manager/logic/2019-05-01/workflowversions/client.go b/resource-manager/logic/2019-05-01/workflowversions/client.go index 1e35b4c3284..9eb461a2018 100644 --- a/resource-manager/logic/2019-05-01/workflowversions/client.go +++ b/resource-manager/logic/2019-05-01/workflowversions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowVersionsClient struct { Client *resourcemanager.Client } -func NewWorkflowVersionsClientWithBaseURI(api environments.Api) (*WorkflowVersionsClient, error) { +func NewWorkflowVersionsClientWithBaseURI(api sdkEnv.Api) (*WorkflowVersionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowversions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowVersionsClient: %+v", err) diff --git a/resource-manager/logz/2020-10-01/client.go b/resource-manager/logz/2020-10-01/client.go index 956cdc06085..eaa8d25027a 100644 --- a/resource-manager/logz/2020-10-01/client.go +++ b/resource-manager/logz/2020-10-01/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/logz/2020-10-01/tagrules" "github.com/hashicorp/go-azure-sdk/resource-manager/logz/2020-10-01/vmhost" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { VMHost *vmhost.VMHostClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { monitorsClient, err := monitors.NewMonitorsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Monitors client: %+v", err) diff --git a/resource-manager/logz/2020-10-01/monitors/client.go b/resource-manager/logz/2020-10-01/monitors/client.go index 43af4ffbb85..f7c2a7b5509 100644 --- a/resource-manager/logz/2020-10-01/monitors/client.go +++ b/resource-manager/logz/2020-10-01/monitors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitorsClient struct { Client *resourcemanager.Client } -func NewMonitorsClientWithBaseURI(api environments.Api) (*MonitorsClient, error) { +func NewMonitorsClientWithBaseURI(api sdkEnv.Api) (*MonitorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitorsClient: %+v", err) diff --git a/resource-manager/logz/2020-10-01/singlesignon/client.go b/resource-manager/logz/2020-10-01/singlesignon/client.go index b37a7e2692a..ecca8e4d537 100644 --- a/resource-manager/logz/2020-10-01/singlesignon/client.go +++ b/resource-manager/logz/2020-10-01/singlesignon/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SingleSignOnClient struct { Client *resourcemanager.Client } -func NewSingleSignOnClientWithBaseURI(api environments.Api) (*SingleSignOnClient, error) { +func NewSingleSignOnClientWithBaseURI(api sdkEnv.Api) (*SingleSignOnClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "singlesignon", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SingleSignOnClient: %+v", err) diff --git a/resource-manager/logz/2020-10-01/subaccount/client.go b/resource-manager/logz/2020-10-01/subaccount/client.go index d7e52fd07b1..da1d71f2dfe 100644 --- a/resource-manager/logz/2020-10-01/subaccount/client.go +++ b/resource-manager/logz/2020-10-01/subaccount/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SubAccountClient struct { Client *resourcemanager.Client } -func NewSubAccountClientWithBaseURI(api environments.Api) (*SubAccountClient, error) { +func NewSubAccountClientWithBaseURI(api sdkEnv.Api) (*SubAccountClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "subaccount", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SubAccountClient: %+v", err) diff --git a/resource-manager/logz/2020-10-01/tagrules/client.go b/resource-manager/logz/2020-10-01/tagrules/client.go index 6269a50dd72..ea7b43d3df4 100644 --- a/resource-manager/logz/2020-10-01/tagrules/client.go +++ b/resource-manager/logz/2020-10-01/tagrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TagRulesClient struct { Client *resourcemanager.Client } -func NewTagRulesClientWithBaseURI(api environments.Api) (*TagRulesClient, error) { +func NewTagRulesClientWithBaseURI(api sdkEnv.Api) (*TagRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tagrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TagRulesClient: %+v", err) diff --git a/resource-manager/logz/2020-10-01/vmhost/client.go b/resource-manager/logz/2020-10-01/vmhost/client.go index 3fe855c48a4..08a8bd1bbf8 100644 --- a/resource-manager/logz/2020-10-01/vmhost/client.go +++ b/resource-manager/logz/2020-10-01/vmhost/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VMHostClient struct { Client *resourcemanager.Client } -func NewVMHostClientWithBaseURI(api environments.Api) (*VMHostClient, error) { +func NewVMHostClientWithBaseURI(api sdkEnv.Api) (*VMHostClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vmhost", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VMHostClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/batchdeployment/client.go b/resource-manager/machinelearningservices/2022-05-01/batchdeployment/client.go index 053d3461055..65a1baedfa1 100644 --- a/resource-manager/machinelearningservices/2022-05-01/batchdeployment/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/batchdeployment/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BatchDeploymentClient struct { Client *resourcemanager.Client } -func NewBatchDeploymentClientWithBaseURI(api environments.Api) (*BatchDeploymentClient, error) { +func NewBatchDeploymentClientWithBaseURI(api sdkEnv.Api) (*BatchDeploymentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "batchdeployment", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BatchDeploymentClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/batchendpoint/client.go b/resource-manager/machinelearningservices/2022-05-01/batchendpoint/client.go index a1c736289df..eff3d679c82 100644 --- a/resource-manager/machinelearningservices/2022-05-01/batchendpoint/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/batchendpoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BatchEndpointClient struct { Client *resourcemanager.Client } -func NewBatchEndpointClientWithBaseURI(api environments.Api) (*BatchEndpointClient, error) { +func NewBatchEndpointClientWithBaseURI(api sdkEnv.Api) (*BatchEndpointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "batchendpoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BatchEndpointClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/client.go b/resource-manager/machinelearningservices/2022-05-01/client.go index 529bcd8585b..160701937a1 100644 --- a/resource-manager/machinelearningservices/2022-05-01/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/client.go @@ -34,7 +34,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/workspaceprivatelinkresources" "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/workspaces" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -67,7 +67,7 @@ type Client struct { Workspaces *workspaces.WorkspacesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { batchDeploymentClient, err := batchdeployment.NewBatchDeploymentClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building BatchDeployment client: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/codecontainer/client.go b/resource-manager/machinelearningservices/2022-05-01/codecontainer/client.go index cc996888ad7..6e6178fd0ec 100644 --- a/resource-manager/machinelearningservices/2022-05-01/codecontainer/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/codecontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CodeContainerClient struct { Client *resourcemanager.Client } -func NewCodeContainerClientWithBaseURI(api environments.Api) (*CodeContainerClient, error) { +func NewCodeContainerClientWithBaseURI(api sdkEnv.Api) (*CodeContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "codecontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CodeContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/codeversion/client.go b/resource-manager/machinelearningservices/2022-05-01/codeversion/client.go index 4aae9e3f55e..bb5cb4e5267 100644 --- a/resource-manager/machinelearningservices/2022-05-01/codeversion/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/codeversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CodeVersionClient struct { Client *resourcemanager.Client } -func NewCodeVersionClientWithBaseURI(api environments.Api) (*CodeVersionClient, error) { +func NewCodeVersionClientWithBaseURI(api sdkEnv.Api) (*CodeVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "codeversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CodeVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/componentcontainer/client.go b/resource-manager/machinelearningservices/2022-05-01/componentcontainer/client.go index a09869f4a6f..b09970ea4b3 100644 --- a/resource-manager/machinelearningservices/2022-05-01/componentcontainer/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/componentcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ComponentContainerClient struct { Client *resourcemanager.Client } -func NewComponentContainerClientWithBaseURI(api environments.Api) (*ComponentContainerClient, error) { +func NewComponentContainerClientWithBaseURI(api sdkEnv.Api) (*ComponentContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "componentcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ComponentContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/componentversion/client.go b/resource-manager/machinelearningservices/2022-05-01/componentversion/client.go index 1a0ac1d57fe..d54cf6bae82 100644 --- a/resource-manager/machinelearningservices/2022-05-01/componentversion/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/componentversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ComponentVersionClient struct { Client *resourcemanager.Client } -func NewComponentVersionClientWithBaseURI(api environments.Api) (*ComponentVersionClient, error) { +func NewComponentVersionClientWithBaseURI(api sdkEnv.Api) (*ComponentVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "componentversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ComponentVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/datacontainer/client.go b/resource-manager/machinelearningservices/2022-05-01/datacontainer/client.go index f417a8eca60..3e0b04d4317 100644 --- a/resource-manager/machinelearningservices/2022-05-01/datacontainer/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/datacontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataContainerClient struct { Client *resourcemanager.Client } -func NewDataContainerClientWithBaseURI(api environments.Api) (*DataContainerClient, error) { +func NewDataContainerClientWithBaseURI(api sdkEnv.Api) (*DataContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datacontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/datastore/client.go b/resource-manager/machinelearningservices/2022-05-01/datastore/client.go index f62478cb7b5..7d4e687bd84 100644 --- a/resource-manager/machinelearningservices/2022-05-01/datastore/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/datastore/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatastoreClient struct { Client *resourcemanager.Client } -func NewDatastoreClientWithBaseURI(api environments.Api) (*DatastoreClient, error) { +func NewDatastoreClientWithBaseURI(api sdkEnv.Api) (*DatastoreClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datastore", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatastoreClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/dataversion/client.go b/resource-manager/machinelearningservices/2022-05-01/dataversion/client.go index 982d81471bd..c618ca4c36e 100644 --- a/resource-manager/machinelearningservices/2022-05-01/dataversion/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/dataversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataVersionClient struct { Client *resourcemanager.Client } -func NewDataVersionClientWithBaseURI(api environments.Api) (*DataVersionClient, error) { +func NewDataVersionClientWithBaseURI(api sdkEnv.Api) (*DataVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dataversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/client.go b/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/client.go index 795a372bdbe..7236df1890c 100644 --- a/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EnvironmentContainerClient struct { Client *resourcemanager.Client } -func NewEnvironmentContainerClientWithBaseURI(api environments.Api) (*EnvironmentContainerClient, error) { +func NewEnvironmentContainerClientWithBaseURI(api sdkEnv.Api) (*EnvironmentContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "environmentcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EnvironmentContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/environmentversion/client.go b/resource-manager/machinelearningservices/2022-05-01/environmentversion/client.go index a546aae9f80..3c9dbc919da 100644 --- a/resource-manager/machinelearningservices/2022-05-01/environmentversion/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/environmentversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EnvironmentVersionClient struct { Client *resourcemanager.Client } -func NewEnvironmentVersionClientWithBaseURI(api environments.Api) (*EnvironmentVersionClient, error) { +func NewEnvironmentVersionClientWithBaseURI(api sdkEnv.Api) (*EnvironmentVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "environmentversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EnvironmentVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/job/client.go b/resource-manager/machinelearningservices/2022-05-01/job/client.go index 9c1aeead52a..9e0840550db 100644 --- a/resource-manager/machinelearningservices/2022-05-01/job/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/job/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobClient struct { Client *resourcemanager.Client } -func NewJobClientWithBaseURI(api environments.Api) (*JobClient, error) { +func NewJobClientWithBaseURI(api sdkEnv.Api) (*JobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "job", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/client.go b/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/client.go index 098bcd90b56..730f268418e 100644 --- a/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MachineLearningComputesClient struct { Client *resourcemanager.Client } -func NewMachineLearningComputesClientWithBaseURI(api environments.Api) (*MachineLearningComputesClient, error) { +func NewMachineLearningComputesClientWithBaseURI(api sdkEnv.Api) (*MachineLearningComputesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "machinelearningcomputes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MachineLearningComputesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/modelcontainer/client.go b/resource-manager/machinelearningservices/2022-05-01/modelcontainer/client.go index a8ac27a7661..52c90954dc4 100644 --- a/resource-manager/machinelearningservices/2022-05-01/modelcontainer/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/modelcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ModelContainerClient struct { Client *resourcemanager.Client } -func NewModelContainerClientWithBaseURI(api environments.Api) (*ModelContainerClient, error) { +func NewModelContainerClientWithBaseURI(api sdkEnv.Api) (*ModelContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "modelcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ModelContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/modelversion/client.go b/resource-manager/machinelearningservices/2022-05-01/modelversion/client.go index b098ad5eea2..de5ed06eecc 100644 --- a/resource-manager/machinelearningservices/2022-05-01/modelversion/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/modelversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ModelVersionClient struct { Client *resourcemanager.Client } -func NewModelVersionClientWithBaseURI(api environments.Api) (*ModelVersionClient, error) { +func NewModelVersionClientWithBaseURI(api sdkEnv.Api) (*ModelVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "modelversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ModelVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/client.go b/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/client.go index 09ce38fc879..4c0028cd8d2 100644 --- a/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OnlineDeploymentClient struct { Client *resourcemanager.Client } -func NewOnlineDeploymentClientWithBaseURI(api environments.Api) (*OnlineDeploymentClient, error) { +func NewOnlineDeploymentClientWithBaseURI(api sdkEnv.Api) (*OnlineDeploymentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "onlinedeployment", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OnlineDeploymentClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/client.go b/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/client.go index df10facee89..7bf581709ee 100644 --- a/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OnlineEndpointClient struct { Client *resourcemanager.Client } -func NewOnlineEndpointClientWithBaseURI(api environments.Api) (*OnlineEndpointClient, error) { +func NewOnlineEndpointClientWithBaseURI(api sdkEnv.Api) (*OnlineEndpointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "onlineendpoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OnlineEndpointClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/client.go b/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/client.go index d169047374b..68f2fb8b517 100644 --- a/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationalizationClustersClient struct { Client *resourcemanager.Client } -func NewOperationalizationClustersClientWithBaseURI(api environments.Api) (*OperationalizationClustersClient, error) { +func NewOperationalizationClustersClientWithBaseURI(api sdkEnv.Api) (*OperationalizationClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operationalizationclusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationalizationClustersClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/outboundnetworkdependenciesendpoints/client.go b/resource-manager/machinelearningservices/2022-05-01/outboundnetworkdependenciesendpoints/client.go index bdf407b2056..a9777dea6e6 100644 --- a/resource-manager/machinelearningservices/2022-05-01/outboundnetworkdependenciesendpoints/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/outboundnetworkdependenciesendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OutboundNetworkDependenciesEndpointsClient struct { Client *resourcemanager.Client } -func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api environments.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { +func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api sdkEnv.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "outboundnetworkdependenciesendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OutboundNetworkDependenciesEndpointsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/privateendpointconnections/client.go b/resource-manager/machinelearningservices/2022-05-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/machinelearningservices/2022-05-01/privateendpointconnections/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/proxyoperations/client.go b/resource-manager/machinelearningservices/2022-05-01/proxyoperations/client.go index 05defcf36b7..970bacaf3ba 100644 --- a/resource-manager/machinelearningservices/2022-05-01/proxyoperations/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/proxyoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProxyOperationsClient struct { Client *resourcemanager.Client } -func NewProxyOperationsClientWithBaseURI(api environments.Api) (*ProxyOperationsClient, error) { +func NewProxyOperationsClientWithBaseURI(api sdkEnv.Api) (*ProxyOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "proxyoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProxyOperationsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/quota/client.go b/resource-manager/machinelearningservices/2022-05-01/quota/client.go index c77adeece22..b970bd78219 100644 --- a/resource-manager/machinelearningservices/2022-05-01/quota/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/quota/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QuotaClient struct { Client *resourcemanager.Client } -func NewQuotaClientWithBaseURI(api environments.Api) (*QuotaClient, error) { +func NewQuotaClientWithBaseURI(api sdkEnv.Api) (*QuotaClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "quota", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QuotaClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/client.go b/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/client.go index e401fd166f9..0da5bb9346d 100644 --- a/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type V2WorkspaceConnectionResourceClient struct { Client *resourcemanager.Client } -func NewV2WorkspaceConnectionResourceClientWithBaseURI(api environments.Api) (*V2WorkspaceConnectionResourceClient, error) { +func NewV2WorkspaceConnectionResourceClientWithBaseURI(api sdkEnv.Api) (*V2WorkspaceConnectionResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "v2workspaceconnectionresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating V2WorkspaceConnectionResourceClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/virtualmachinesizes/client.go b/resource-manager/machinelearningservices/2022-05-01/virtualmachinesizes/client.go index f2a83cfb4c9..0b592f66ddc 100644 --- a/resource-manager/machinelearningservices/2022-05-01/virtualmachinesizes/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/virtualmachinesizes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualMachineSizesClient struct { Client *resourcemanager.Client } -func NewVirtualMachineSizesClientWithBaseURI(api environments.Api) (*VirtualMachineSizesClient, error) { +func NewVirtualMachineSizesClientWithBaseURI(api sdkEnv.Api) (*VirtualMachineSizesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualmachinesizes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualMachineSizesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/workspaceprivateendpointconnections/client.go b/resource-manager/machinelearningservices/2022-05-01/workspaceprivateendpointconnections/client.go index 584fd609d85..3f9d225e74b 100644 --- a/resource-manager/machinelearningservices/2022-05-01/workspaceprivateendpointconnections/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/workspaceprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { +func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/workspaceprivatelinkresources/client.go b/resource-manager/machinelearningservices/2022-05-01/workspaceprivatelinkresources/client.go index b5b7cfe9b1c..bc6558ba9f8 100644 --- a/resource-manager/machinelearningservices/2022-05-01/workspaceprivatelinkresources/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/workspaceprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api environments.Api) (*WorkspacePrivateLinkResourcesClient, error) { +func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-05-01/workspaces/client.go b/resource-manager/machinelearningservices/2022-05-01/workspaces/client.go index bf91cd2dee7..868fd830b2a 100644 --- a/resource-manager/machinelearningservices/2022-05-01/workspaces/client.go +++ b/resource-manager/machinelearningservices/2022-05-01/workspaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacesClient struct { Client *resourcemanager.Client } -func NewWorkspacesClientWithBaseURI(api environments.Api) (*WorkspacesClient, error) { +func NewWorkspacesClientWithBaseURI(api sdkEnv.Api) (*WorkspacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/batchdeployment/client.go b/resource-manager/machinelearningservices/2022-10-01/batchdeployment/client.go index 053d3461055..65a1baedfa1 100644 --- a/resource-manager/machinelearningservices/2022-10-01/batchdeployment/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/batchdeployment/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BatchDeploymentClient struct { Client *resourcemanager.Client } -func NewBatchDeploymentClientWithBaseURI(api environments.Api) (*BatchDeploymentClient, error) { +func NewBatchDeploymentClientWithBaseURI(api sdkEnv.Api) (*BatchDeploymentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "batchdeployment", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BatchDeploymentClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/batchendpoint/client.go b/resource-manager/machinelearningservices/2022-10-01/batchendpoint/client.go index a1c736289df..eff3d679c82 100644 --- a/resource-manager/machinelearningservices/2022-10-01/batchendpoint/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/batchendpoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BatchEndpointClient struct { Client *resourcemanager.Client } -func NewBatchEndpointClientWithBaseURI(api environments.Api) (*BatchEndpointClient, error) { +func NewBatchEndpointClientWithBaseURI(api sdkEnv.Api) (*BatchEndpointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "batchendpoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BatchEndpointClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/client.go b/resource-manager/machinelearningservices/2022-10-01/client.go index 505fd4bce59..fa5ba432cf4 100644 --- a/resource-manager/machinelearningservices/2022-10-01/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/client.go @@ -35,7 +35,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-10-01/workspaceprivatelinkresources" "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-10-01/workspaces" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -69,7 +69,7 @@ type Client struct { Workspaces *workspaces.WorkspacesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { batchDeploymentClient, err := batchdeployment.NewBatchDeploymentClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building BatchDeployment client: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/codecontainer/client.go b/resource-manager/machinelearningservices/2022-10-01/codecontainer/client.go index cc996888ad7..6e6178fd0ec 100644 --- a/resource-manager/machinelearningservices/2022-10-01/codecontainer/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/codecontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CodeContainerClient struct { Client *resourcemanager.Client } -func NewCodeContainerClientWithBaseURI(api environments.Api) (*CodeContainerClient, error) { +func NewCodeContainerClientWithBaseURI(api sdkEnv.Api) (*CodeContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "codecontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CodeContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/codeversion/client.go b/resource-manager/machinelearningservices/2022-10-01/codeversion/client.go index 4aae9e3f55e..bb5cb4e5267 100644 --- a/resource-manager/machinelearningservices/2022-10-01/codeversion/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/codeversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CodeVersionClient struct { Client *resourcemanager.Client } -func NewCodeVersionClientWithBaseURI(api environments.Api) (*CodeVersionClient, error) { +func NewCodeVersionClientWithBaseURI(api sdkEnv.Api) (*CodeVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "codeversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CodeVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/componentcontainer/client.go b/resource-manager/machinelearningservices/2022-10-01/componentcontainer/client.go index a09869f4a6f..b09970ea4b3 100644 --- a/resource-manager/machinelearningservices/2022-10-01/componentcontainer/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/componentcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ComponentContainerClient struct { Client *resourcemanager.Client } -func NewComponentContainerClientWithBaseURI(api environments.Api) (*ComponentContainerClient, error) { +func NewComponentContainerClientWithBaseURI(api sdkEnv.Api) (*ComponentContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "componentcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ComponentContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/componentversion/client.go b/resource-manager/machinelearningservices/2022-10-01/componentversion/client.go index 1a0ac1d57fe..d54cf6bae82 100644 --- a/resource-manager/machinelearningservices/2022-10-01/componentversion/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/componentversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ComponentVersionClient struct { Client *resourcemanager.Client } -func NewComponentVersionClientWithBaseURI(api environments.Api) (*ComponentVersionClient, error) { +func NewComponentVersionClientWithBaseURI(api sdkEnv.Api) (*ComponentVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "componentversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ComponentVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/datacontainer/client.go b/resource-manager/machinelearningservices/2022-10-01/datacontainer/client.go index f417a8eca60..3e0b04d4317 100644 --- a/resource-manager/machinelearningservices/2022-10-01/datacontainer/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/datacontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataContainerClient struct { Client *resourcemanager.Client } -func NewDataContainerClientWithBaseURI(api environments.Api) (*DataContainerClient, error) { +func NewDataContainerClientWithBaseURI(api sdkEnv.Api) (*DataContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datacontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/datastore/client.go b/resource-manager/machinelearningservices/2022-10-01/datastore/client.go index f62478cb7b5..7d4e687bd84 100644 --- a/resource-manager/machinelearningservices/2022-10-01/datastore/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/datastore/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatastoreClient struct { Client *resourcemanager.Client } -func NewDatastoreClientWithBaseURI(api environments.Api) (*DatastoreClient, error) { +func NewDatastoreClientWithBaseURI(api sdkEnv.Api) (*DatastoreClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datastore", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatastoreClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/dataversion/client.go b/resource-manager/machinelearningservices/2022-10-01/dataversion/client.go index 982d81471bd..c618ca4c36e 100644 --- a/resource-manager/machinelearningservices/2022-10-01/dataversion/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/dataversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataVersionClient struct { Client *resourcemanager.Client } -func NewDataVersionClientWithBaseURI(api environments.Api) (*DataVersionClient, error) { +func NewDataVersionClientWithBaseURI(api sdkEnv.Api) (*DataVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dataversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/client.go b/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/client.go index 795a372bdbe..7236df1890c 100644 --- a/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EnvironmentContainerClient struct { Client *resourcemanager.Client } -func NewEnvironmentContainerClientWithBaseURI(api environments.Api) (*EnvironmentContainerClient, error) { +func NewEnvironmentContainerClientWithBaseURI(api sdkEnv.Api) (*EnvironmentContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "environmentcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EnvironmentContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/environmentversion/client.go b/resource-manager/machinelearningservices/2022-10-01/environmentversion/client.go index a546aae9f80..3c9dbc919da 100644 --- a/resource-manager/machinelearningservices/2022-10-01/environmentversion/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/environmentversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EnvironmentVersionClient struct { Client *resourcemanager.Client } -func NewEnvironmentVersionClientWithBaseURI(api environments.Api) (*EnvironmentVersionClient, error) { +func NewEnvironmentVersionClientWithBaseURI(api sdkEnv.Api) (*EnvironmentVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "environmentversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EnvironmentVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/job/client.go b/resource-manager/machinelearningservices/2022-10-01/job/client.go index 9c1aeead52a..9e0840550db 100644 --- a/resource-manager/machinelearningservices/2022-10-01/job/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/job/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobClient struct { Client *resourcemanager.Client } -func NewJobClientWithBaseURI(api environments.Api) (*JobClient, error) { +func NewJobClientWithBaseURI(api sdkEnv.Api) (*JobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "job", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/client.go b/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/client.go index 098bcd90b56..730f268418e 100644 --- a/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MachineLearningComputesClient struct { Client *resourcemanager.Client } -func NewMachineLearningComputesClientWithBaseURI(api environments.Api) (*MachineLearningComputesClient, error) { +func NewMachineLearningComputesClientWithBaseURI(api sdkEnv.Api) (*MachineLearningComputesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "machinelearningcomputes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MachineLearningComputesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/modelcontainer/client.go b/resource-manager/machinelearningservices/2022-10-01/modelcontainer/client.go index a8ac27a7661..52c90954dc4 100644 --- a/resource-manager/machinelearningservices/2022-10-01/modelcontainer/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/modelcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ModelContainerClient struct { Client *resourcemanager.Client } -func NewModelContainerClientWithBaseURI(api environments.Api) (*ModelContainerClient, error) { +func NewModelContainerClientWithBaseURI(api sdkEnv.Api) (*ModelContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "modelcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ModelContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/modelversion/client.go b/resource-manager/machinelearningservices/2022-10-01/modelversion/client.go index b098ad5eea2..de5ed06eecc 100644 --- a/resource-manager/machinelearningservices/2022-10-01/modelversion/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/modelversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ModelVersionClient struct { Client *resourcemanager.Client } -func NewModelVersionClientWithBaseURI(api environments.Api) (*ModelVersionClient, error) { +func NewModelVersionClientWithBaseURI(api sdkEnv.Api) (*ModelVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "modelversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ModelVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/client.go b/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/client.go index 09ce38fc879..4c0028cd8d2 100644 --- a/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OnlineDeploymentClient struct { Client *resourcemanager.Client } -func NewOnlineDeploymentClientWithBaseURI(api environments.Api) (*OnlineDeploymentClient, error) { +func NewOnlineDeploymentClientWithBaseURI(api sdkEnv.Api) (*OnlineDeploymentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "onlinedeployment", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OnlineDeploymentClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/client.go b/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/client.go index df10facee89..7bf581709ee 100644 --- a/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OnlineEndpointClient struct { Client *resourcemanager.Client } -func NewOnlineEndpointClientWithBaseURI(api environments.Api) (*OnlineEndpointClient, error) { +func NewOnlineEndpointClientWithBaseURI(api sdkEnv.Api) (*OnlineEndpointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "onlineendpoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OnlineEndpointClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/client.go b/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/client.go index d169047374b..68f2fb8b517 100644 --- a/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationalizationClustersClient struct { Client *resourcemanager.Client } -func NewOperationalizationClustersClientWithBaseURI(api environments.Api) (*OperationalizationClustersClient, error) { +func NewOperationalizationClustersClientWithBaseURI(api sdkEnv.Api) (*OperationalizationClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operationalizationclusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationalizationClustersClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/outboundnetworkdependenciesendpoints/client.go b/resource-manager/machinelearningservices/2022-10-01/outboundnetworkdependenciesendpoints/client.go index bdf407b2056..a9777dea6e6 100644 --- a/resource-manager/machinelearningservices/2022-10-01/outboundnetworkdependenciesendpoints/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/outboundnetworkdependenciesendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OutboundNetworkDependenciesEndpointsClient struct { Client *resourcemanager.Client } -func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api environments.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { +func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api sdkEnv.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "outboundnetworkdependenciesendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OutboundNetworkDependenciesEndpointsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/privateendpointconnections/client.go b/resource-manager/machinelearningservices/2022-10-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/machinelearningservices/2022-10-01/privateendpointconnections/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/proxyoperations/client.go b/resource-manager/machinelearningservices/2022-10-01/proxyoperations/client.go index 05defcf36b7..970bacaf3ba 100644 --- a/resource-manager/machinelearningservices/2022-10-01/proxyoperations/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/proxyoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProxyOperationsClient struct { Client *resourcemanager.Client } -func NewProxyOperationsClientWithBaseURI(api environments.Api) (*ProxyOperationsClient, error) { +func NewProxyOperationsClientWithBaseURI(api sdkEnv.Api) (*ProxyOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "proxyoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProxyOperationsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/quota/client.go b/resource-manager/machinelearningservices/2022-10-01/quota/client.go index c77adeece22..b970bd78219 100644 --- a/resource-manager/machinelearningservices/2022-10-01/quota/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/quota/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QuotaClient struct { Client *resourcemanager.Client } -func NewQuotaClientWithBaseURI(api environments.Api) (*QuotaClient, error) { +func NewQuotaClientWithBaseURI(api sdkEnv.Api) (*QuotaClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "quota", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QuotaClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/schedule/client.go b/resource-manager/machinelearningservices/2022-10-01/schedule/client.go index 60e00b447ce..1c5441b1037 100644 --- a/resource-manager/machinelearningservices/2022-10-01/schedule/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/schedule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScheduleClient struct { Client *resourcemanager.Client } -func NewScheduleClientWithBaseURI(api environments.Api) (*ScheduleClient, error) { +func NewScheduleClientWithBaseURI(api sdkEnv.Api) (*ScheduleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "schedule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScheduleClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/client.go b/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/client.go index e401fd166f9..0da5bb9346d 100644 --- a/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type V2WorkspaceConnectionResourceClient struct { Client *resourcemanager.Client } -func NewV2WorkspaceConnectionResourceClientWithBaseURI(api environments.Api) (*V2WorkspaceConnectionResourceClient, error) { +func NewV2WorkspaceConnectionResourceClientWithBaseURI(api sdkEnv.Api) (*V2WorkspaceConnectionResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "v2workspaceconnectionresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating V2WorkspaceConnectionResourceClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/virtualmachinesizes/client.go b/resource-manager/machinelearningservices/2022-10-01/virtualmachinesizes/client.go index f2a83cfb4c9..0b592f66ddc 100644 --- a/resource-manager/machinelearningservices/2022-10-01/virtualmachinesizes/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/virtualmachinesizes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualMachineSizesClient struct { Client *resourcemanager.Client } -func NewVirtualMachineSizesClientWithBaseURI(api environments.Api) (*VirtualMachineSizesClient, error) { +func NewVirtualMachineSizesClientWithBaseURI(api sdkEnv.Api) (*VirtualMachineSizesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualmachinesizes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualMachineSizesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/workspaceprivateendpointconnections/client.go b/resource-manager/machinelearningservices/2022-10-01/workspaceprivateendpointconnections/client.go index 584fd609d85..3f9d225e74b 100644 --- a/resource-manager/machinelearningservices/2022-10-01/workspaceprivateendpointconnections/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/workspaceprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { +func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/workspaceprivatelinkresources/client.go b/resource-manager/machinelearningservices/2022-10-01/workspaceprivatelinkresources/client.go index b5b7cfe9b1c..bc6558ba9f8 100644 --- a/resource-manager/machinelearningservices/2022-10-01/workspaceprivatelinkresources/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/workspaceprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api environments.Api) (*WorkspacePrivateLinkResourcesClient, error) { +func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2022-10-01/workspaces/client.go b/resource-manager/machinelearningservices/2022-10-01/workspaces/client.go index bf91cd2dee7..868fd830b2a 100644 --- a/resource-manager/machinelearningservices/2022-10-01/workspaces/client.go +++ b/resource-manager/machinelearningservices/2022-10-01/workspaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacesClient struct { Client *resourcemanager.Client } -func NewWorkspacesClientWithBaseURI(api environments.Api) (*WorkspacesClient, error) { +func NewWorkspacesClientWithBaseURI(api sdkEnv.Api) (*WorkspacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/client.go index 053d3461055..65a1baedfa1 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BatchDeploymentClient struct { Client *resourcemanager.Client } -func NewBatchDeploymentClientWithBaseURI(api environments.Api) (*BatchDeploymentClient, error) { +func NewBatchDeploymentClientWithBaseURI(api sdkEnv.Api) (*BatchDeploymentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "batchdeployment", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BatchDeploymentClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/client.go index a1c736289df..eff3d679c82 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BatchEndpointClient struct { Client *resourcemanager.Client } -func NewBatchEndpointClientWithBaseURI(api environments.Api) (*BatchEndpointClient, error) { +func NewBatchEndpointClientWithBaseURI(api sdkEnv.Api) (*BatchEndpointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "batchendpoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BatchEndpointClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/client.go index d5a6cefbadb..2ae586b3a94 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/client.go @@ -45,7 +45,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivatelinkresources" "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2023-04-01-preview/workspaces" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -89,7 +89,7 @@ type Client struct { Workspaces *workspaces.WorkspacesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { batchDeploymentClient, err := batchdeployment.NewBatchDeploymentClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building BatchDeployment client: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/client.go index cc996888ad7..6e6178fd0ec 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CodeContainerClient struct { Client *resourcemanager.Client } -func NewCodeContainerClientWithBaseURI(api environments.Api) (*CodeContainerClient, error) { +func NewCodeContainerClientWithBaseURI(api sdkEnv.Api) (*CodeContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "codecontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CodeContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/client.go index 4aae9e3f55e..bb5cb4e5267 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CodeVersionClient struct { Client *resourcemanager.Client } -func NewCodeVersionClientWithBaseURI(api environments.Api) (*CodeVersionClient, error) { +func NewCodeVersionClientWithBaseURI(api sdkEnv.Api) (*CodeVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "codeversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CodeVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/client.go index a09869f4a6f..b09970ea4b3 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ComponentContainerClient struct { Client *resourcemanager.Client } -func NewComponentContainerClientWithBaseURI(api environments.Api) (*ComponentContainerClient, error) { +func NewComponentContainerClientWithBaseURI(api sdkEnv.Api) (*ComponentContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "componentcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ComponentContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/client.go index 1a0ac1d57fe..d54cf6bae82 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ComponentVersionClient struct { Client *resourcemanager.Client } -func NewComponentVersionClientWithBaseURI(api environments.Api) (*ComponentVersionClient, error) { +func NewComponentVersionClientWithBaseURI(api sdkEnv.Api) (*ComponentVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "componentversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ComponentVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/client.go index f417a8eca60..3e0b04d4317 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataContainerClient struct { Client *resourcemanager.Client } -func NewDataContainerClientWithBaseURI(api environments.Api) (*DataContainerClient, error) { +func NewDataContainerClientWithBaseURI(api sdkEnv.Api) (*DataContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datacontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/client.go index 1390cfd3cdb..18bc7ade412 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataContainerRegistryClient struct { Client *resourcemanager.Client } -func NewDataContainerRegistryClientWithBaseURI(api environments.Api) (*DataContainerRegistryClient, error) { +func NewDataContainerRegistryClientWithBaseURI(api sdkEnv.Api) (*DataContainerRegistryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datacontainerregistry", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataContainerRegistryClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/datastore/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/datastore/client.go index f62478cb7b5..7d4e687bd84 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/datastore/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/datastore/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatastoreClient struct { Client *resourcemanager.Client } -func NewDatastoreClientWithBaseURI(api environments.Api) (*DatastoreClient, error) { +func NewDatastoreClientWithBaseURI(api sdkEnv.Api) (*DatastoreClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datastore", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatastoreClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/client.go index 982d81471bd..c618ca4c36e 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataVersionClient struct { Client *resourcemanager.Client } -func NewDataVersionClientWithBaseURI(api environments.Api) (*DataVersionClient, error) { +func NewDataVersionClientWithBaseURI(api sdkEnv.Api) (*DataVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dataversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/client.go index f26fc2ecfa7..2f3e4d30c80 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataVersionRegistryClient struct { Client *resourcemanager.Client } -func NewDataVersionRegistryClientWithBaseURI(api environments.Api) (*DataVersionRegistryClient, error) { +func NewDataVersionRegistryClientWithBaseURI(api sdkEnv.Api) (*DataVersionRegistryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dataversionregistry", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataVersionRegistryClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/client.go index 795a372bdbe..7236df1890c 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EnvironmentContainerClient struct { Client *resourcemanager.Client } -func NewEnvironmentContainerClientWithBaseURI(api environments.Api) (*EnvironmentContainerClient, error) { +func NewEnvironmentContainerClientWithBaseURI(api sdkEnv.Api) (*EnvironmentContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "environmentcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EnvironmentContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/client.go index a546aae9f80..3c9dbc919da 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EnvironmentVersionClient struct { Client *resourcemanager.Client } -func NewEnvironmentVersionClientWithBaseURI(api environments.Api) (*EnvironmentVersionClient, error) { +func NewEnvironmentVersionClientWithBaseURI(api sdkEnv.Api) (*EnvironmentVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "environmentversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EnvironmentVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/feature/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/feature/client.go index 7626a9f7d85..bb71259294f 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/feature/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/feature/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FeatureClient struct { Client *resourcemanager.Client } -func NewFeatureClientWithBaseURI(api environments.Api) (*FeatureClient, error) { +func NewFeatureClientWithBaseURI(api sdkEnv.Api) (*FeatureClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "feature", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FeatureClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/client.go index b07ff5965ee..2f06f3d6f41 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FeaturesetContainerClient struct { Client *resourcemanager.Client } -func NewFeaturesetContainerClientWithBaseURI(api environments.Api) (*FeaturesetContainerClient, error) { +func NewFeaturesetContainerClientWithBaseURI(api sdkEnv.Api) (*FeaturesetContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "featuresetcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FeaturesetContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/client.go index f19fe166593..82bbb3bb627 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FeaturesetVersionClient struct { Client *resourcemanager.Client } -func NewFeaturesetVersionClientWithBaseURI(api environments.Api) (*FeaturesetVersionClient, error) { +func NewFeaturesetVersionClientWithBaseURI(api sdkEnv.Api) (*FeaturesetVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "featuresetversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FeaturesetVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/client.go index 3bde7c42908..219e229b68a 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FeaturestoreEntityContainerClient struct { Client *resourcemanager.Client } -func NewFeaturestoreEntityContainerClientWithBaseURI(api environments.Api) (*FeaturestoreEntityContainerClient, error) { +func NewFeaturestoreEntityContainerClientWithBaseURI(api sdkEnv.Api) (*FeaturestoreEntityContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "featurestoreentitycontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FeaturestoreEntityContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/client.go index 3869dece8b5..25b05ecae7a 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FeaturestoreEntityVersionClient struct { Client *resourcemanager.Client } -func NewFeaturestoreEntityVersionClientWithBaseURI(api environments.Api) (*FeaturestoreEntityVersionClient, error) { +func NewFeaturestoreEntityVersionClientWithBaseURI(api sdkEnv.Api) (*FeaturestoreEntityVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "featurestoreentityversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FeaturestoreEntityVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/job/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/job/client.go index 9c1aeead52a..9e0840550db 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/job/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/job/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobClient struct { Client *resourcemanager.Client } -func NewJobClientWithBaseURI(api environments.Api) (*JobClient, error) { +func NewJobClientWithBaseURI(api sdkEnv.Api) (*JobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "job", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/client.go index e92f873fb1b..03fd407acc0 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LabelingJobClient struct { Client *resourcemanager.Client } -func NewLabelingJobClientWithBaseURI(api environments.Api) (*LabelingJobClient, error) { +func NewLabelingJobClientWithBaseURI(api sdkEnv.Api) (*LabelingJobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "labelingjob", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LabelingJobClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/client.go index 098bcd90b56..730f268418e 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MachineLearningComputesClient struct { Client *resourcemanager.Client } -func NewMachineLearningComputesClientWithBaseURI(api environments.Api) (*MachineLearningComputesClient, error) { +func NewMachineLearningComputesClientWithBaseURI(api sdkEnv.Api) (*MachineLearningComputesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "machinelearningcomputes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MachineLearningComputesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/client.go index 70e34a659a5..7ac3db0627c 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedNetworkClient struct { Client *resourcemanager.Client } -func NewManagedNetworkClientWithBaseURI(api environments.Api) (*ManagedNetworkClient, error) { +func NewManagedNetworkClientWithBaseURI(api sdkEnv.Api) (*ManagedNetworkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managednetwork", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedNetworkClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/client.go index a8ac27a7661..52c90954dc4 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ModelContainerClient struct { Client *resourcemanager.Client } -func NewModelContainerClientWithBaseURI(api environments.Api) (*ModelContainerClient, error) { +func NewModelContainerClientWithBaseURI(api sdkEnv.Api) (*ModelContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "modelcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ModelContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/client.go index b098ad5eea2..de5ed06eecc 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ModelVersionClient struct { Client *resourcemanager.Client } -func NewModelVersionClientWithBaseURI(api environments.Api) (*ModelVersionClient, error) { +func NewModelVersionClientWithBaseURI(api sdkEnv.Api) (*ModelVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "modelversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ModelVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/client.go index 09ce38fc879..4c0028cd8d2 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OnlineDeploymentClient struct { Client *resourcemanager.Client } -func NewOnlineDeploymentClientWithBaseURI(api environments.Api) (*OnlineDeploymentClient, error) { +func NewOnlineDeploymentClientWithBaseURI(api sdkEnv.Api) (*OnlineDeploymentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "onlinedeployment", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OnlineDeploymentClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/client.go index df10facee89..7bf581709ee 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OnlineEndpointClient struct { Client *resourcemanager.Client } -func NewOnlineEndpointClientWithBaseURI(api environments.Api) (*OnlineEndpointClient, error) { +func NewOnlineEndpointClientWithBaseURI(api sdkEnv.Api) (*OnlineEndpointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "onlineendpoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OnlineEndpointClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/client.go index d169047374b..68f2fb8b517 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationalizationClustersClient struct { Client *resourcemanager.Client } -func NewOperationalizationClustersClientWithBaseURI(api environments.Api) (*OperationalizationClustersClient, error) { +func NewOperationalizationClustersClientWithBaseURI(api sdkEnv.Api) (*OperationalizationClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operationalizationclusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationalizationClustersClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/outboundnetworkdependenciesendpoints/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/outboundnetworkdependenciesendpoints/client.go index bdf407b2056..a9777dea6e6 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/outboundnetworkdependenciesendpoints/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/outboundnetworkdependenciesendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OutboundNetworkDependenciesEndpointsClient struct { Client *resourcemanager.Client } -func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api environments.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { +func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api sdkEnv.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "outboundnetworkdependenciesendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OutboundNetworkDependenciesEndpointsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/privateendpointconnections/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/privateendpointconnections/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/proxyoperations/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/proxyoperations/client.go index 05defcf36b7..970bacaf3ba 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/proxyoperations/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/proxyoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProxyOperationsClient struct { Client *resourcemanager.Client } -func NewProxyOperationsClientWithBaseURI(api environments.Api) (*ProxyOperationsClient, error) { +func NewProxyOperationsClientWithBaseURI(api sdkEnv.Api) (*ProxyOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "proxyoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProxyOperationsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/quota/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/quota/client.go index c77adeece22..b970bd78219 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/quota/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/quota/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QuotaClient struct { Client *resourcemanager.Client } -func NewQuotaClientWithBaseURI(api environments.Api) (*QuotaClient, error) { +func NewQuotaClientWithBaseURI(api sdkEnv.Api) (*QuotaClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "quota", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QuotaClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/registrymanagement/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/registrymanagement/client.go index 3103b25ce10..b6d179bbaf3 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/registrymanagement/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/registrymanagement/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RegistryManagementClient struct { Client *resourcemanager.Client } -func NewRegistryManagementClientWithBaseURI(api environments.Api) (*RegistryManagementClient, error) { +func NewRegistryManagementClientWithBaseURI(api sdkEnv.Api) (*RegistryManagementClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "registrymanagement", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RegistryManagementClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/schedule/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/schedule/client.go index 60e00b447ce..1c5441b1037 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/schedule/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/schedule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScheduleClient struct { Client *resourcemanager.Client } -func NewScheduleClientWithBaseURI(api environments.Api) (*ScheduleClient, error) { +func NewScheduleClientWithBaseURI(api sdkEnv.Api) (*ScheduleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "schedule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScheduleClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/client.go index e401fd166f9..0da5bb9346d 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type V2WorkspaceConnectionResourceClient struct { Client *resourcemanager.Client } -func NewV2WorkspaceConnectionResourceClientWithBaseURI(api environments.Api) (*V2WorkspaceConnectionResourceClient, error) { +func NewV2WorkspaceConnectionResourceClientWithBaseURI(api sdkEnv.Api) (*V2WorkspaceConnectionResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "v2workspaceconnectionresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating V2WorkspaceConnectionResourceClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/virtualmachinesizes/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/virtualmachinesizes/client.go index f2a83cfb4c9..0b592f66ddc 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/virtualmachinesizes/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/virtualmachinesizes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualMachineSizesClient struct { Client *resourcemanager.Client } -func NewVirtualMachineSizesClientWithBaseURI(api environments.Api) (*VirtualMachineSizesClient, error) { +func NewVirtualMachineSizesClientWithBaseURI(api sdkEnv.Api) (*VirtualMachineSizesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualmachinesizes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualMachineSizesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivateendpointconnections/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivateendpointconnections/client.go index 584fd609d85..3f9d225e74b 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivateendpointconnections/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { +func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivatelinkresources/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivatelinkresources/client.go index b5b7cfe9b1c..bc6558ba9f8 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivatelinkresources/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api environments.Api) (*WorkspacePrivateLinkResourcesClient, error) { +func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/workspaces/client.go b/resource-manager/machinelearningservices/2023-04-01-preview/workspaces/client.go index bf91cd2dee7..868fd830b2a 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/workspaces/client.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/workspaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacesClient struct { Client *resourcemanager.Client } -func NewWorkspacesClientWithBaseURI(api environments.Api) (*WorkspacesClient, error) { +func NewWorkspacesClientWithBaseURI(api sdkEnv.Api) (*WorkspacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/batchdeployment/client.go b/resource-manager/machinelearningservices/2023-04-01/batchdeployment/client.go index 053d3461055..65a1baedfa1 100644 --- a/resource-manager/machinelearningservices/2023-04-01/batchdeployment/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/batchdeployment/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BatchDeploymentClient struct { Client *resourcemanager.Client } -func NewBatchDeploymentClientWithBaseURI(api environments.Api) (*BatchDeploymentClient, error) { +func NewBatchDeploymentClientWithBaseURI(api sdkEnv.Api) (*BatchDeploymentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "batchdeployment", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BatchDeploymentClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/batchendpoint/client.go b/resource-manager/machinelearningservices/2023-04-01/batchendpoint/client.go index a1c736289df..eff3d679c82 100644 --- a/resource-manager/machinelearningservices/2023-04-01/batchendpoint/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/batchendpoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BatchEndpointClient struct { Client *resourcemanager.Client } -func NewBatchEndpointClientWithBaseURI(api environments.Api) (*BatchEndpointClient, error) { +func NewBatchEndpointClientWithBaseURI(api sdkEnv.Api) (*BatchEndpointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "batchendpoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BatchEndpointClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/client.go b/resource-manager/machinelearningservices/2023-04-01/client.go index 6866963e644..b460820793f 100644 --- a/resource-manager/machinelearningservices/2023-04-01/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/client.go @@ -38,7 +38,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2023-04-01/workspaceprivatelinkresources" "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2023-04-01/workspaces" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -75,7 +75,7 @@ type Client struct { Workspaces *workspaces.WorkspacesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { batchDeploymentClient, err := batchdeployment.NewBatchDeploymentClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building BatchDeployment client: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/codecontainer/client.go b/resource-manager/machinelearningservices/2023-04-01/codecontainer/client.go index cc996888ad7..6e6178fd0ec 100644 --- a/resource-manager/machinelearningservices/2023-04-01/codecontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/codecontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CodeContainerClient struct { Client *resourcemanager.Client } -func NewCodeContainerClientWithBaseURI(api environments.Api) (*CodeContainerClient, error) { +func NewCodeContainerClientWithBaseURI(api sdkEnv.Api) (*CodeContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "codecontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CodeContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/codeversion/client.go b/resource-manager/machinelearningservices/2023-04-01/codeversion/client.go index 4aae9e3f55e..bb5cb4e5267 100644 --- a/resource-manager/machinelearningservices/2023-04-01/codeversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/codeversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CodeVersionClient struct { Client *resourcemanager.Client } -func NewCodeVersionClientWithBaseURI(api environments.Api) (*CodeVersionClient, error) { +func NewCodeVersionClientWithBaseURI(api sdkEnv.Api) (*CodeVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "codeversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CodeVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/componentcontainer/client.go b/resource-manager/machinelearningservices/2023-04-01/componentcontainer/client.go index a09869f4a6f..b09970ea4b3 100644 --- a/resource-manager/machinelearningservices/2023-04-01/componentcontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/componentcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ComponentContainerClient struct { Client *resourcemanager.Client } -func NewComponentContainerClientWithBaseURI(api environments.Api) (*ComponentContainerClient, error) { +func NewComponentContainerClientWithBaseURI(api sdkEnv.Api) (*ComponentContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "componentcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ComponentContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/componentversion/client.go b/resource-manager/machinelearningservices/2023-04-01/componentversion/client.go index 1a0ac1d57fe..d54cf6bae82 100644 --- a/resource-manager/machinelearningservices/2023-04-01/componentversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/componentversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ComponentVersionClient struct { Client *resourcemanager.Client } -func NewComponentVersionClientWithBaseURI(api environments.Api) (*ComponentVersionClient, error) { +func NewComponentVersionClientWithBaseURI(api sdkEnv.Api) (*ComponentVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "componentversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ComponentVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/datacontainer/client.go b/resource-manager/machinelearningservices/2023-04-01/datacontainer/client.go index f417a8eca60..3e0b04d4317 100644 --- a/resource-manager/machinelearningservices/2023-04-01/datacontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/datacontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataContainerClient struct { Client *resourcemanager.Client } -func NewDataContainerClientWithBaseURI(api environments.Api) (*DataContainerClient, error) { +func NewDataContainerClientWithBaseURI(api sdkEnv.Api) (*DataContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datacontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/client.go b/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/client.go index 1390cfd3cdb..18bc7ade412 100644 --- a/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataContainerRegistryClient struct { Client *resourcemanager.Client } -func NewDataContainerRegistryClientWithBaseURI(api environments.Api) (*DataContainerRegistryClient, error) { +func NewDataContainerRegistryClientWithBaseURI(api sdkEnv.Api) (*DataContainerRegistryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datacontainerregistry", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataContainerRegistryClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/datastore/client.go b/resource-manager/machinelearningservices/2023-04-01/datastore/client.go index f62478cb7b5..7d4e687bd84 100644 --- a/resource-manager/machinelearningservices/2023-04-01/datastore/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/datastore/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatastoreClient struct { Client *resourcemanager.Client } -func NewDatastoreClientWithBaseURI(api environments.Api) (*DatastoreClient, error) { +func NewDatastoreClientWithBaseURI(api sdkEnv.Api) (*DatastoreClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datastore", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatastoreClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/dataversion/client.go b/resource-manager/machinelearningservices/2023-04-01/dataversion/client.go index 982d81471bd..c618ca4c36e 100644 --- a/resource-manager/machinelearningservices/2023-04-01/dataversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/dataversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataVersionClient struct { Client *resourcemanager.Client } -func NewDataVersionClientWithBaseURI(api environments.Api) (*DataVersionClient, error) { +func NewDataVersionClientWithBaseURI(api sdkEnv.Api) (*DataVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dataversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/client.go b/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/client.go index f26fc2ecfa7..2f3e4d30c80 100644 --- a/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataVersionRegistryClient struct { Client *resourcemanager.Client } -func NewDataVersionRegistryClientWithBaseURI(api environments.Api) (*DataVersionRegistryClient, error) { +func NewDataVersionRegistryClientWithBaseURI(api sdkEnv.Api) (*DataVersionRegistryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dataversionregistry", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataVersionRegistryClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/client.go b/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/client.go index 795a372bdbe..7236df1890c 100644 --- a/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EnvironmentContainerClient struct { Client *resourcemanager.Client } -func NewEnvironmentContainerClientWithBaseURI(api environments.Api) (*EnvironmentContainerClient, error) { +func NewEnvironmentContainerClientWithBaseURI(api sdkEnv.Api) (*EnvironmentContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "environmentcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EnvironmentContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/environmentversion/client.go b/resource-manager/machinelearningservices/2023-04-01/environmentversion/client.go index a546aae9f80..3c9dbc919da 100644 --- a/resource-manager/machinelearningservices/2023-04-01/environmentversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/environmentversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EnvironmentVersionClient struct { Client *resourcemanager.Client } -func NewEnvironmentVersionClientWithBaseURI(api environments.Api) (*EnvironmentVersionClient, error) { +func NewEnvironmentVersionClientWithBaseURI(api sdkEnv.Api) (*EnvironmentVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "environmentversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EnvironmentVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/job/client.go b/resource-manager/machinelearningservices/2023-04-01/job/client.go index 9c1aeead52a..9e0840550db 100644 --- a/resource-manager/machinelearningservices/2023-04-01/job/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/job/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobClient struct { Client *resourcemanager.Client } -func NewJobClientWithBaseURI(api environments.Api) (*JobClient, error) { +func NewJobClientWithBaseURI(api sdkEnv.Api) (*JobClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "job", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/client.go b/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/client.go index 098bcd90b56..730f268418e 100644 --- a/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MachineLearningComputesClient struct { Client *resourcemanager.Client } -func NewMachineLearningComputesClientWithBaseURI(api environments.Api) (*MachineLearningComputesClient, error) { +func NewMachineLearningComputesClientWithBaseURI(api sdkEnv.Api) (*MachineLearningComputesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "machinelearningcomputes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MachineLearningComputesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/modelcontainer/client.go b/resource-manager/machinelearningservices/2023-04-01/modelcontainer/client.go index a8ac27a7661..52c90954dc4 100644 --- a/resource-manager/machinelearningservices/2023-04-01/modelcontainer/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/modelcontainer/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ModelContainerClient struct { Client *resourcemanager.Client } -func NewModelContainerClientWithBaseURI(api environments.Api) (*ModelContainerClient, error) { +func NewModelContainerClientWithBaseURI(api sdkEnv.Api) (*ModelContainerClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "modelcontainer", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ModelContainerClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/modelversion/client.go b/resource-manager/machinelearningservices/2023-04-01/modelversion/client.go index b098ad5eea2..de5ed06eecc 100644 --- a/resource-manager/machinelearningservices/2023-04-01/modelversion/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/modelversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ModelVersionClient struct { Client *resourcemanager.Client } -func NewModelVersionClientWithBaseURI(api environments.Api) (*ModelVersionClient, error) { +func NewModelVersionClientWithBaseURI(api sdkEnv.Api) (*ModelVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "modelversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ModelVersionClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/client.go b/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/client.go index 09ce38fc879..4c0028cd8d2 100644 --- a/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OnlineDeploymentClient struct { Client *resourcemanager.Client } -func NewOnlineDeploymentClientWithBaseURI(api environments.Api) (*OnlineDeploymentClient, error) { +func NewOnlineDeploymentClientWithBaseURI(api sdkEnv.Api) (*OnlineDeploymentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "onlinedeployment", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OnlineDeploymentClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/client.go b/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/client.go index df10facee89..7bf581709ee 100644 --- a/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OnlineEndpointClient struct { Client *resourcemanager.Client } -func NewOnlineEndpointClientWithBaseURI(api environments.Api) (*OnlineEndpointClient, error) { +func NewOnlineEndpointClientWithBaseURI(api sdkEnv.Api) (*OnlineEndpointClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "onlineendpoint", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OnlineEndpointClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/client.go b/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/client.go index d169047374b..68f2fb8b517 100644 --- a/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationalizationClustersClient struct { Client *resourcemanager.Client } -func NewOperationalizationClustersClientWithBaseURI(api environments.Api) (*OperationalizationClustersClient, error) { +func NewOperationalizationClustersClientWithBaseURI(api sdkEnv.Api) (*OperationalizationClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operationalizationclusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationalizationClustersClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/outboundnetworkdependenciesendpoints/client.go b/resource-manager/machinelearningservices/2023-04-01/outboundnetworkdependenciesendpoints/client.go index bdf407b2056..a9777dea6e6 100644 --- a/resource-manager/machinelearningservices/2023-04-01/outboundnetworkdependenciesendpoints/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/outboundnetworkdependenciesendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OutboundNetworkDependenciesEndpointsClient struct { Client *resourcemanager.Client } -func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api environments.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { +func NewOutboundNetworkDependenciesEndpointsClientWithBaseURI(api sdkEnv.Api) (*OutboundNetworkDependenciesEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "outboundnetworkdependenciesendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OutboundNetworkDependenciesEndpointsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/privateendpointconnections/client.go b/resource-manager/machinelearningservices/2023-04-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/machinelearningservices/2023-04-01/privateendpointconnections/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/proxyoperations/client.go b/resource-manager/machinelearningservices/2023-04-01/proxyoperations/client.go index 05defcf36b7..970bacaf3ba 100644 --- a/resource-manager/machinelearningservices/2023-04-01/proxyoperations/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/proxyoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProxyOperationsClient struct { Client *resourcemanager.Client } -func NewProxyOperationsClientWithBaseURI(api environments.Api) (*ProxyOperationsClient, error) { +func NewProxyOperationsClientWithBaseURI(api sdkEnv.Api) (*ProxyOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "proxyoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProxyOperationsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/quota/client.go b/resource-manager/machinelearningservices/2023-04-01/quota/client.go index c77adeece22..b970bd78219 100644 --- a/resource-manager/machinelearningservices/2023-04-01/quota/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/quota/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QuotaClient struct { Client *resourcemanager.Client } -func NewQuotaClientWithBaseURI(api environments.Api) (*QuotaClient, error) { +func NewQuotaClientWithBaseURI(api sdkEnv.Api) (*QuotaClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "quota", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QuotaClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/registrymanagement/client.go b/resource-manager/machinelearningservices/2023-04-01/registrymanagement/client.go index 3103b25ce10..b6d179bbaf3 100644 --- a/resource-manager/machinelearningservices/2023-04-01/registrymanagement/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/registrymanagement/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RegistryManagementClient struct { Client *resourcemanager.Client } -func NewRegistryManagementClientWithBaseURI(api environments.Api) (*RegistryManagementClient, error) { +func NewRegistryManagementClientWithBaseURI(api sdkEnv.Api) (*RegistryManagementClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "registrymanagement", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RegistryManagementClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/schedule/client.go b/resource-manager/machinelearningservices/2023-04-01/schedule/client.go index 60e00b447ce..1c5441b1037 100644 --- a/resource-manager/machinelearningservices/2023-04-01/schedule/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/schedule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScheduleClient struct { Client *resourcemanager.Client } -func NewScheduleClientWithBaseURI(api environments.Api) (*ScheduleClient, error) { +func NewScheduleClientWithBaseURI(api sdkEnv.Api) (*ScheduleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "schedule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScheduleClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/client.go b/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/client.go index e401fd166f9..0da5bb9346d 100644 --- a/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type V2WorkspaceConnectionResourceClient struct { Client *resourcemanager.Client } -func NewV2WorkspaceConnectionResourceClientWithBaseURI(api environments.Api) (*V2WorkspaceConnectionResourceClient, error) { +func NewV2WorkspaceConnectionResourceClientWithBaseURI(api sdkEnv.Api) (*V2WorkspaceConnectionResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "v2workspaceconnectionresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating V2WorkspaceConnectionResourceClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/virtualmachinesizes/client.go b/resource-manager/machinelearningservices/2023-04-01/virtualmachinesizes/client.go index f2a83cfb4c9..0b592f66ddc 100644 --- a/resource-manager/machinelearningservices/2023-04-01/virtualmachinesizes/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/virtualmachinesizes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualMachineSizesClient struct { Client *resourcemanager.Client } -func NewVirtualMachineSizesClientWithBaseURI(api environments.Api) (*VirtualMachineSizesClient, error) { +func NewVirtualMachineSizesClientWithBaseURI(api sdkEnv.Api) (*VirtualMachineSizesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualmachinesizes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualMachineSizesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/workspaceprivateendpointconnections/client.go b/resource-manager/machinelearningservices/2023-04-01/workspaceprivateendpointconnections/client.go index 584fd609d85..3f9d225e74b 100644 --- a/resource-manager/machinelearningservices/2023-04-01/workspaceprivateendpointconnections/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/workspaceprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { +func NewWorkspacePrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/workspaceprivatelinkresources/client.go b/resource-manager/machinelearningservices/2023-04-01/workspaceprivatelinkresources/client.go index b5b7cfe9b1c..bc6558ba9f8 100644 --- a/resource-manager/machinelearningservices/2023-04-01/workspaceprivatelinkresources/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/workspaceprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacePrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api environments.Api) (*WorkspacePrivateLinkResourcesClient, error) { +func NewWorkspacePrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*WorkspacePrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaceprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacePrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/machinelearningservices/2023-04-01/workspaces/client.go b/resource-manager/machinelearningservices/2023-04-01/workspaces/client.go index bf91cd2dee7..868fd830b2a 100644 --- a/resource-manager/machinelearningservices/2023-04-01/workspaces/client.go +++ b/resource-manager/machinelearningservices/2023-04-01/workspaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkspacesClient struct { Client *resourcemanager.Client } -func NewWorkspacesClientWithBaseURI(api environments.Api) (*WorkspacesClient, error) { +func NewWorkspacesClientWithBaseURI(api sdkEnv.Api) (*WorkspacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workspaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkspacesClient: %+v", err) diff --git a/resource-manager/managedapplications/2019-07-01/applicationdefinitions/client.go b/resource-manager/managedapplications/2019-07-01/applicationdefinitions/client.go index 7bd233c8a53..83e5fd5265b 100644 --- a/resource-manager/managedapplications/2019-07-01/applicationdefinitions/client.go +++ b/resource-manager/managedapplications/2019-07-01/applicationdefinitions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationDefinitionsClient struct { Client *resourcemanager.Client } -func NewApplicationDefinitionsClientWithBaseURI(api environments.Api) (*ApplicationDefinitionsClient, error) { +func NewApplicationDefinitionsClientWithBaseURI(api sdkEnv.Api) (*ApplicationDefinitionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationdefinitions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationDefinitionsClient: %+v", err) diff --git a/resource-manager/managedapplications/2019-07-01/applications/client.go b/resource-manager/managedapplications/2019-07-01/applications/client.go index 4cedd2657e7..a857cb09244 100644 --- a/resource-manager/managedapplications/2019-07-01/applications/client.go +++ b/resource-manager/managedapplications/2019-07-01/applications/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationsClient struct { Client *resourcemanager.Client } -func NewApplicationsClientWithBaseURI(api environments.Api) (*ApplicationsClient, error) { +func NewApplicationsClientWithBaseURI(api sdkEnv.Api) (*ApplicationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applications", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationsClient: %+v", err) diff --git a/resource-manager/managedapplications/2019-07-01/client.go b/resource-manager/managedapplications/2019-07-01/client.go index de35806c2d4..0af008c1e3d 100644 --- a/resource-manager/managedapplications/2019-07-01/client.go +++ b/resource-manager/managedapplications/2019-07-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2019-07-01/applications" "github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2019-07-01/jitrequests" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { JitRequests *jitrequests.JitRequestsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { applicationDefinitionsClient, err := applicationdefinitions.NewApplicationDefinitionsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ApplicationDefinitions client: %+v", err) diff --git a/resource-manager/managedapplications/2019-07-01/jitrequests/client.go b/resource-manager/managedapplications/2019-07-01/jitrequests/client.go index eff5666bab6..b56ee8f79fb 100644 --- a/resource-manager/managedapplications/2019-07-01/jitrequests/client.go +++ b/resource-manager/managedapplications/2019-07-01/jitrequests/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JitRequestsClient struct { Client *resourcemanager.Client } -func NewJitRequestsClientWithBaseURI(api environments.Api) (*JitRequestsClient, error) { +func NewJitRequestsClientWithBaseURI(api sdkEnv.Api) (*JitRequestsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jitrequests", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JitRequestsClient: %+v", err) diff --git a/resource-manager/managedapplications/2021-07-01/applicationdefinitions/client.go b/resource-manager/managedapplications/2021-07-01/applicationdefinitions/client.go index 7bd233c8a53..83e5fd5265b 100644 --- a/resource-manager/managedapplications/2021-07-01/applicationdefinitions/client.go +++ b/resource-manager/managedapplications/2021-07-01/applicationdefinitions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationDefinitionsClient struct { Client *resourcemanager.Client } -func NewApplicationDefinitionsClientWithBaseURI(api environments.Api) (*ApplicationDefinitionsClient, error) { +func NewApplicationDefinitionsClientWithBaseURI(api sdkEnv.Api) (*ApplicationDefinitionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationdefinitions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationDefinitionsClient: %+v", err) diff --git a/resource-manager/managedapplications/2021-07-01/applications/client.go b/resource-manager/managedapplications/2021-07-01/applications/client.go index 4cedd2657e7..a857cb09244 100644 --- a/resource-manager/managedapplications/2021-07-01/applications/client.go +++ b/resource-manager/managedapplications/2021-07-01/applications/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationsClient struct { Client *resourcemanager.Client } -func NewApplicationsClientWithBaseURI(api environments.Api) (*ApplicationsClient, error) { +func NewApplicationsClientWithBaseURI(api sdkEnv.Api) (*ApplicationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applications", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationsClient: %+v", err) diff --git a/resource-manager/managedapplications/2021-07-01/client.go b/resource-manager/managedapplications/2021-07-01/client.go index f68193fd788..828c39db8ad 100644 --- a/resource-manager/managedapplications/2021-07-01/client.go +++ b/resource-manager/managedapplications/2021-07-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/applications" "github.com/hashicorp/go-azure-sdk/resource-manager/managedapplications/2021-07-01/jitrequests" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { JitRequests *jitrequests.JitRequestsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { applicationDefinitionsClient, err := applicationdefinitions.NewApplicationDefinitionsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ApplicationDefinitions client: %+v", err) diff --git a/resource-manager/managedapplications/2021-07-01/jitrequests/client.go b/resource-manager/managedapplications/2021-07-01/jitrequests/client.go index eff5666bab6..b56ee8f79fb 100644 --- a/resource-manager/managedapplications/2021-07-01/jitrequests/client.go +++ b/resource-manager/managedapplications/2021-07-01/jitrequests/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JitRequestsClient struct { Client *resourcemanager.Client } -func NewJitRequestsClientWithBaseURI(api environments.Api) (*JitRequestsClient, error) { +func NewJitRequestsClientWithBaseURI(api sdkEnv.Api) (*JitRequestsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jitrequests", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JitRequestsClient: %+v", err) diff --git a/resource-manager/managementgroups/2020-05-01/checknameavailability/client.go b/resource-manager/managementgroups/2020-05-01/checknameavailability/client.go index 81c73505778..5610e27c123 100644 --- a/resource-manager/managementgroups/2020-05-01/checknameavailability/client.go +++ b/resource-manager/managementgroups/2020-05-01/checknameavailability/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityClient, error) { +func NewCheckNameAvailabilityClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailability", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityClient: %+v", err) diff --git a/resource-manager/managementgroups/2020-05-01/client.go b/resource-manager/managementgroups/2020-05-01/client.go index b3d5ae43f1a..f293e9b0fef 100644 --- a/resource-manager/managementgroups/2020-05-01/client.go +++ b/resource-manager/managementgroups/2020-05-01/client.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/managementgroups/2020-05-01/managementgroups" "github.com/hashicorp/go-azure-sdk/resource-manager/managementgroups/2020-05-01/tenantbackfill" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -21,7 +21,7 @@ type Client struct { TenantBackfill *tenantbackfill.TenantBackfillClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { checkNameAvailabilityClient, err := checknameavailability.NewCheckNameAvailabilityClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CheckNameAvailability client: %+v", err) diff --git a/resource-manager/managementgroups/2020-05-01/entities/client.go b/resource-manager/managementgroups/2020-05-01/entities/client.go index 37d031aa14d..e5557e6cf56 100644 --- a/resource-manager/managementgroups/2020-05-01/entities/client.go +++ b/resource-manager/managementgroups/2020-05-01/entities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EntitiesClient struct { Client *resourcemanager.Client } -func NewEntitiesClientWithBaseURI(api environments.Api) (*EntitiesClient, error) { +func NewEntitiesClientWithBaseURI(api sdkEnv.Api) (*EntitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "entities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EntitiesClient: %+v", err) diff --git a/resource-manager/managementgroups/2020-05-01/managementgroups/client.go b/resource-manager/managementgroups/2020-05-01/managementgroups/client.go index a17d7157a32..7bb8a3bd77e 100644 --- a/resource-manager/managementgroups/2020-05-01/managementgroups/client.go +++ b/resource-manager/managementgroups/2020-05-01/managementgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagementGroupsClient struct { Client *resourcemanager.Client } -func NewManagementGroupsClientWithBaseURI(api environments.Api) (*ManagementGroupsClient, error) { +func NewManagementGroupsClientWithBaseURI(api sdkEnv.Api) (*ManagementGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managementgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagementGroupsClient: %+v", err) diff --git a/resource-manager/managementgroups/2020-05-01/tenantbackfill/client.go b/resource-manager/managementgroups/2020-05-01/tenantbackfill/client.go index d448ccdd14e..3e58ed9f10a 100644 --- a/resource-manager/managementgroups/2020-05-01/tenantbackfill/client.go +++ b/resource-manager/managementgroups/2020-05-01/tenantbackfill/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TenantBackfillClient struct { Client *resourcemanager.Client } -func NewTenantBackfillClientWithBaseURI(api environments.Api) (*TenantBackfillClient, error) { +func NewTenantBackfillClientWithBaseURI(api sdkEnv.Api) (*TenantBackfillClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tenantbackfill", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TenantBackfillClient: %+v", err) diff --git a/resource-manager/managementgroups/2021-04-01/checknameavailability/client.go b/resource-manager/managementgroups/2021-04-01/checknameavailability/client.go index 81c73505778..5610e27c123 100644 --- a/resource-manager/managementgroups/2021-04-01/checknameavailability/client.go +++ b/resource-manager/managementgroups/2021-04-01/checknameavailability/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityClient, error) { +func NewCheckNameAvailabilityClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailability", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityClient: %+v", err) diff --git a/resource-manager/managementgroups/2021-04-01/client.go b/resource-manager/managementgroups/2021-04-01/client.go index 80d903eb766..838cec9c364 100644 --- a/resource-manager/managementgroups/2021-04-01/client.go +++ b/resource-manager/managementgroups/2021-04-01/client.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/managementgroups/2021-04-01/managementgroups" "github.com/hashicorp/go-azure-sdk/resource-manager/managementgroups/2021-04-01/tenantbackfill" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -21,7 +21,7 @@ type Client struct { TenantBackfill *tenantbackfill.TenantBackfillClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { checkNameAvailabilityClient, err := checknameavailability.NewCheckNameAvailabilityClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CheckNameAvailability client: %+v", err) diff --git a/resource-manager/managementgroups/2021-04-01/entities/client.go b/resource-manager/managementgroups/2021-04-01/entities/client.go index 37d031aa14d..e5557e6cf56 100644 --- a/resource-manager/managementgroups/2021-04-01/entities/client.go +++ b/resource-manager/managementgroups/2021-04-01/entities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EntitiesClient struct { Client *resourcemanager.Client } -func NewEntitiesClientWithBaseURI(api environments.Api) (*EntitiesClient, error) { +func NewEntitiesClientWithBaseURI(api sdkEnv.Api) (*EntitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "entities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EntitiesClient: %+v", err) diff --git a/resource-manager/managementgroups/2021-04-01/managementgroups/client.go b/resource-manager/managementgroups/2021-04-01/managementgroups/client.go index a17d7157a32..7bb8a3bd77e 100644 --- a/resource-manager/managementgroups/2021-04-01/managementgroups/client.go +++ b/resource-manager/managementgroups/2021-04-01/managementgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagementGroupsClient struct { Client *resourcemanager.Client } -func NewManagementGroupsClientWithBaseURI(api environments.Api) (*ManagementGroupsClient, error) { +func NewManagementGroupsClientWithBaseURI(api sdkEnv.Api) (*ManagementGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managementgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagementGroupsClient: %+v", err) diff --git a/resource-manager/managementgroups/2021-04-01/tenantbackfill/client.go b/resource-manager/managementgroups/2021-04-01/tenantbackfill/client.go index d448ccdd14e..3e58ed9f10a 100644 --- a/resource-manager/managementgroups/2021-04-01/tenantbackfill/client.go +++ b/resource-manager/managementgroups/2021-04-01/tenantbackfill/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TenantBackfillClient struct { Client *resourcemanager.Client } -func NewTenantBackfillClientWithBaseURI(api environments.Api) (*TenantBackfillClient, error) { +func NewTenantBackfillClientWithBaseURI(api sdkEnv.Api) (*TenantBackfillClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tenantbackfill", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TenantBackfillClient: %+v", err) diff --git a/resource-manager/maps/2021-02-01/accounts/client.go b/resource-manager/maps/2021-02-01/accounts/client.go index c227130d6c6..443dca551fe 100644 --- a/resource-manager/maps/2021-02-01/accounts/client.go +++ b/resource-manager/maps/2021-02-01/accounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccountsClient struct { Client *resourcemanager.Client } -func NewAccountsClientWithBaseURI(api environments.Api) (*AccountsClient, error) { +func NewAccountsClientWithBaseURI(api sdkEnv.Api) (*AccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "accounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccountsClient: %+v", err) diff --git a/resource-manager/maps/2021-02-01/client.go b/resource-manager/maps/2021-02-01/client.go index da4076b5666..a3ac4ec079d 100644 --- a/resource-manager/maps/2021-02-01/client.go +++ b/resource-manager/maps/2021-02-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators" "github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/operations" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { Operations *operations.OperationsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { accountsClient, err := accounts.NewAccountsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Accounts client: %+v", err) diff --git a/resource-manager/maps/2021-02-01/creators/client.go b/resource-manager/maps/2021-02-01/creators/client.go index 4ad651007c0..023af157e62 100644 --- a/resource-manager/maps/2021-02-01/creators/client.go +++ b/resource-manager/maps/2021-02-01/creators/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CreatorsClient struct { Client *resourcemanager.Client } -func NewCreatorsClientWithBaseURI(api environments.Api) (*CreatorsClient, error) { +func NewCreatorsClientWithBaseURI(api sdkEnv.Api) (*CreatorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "creators", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CreatorsClient: %+v", err) diff --git a/resource-manager/maps/2021-02-01/operations/client.go b/resource-manager/maps/2021-02-01/operations/client.go index c3543fd2469..1d8041466a9 100644 --- a/resource-manager/maps/2021-02-01/operations/client.go +++ b/resource-manager/maps/2021-02-01/operations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationsClient struct { Client *resourcemanager.Client } -func NewOperationsClientWithBaseURI(api environments.Api) (*OperationsClient, error) { +func NewOperationsClientWithBaseURI(api sdkEnv.Api) (*OperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationsClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/checknameavailability/client.go b/resource-manager/mariadb/2018-06-01-preview/checknameavailability/client.go index 81c73505778..5610e27c123 100644 --- a/resource-manager/mariadb/2018-06-01-preview/checknameavailability/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/checknameavailability/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityClient, error) { +func NewCheckNameAvailabilityClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailability", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/client.go b/resource-manager/mariadb/2018-06-01-preview/client.go index b3da733c4eb..9ff9ace73b6 100644 --- a/resource-manager/mariadb/2018-06-01-preview/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/client.go @@ -21,7 +21,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01-preview/updateconfigurations" "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -41,7 +41,7 @@ type Client struct { VirtualNetworkRules *virtualnetworkrules.VirtualNetworkRulesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { checkNameAvailabilityClient, err := checknameavailability.NewCheckNameAvailabilityClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CheckNameAvailability client: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/configurations/client.go b/resource-manager/mariadb/2018-06-01-preview/configurations/client.go index c2b3df6d8b8..b4d8c5d31c3 100644 --- a/resource-manager/mariadb/2018-06-01-preview/configurations/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/configurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationsClient struct { Client *resourcemanager.Client } -func NewConfigurationsClientWithBaseURI(api environments.Api) (*ConfigurationsClient, error) { +func NewConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationsClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/databases/client.go b/resource-manager/mariadb/2018-06-01-preview/databases/client.go index bb94a331f78..6f48891ebd3 100644 --- a/resource-manager/mariadb/2018-06-01-preview/databases/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/databases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabasesClient struct { Client *resourcemanager.Client } -func NewDatabasesClientWithBaseURI(api environments.Api) (*DatabasesClient, error) { +func NewDatabasesClientWithBaseURI(api sdkEnv.Api) (*DatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/firewallrules/client.go b/resource-manager/mariadb/2018-06-01-preview/firewallrules/client.go index 6493e429eb1..86eebdae36a 100644 --- a/resource-manager/mariadb/2018-06-01-preview/firewallrules/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallRulesClient struct { Client *resourcemanager.Client } -func NewFirewallRulesClientWithBaseURI(api environments.Api) (*FirewallRulesClient, error) { +func NewFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/locationbasedperformancetier/client.go b/resource-manager/mariadb/2018-06-01-preview/locationbasedperformancetier/client.go index 19b246da183..d282ac8973e 100644 --- a/resource-manager/mariadb/2018-06-01-preview/locationbasedperformancetier/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/locationbasedperformancetier/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationBasedPerformanceTierClient struct { Client *resourcemanager.Client } -func NewLocationBasedPerformanceTierClientWithBaseURI(api environments.Api) (*LocationBasedPerformanceTierClient, error) { +func NewLocationBasedPerformanceTierClientWithBaseURI(api sdkEnv.Api) (*LocationBasedPerformanceTierClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locationbasedperformancetier", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationBasedPerformanceTierClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/logfiles/client.go b/resource-manager/mariadb/2018-06-01-preview/logfiles/client.go index 99d5dad075a..c63ea513661 100644 --- a/resource-manager/mariadb/2018-06-01-preview/logfiles/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/logfiles/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LogFilesClient struct { Client *resourcemanager.Client } -func NewLogFilesClientWithBaseURI(api environments.Api) (*LogFilesClient, error) { +func NewLogFilesClientWithBaseURI(api sdkEnv.Api) (*LogFilesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "logfiles", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LogFilesClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/recoverableservers/client.go b/resource-manager/mariadb/2018-06-01-preview/recoverableservers/client.go index 32e42bde993..97f305973ec 100644 --- a/resource-manager/mariadb/2018-06-01-preview/recoverableservers/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/recoverableservers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecoverableServersClient struct { Client *resourcemanager.Client } -func NewRecoverableServersClientWithBaseURI(api environments.Api) (*RecoverableServersClient, error) { +func NewRecoverableServersClientWithBaseURI(api sdkEnv.Api) (*RecoverableServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recoverableservers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecoverableServersClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/replicas/client.go b/resource-manager/mariadb/2018-06-01-preview/replicas/client.go index 084e9f43436..75f97ea346f 100644 --- a/resource-manager/mariadb/2018-06-01-preview/replicas/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/replicas/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReplicasClient struct { Client *resourcemanager.Client } -func NewReplicasClientWithBaseURI(api environments.Api) (*ReplicasClient, error) { +func NewReplicasClientWithBaseURI(api sdkEnv.Api) (*ReplicasClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "replicas", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReplicasClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/serverbasedperformancetier/client.go b/resource-manager/mariadb/2018-06-01-preview/serverbasedperformancetier/client.go index 31c80dd0f84..785616f14b8 100644 --- a/resource-manager/mariadb/2018-06-01-preview/serverbasedperformancetier/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/serverbasedperformancetier/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerBasedPerformanceTierClient struct { Client *resourcemanager.Client } -func NewServerBasedPerformanceTierClientWithBaseURI(api environments.Api) (*ServerBasedPerformanceTierClient, error) { +func NewServerBasedPerformanceTierClientWithBaseURI(api sdkEnv.Api) (*ServerBasedPerformanceTierClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverbasedperformancetier", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerBasedPerformanceTierClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/serverrestart/client.go b/resource-manager/mariadb/2018-06-01-preview/serverrestart/client.go index dda19ef0b54..898ac1f7eb0 100644 --- a/resource-manager/mariadb/2018-06-01-preview/serverrestart/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/serverrestart/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerRestartClient struct { Client *resourcemanager.Client } -func NewServerRestartClientWithBaseURI(api environments.Api) (*ServerRestartClient, error) { +func NewServerRestartClientWithBaseURI(api sdkEnv.Api) (*ServerRestartClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverrestart", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerRestartClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/servers/client.go b/resource-manager/mariadb/2018-06-01-preview/servers/client.go index a1e11668771..0788963b1fb 100644 --- a/resource-manager/mariadb/2018-06-01-preview/servers/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/servers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServersClient struct { Client *resourcemanager.Client } -func NewServersClientWithBaseURI(api environments.Api) (*ServersClient, error) { +func NewServersClientWithBaseURI(api sdkEnv.Api) (*ServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServersClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/serversecurityalertpolicies/client.go b/resource-manager/mariadb/2018-06-01-preview/serversecurityalertpolicies/client.go index 39566058ad5..14a7b7cdb0b 100644 --- a/resource-manager/mariadb/2018-06-01-preview/serversecurityalertpolicies/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/serversecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewServerSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*ServerSecurityAlertPoliciesClient, error) { +func NewServerSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*ServerSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serversecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/updateconfigurations/client.go b/resource-manager/mariadb/2018-06-01-preview/updateconfigurations/client.go index 8b5d90ffbc2..af6cde3f1a7 100644 --- a/resource-manager/mariadb/2018-06-01-preview/updateconfigurations/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/updateconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UpdateConfigurationsClient struct { Client *resourcemanager.Client } -func NewUpdateConfigurationsClientWithBaseURI(api environments.Api) (*UpdateConfigurationsClient, error) { +func NewUpdateConfigurationsClientWithBaseURI(api sdkEnv.Api) (*UpdateConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "updateconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UpdateConfigurationsClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/client.go b/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/client.go index b85d828ef86..6c65981bc1c 100644 --- a/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/client.go +++ b/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkRulesClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkRulesClientWithBaseURI(api environments.Api) (*VirtualNetworkRulesClient, error) { +func NewVirtualNetworkRulesClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworkrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkRulesClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/advisors/client.go b/resource-manager/mariadb/2018-06-01/advisors/client.go index 7381a4ec842..1565838a763 100644 --- a/resource-manager/mariadb/2018-06-01/advisors/client.go +++ b/resource-manager/mariadb/2018-06-01/advisors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AdvisorsClient struct { Client *resourcemanager.Client } -func NewAdvisorsClientWithBaseURI(api environments.Api) (*AdvisorsClient, error) { +func NewAdvisorsClientWithBaseURI(api sdkEnv.Api) (*AdvisorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "advisors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AdvisorsClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/checknameavailability/client.go b/resource-manager/mariadb/2018-06-01/checknameavailability/client.go index 81c73505778..5610e27c123 100644 --- a/resource-manager/mariadb/2018-06-01/checknameavailability/client.go +++ b/resource-manager/mariadb/2018-06-01/checknameavailability/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityClient, error) { +func NewCheckNameAvailabilityClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailability", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/client.go b/resource-manager/mariadb/2018-06-01/client.go index 0d572ad13cf..a31b5e4735a 100644 --- a/resource-manager/mariadb/2018-06-01/client.go +++ b/resource-manager/mariadb/2018-06-01/client.go @@ -31,7 +31,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules" "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/waitstatistics" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -61,7 +61,7 @@ type Client struct { WaitStatistics *waitstatistics.WaitStatisticsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { advisorsClient, err := advisors.NewAdvisorsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Advisors client: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/configurations/client.go b/resource-manager/mariadb/2018-06-01/configurations/client.go index c2b3df6d8b8..b4d8c5d31c3 100644 --- a/resource-manager/mariadb/2018-06-01/configurations/client.go +++ b/resource-manager/mariadb/2018-06-01/configurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationsClient struct { Client *resourcemanager.Client } -func NewConfigurationsClientWithBaseURI(api environments.Api) (*ConfigurationsClient, error) { +func NewConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationsClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/configurationsupdate/client.go b/resource-manager/mariadb/2018-06-01/configurationsupdate/client.go index fa7b7054be9..d5fd8e4743f 100644 --- a/resource-manager/mariadb/2018-06-01/configurationsupdate/client.go +++ b/resource-manager/mariadb/2018-06-01/configurationsupdate/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationsUpdateClient struct { Client *resourcemanager.Client } -func NewConfigurationsUpdateClientWithBaseURI(api environments.Api) (*ConfigurationsUpdateClient, error) { +func NewConfigurationsUpdateClientWithBaseURI(api sdkEnv.Api) (*ConfigurationsUpdateClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurationsupdate", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationsUpdateClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/databases/client.go b/resource-manager/mariadb/2018-06-01/databases/client.go index bb94a331f78..6f48891ebd3 100644 --- a/resource-manager/mariadb/2018-06-01/databases/client.go +++ b/resource-manager/mariadb/2018-06-01/databases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabasesClient struct { Client *resourcemanager.Client } -func NewDatabasesClientWithBaseURI(api environments.Api) (*DatabasesClient, error) { +func NewDatabasesClientWithBaseURI(api sdkEnv.Api) (*DatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/firewallrules/client.go b/resource-manager/mariadb/2018-06-01/firewallrules/client.go index 6493e429eb1..86eebdae36a 100644 --- a/resource-manager/mariadb/2018-06-01/firewallrules/client.go +++ b/resource-manager/mariadb/2018-06-01/firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallRulesClient struct { Client *resourcemanager.Client } -func NewFirewallRulesClientWithBaseURI(api environments.Api) (*FirewallRulesClient, error) { +func NewFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/locationbasedperformancetier/client.go b/resource-manager/mariadb/2018-06-01/locationbasedperformancetier/client.go index 19b246da183..d282ac8973e 100644 --- a/resource-manager/mariadb/2018-06-01/locationbasedperformancetier/client.go +++ b/resource-manager/mariadb/2018-06-01/locationbasedperformancetier/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationBasedPerformanceTierClient struct { Client *resourcemanager.Client } -func NewLocationBasedPerformanceTierClientWithBaseURI(api environments.Api) (*LocationBasedPerformanceTierClient, error) { +func NewLocationBasedPerformanceTierClientWithBaseURI(api sdkEnv.Api) (*LocationBasedPerformanceTierClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locationbasedperformancetier", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationBasedPerformanceTierClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/locationbasedrecommendedactionsessionsresult/client.go b/resource-manager/mariadb/2018-06-01/locationbasedrecommendedactionsessionsresult/client.go index 37d30614e25..e1cb7858f79 100644 --- a/resource-manager/mariadb/2018-06-01/locationbasedrecommendedactionsessionsresult/client.go +++ b/resource-manager/mariadb/2018-06-01/locationbasedrecommendedactionsessionsresult/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationBasedRecommendedActionSessionsResultClient struct { Client *resourcemanager.Client } -func NewLocationBasedRecommendedActionSessionsResultClientWithBaseURI(api environments.Api) (*LocationBasedRecommendedActionSessionsResultClient, error) { +func NewLocationBasedRecommendedActionSessionsResultClientWithBaseURI(api sdkEnv.Api) (*LocationBasedRecommendedActionSessionsResultClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locationbasedrecommendedactionsessionsresult", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationBasedRecommendedActionSessionsResultClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/logfiles/client.go b/resource-manager/mariadb/2018-06-01/logfiles/client.go index 99d5dad075a..c63ea513661 100644 --- a/resource-manager/mariadb/2018-06-01/logfiles/client.go +++ b/resource-manager/mariadb/2018-06-01/logfiles/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LogFilesClient struct { Client *resourcemanager.Client } -func NewLogFilesClientWithBaseURI(api environments.Api) (*LogFilesClient, error) { +func NewLogFilesClientWithBaseURI(api sdkEnv.Api) (*LogFilesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "logfiles", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LogFilesClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/privateendpointconnections/client.go b/resource-manager/mariadb/2018-06-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/mariadb/2018-06-01/privateendpointconnections/client.go +++ b/resource-manager/mariadb/2018-06-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/privatelinkresources/client.go b/resource-manager/mariadb/2018-06-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/mariadb/2018-06-01/privatelinkresources/client.go +++ b/resource-manager/mariadb/2018-06-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/querytexts/client.go b/resource-manager/mariadb/2018-06-01/querytexts/client.go index 7cc6f74056c..a11ba0a9148 100644 --- a/resource-manager/mariadb/2018-06-01/querytexts/client.go +++ b/resource-manager/mariadb/2018-06-01/querytexts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QueryTextsClient struct { Client *resourcemanager.Client } -func NewQueryTextsClientWithBaseURI(api environments.Api) (*QueryTextsClient, error) { +func NewQueryTextsClientWithBaseURI(api sdkEnv.Api) (*QueryTextsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "querytexts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QueryTextsClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/recommendedactions/client.go b/resource-manager/mariadb/2018-06-01/recommendedactions/client.go index 59196292ae1..e1bc24725fc 100644 --- a/resource-manager/mariadb/2018-06-01/recommendedactions/client.go +++ b/resource-manager/mariadb/2018-06-01/recommendedactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecommendedActionsClient struct { Client *resourcemanager.Client } -func NewRecommendedActionsClientWithBaseURI(api environments.Api) (*RecommendedActionsClient, error) { +func NewRecommendedActionsClientWithBaseURI(api sdkEnv.Api) (*RecommendedActionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recommendedactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecommendedActionsClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/recommendedactionsessions/client.go b/resource-manager/mariadb/2018-06-01/recommendedactionsessions/client.go index 060fbe9d5b8..6f5757cb3b3 100644 --- a/resource-manager/mariadb/2018-06-01/recommendedactionsessions/client.go +++ b/resource-manager/mariadb/2018-06-01/recommendedactionsessions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecommendedActionSessionsClient struct { Client *resourcemanager.Client } -func NewRecommendedActionSessionsClientWithBaseURI(api environments.Api) (*RecommendedActionSessionsClient, error) { +func NewRecommendedActionSessionsClientWithBaseURI(api sdkEnv.Api) (*RecommendedActionSessionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recommendedactionsessions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecommendedActionSessionsClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/recoverableservers/client.go b/resource-manager/mariadb/2018-06-01/recoverableservers/client.go index 32e42bde993..97f305973ec 100644 --- a/resource-manager/mariadb/2018-06-01/recoverableservers/client.go +++ b/resource-manager/mariadb/2018-06-01/recoverableservers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecoverableServersClient struct { Client *resourcemanager.Client } -func NewRecoverableServersClientWithBaseURI(api environments.Api) (*RecoverableServersClient, error) { +func NewRecoverableServersClientWithBaseURI(api sdkEnv.Api) (*RecoverableServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recoverableservers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecoverableServersClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/replicas/client.go b/resource-manager/mariadb/2018-06-01/replicas/client.go index 084e9f43436..75f97ea346f 100644 --- a/resource-manager/mariadb/2018-06-01/replicas/client.go +++ b/resource-manager/mariadb/2018-06-01/replicas/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReplicasClient struct { Client *resourcemanager.Client } -func NewReplicasClientWithBaseURI(api environments.Api) (*ReplicasClient, error) { +func NewReplicasClientWithBaseURI(api sdkEnv.Api) (*ReplicasClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "replicas", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReplicasClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/resetqueryperformanceinsightdata/client.go b/resource-manager/mariadb/2018-06-01/resetqueryperformanceinsightdata/client.go index 770ba4cef11..8da2e444925 100644 --- a/resource-manager/mariadb/2018-06-01/resetqueryperformanceinsightdata/client.go +++ b/resource-manager/mariadb/2018-06-01/resetqueryperformanceinsightdata/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResetQueryPerformanceInsightDataClient struct { Client *resourcemanager.Client } -func NewResetQueryPerformanceInsightDataClientWithBaseURI(api environments.Api) (*ResetQueryPerformanceInsightDataClient, error) { +func NewResetQueryPerformanceInsightDataClientWithBaseURI(api sdkEnv.Api) (*ResetQueryPerformanceInsightDataClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resetqueryperformanceinsightdata", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResetQueryPerformanceInsightDataClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/serverbasedperformancetier/client.go b/resource-manager/mariadb/2018-06-01/serverbasedperformancetier/client.go index 31c80dd0f84..785616f14b8 100644 --- a/resource-manager/mariadb/2018-06-01/serverbasedperformancetier/client.go +++ b/resource-manager/mariadb/2018-06-01/serverbasedperformancetier/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerBasedPerformanceTierClient struct { Client *resourcemanager.Client } -func NewServerBasedPerformanceTierClientWithBaseURI(api environments.Api) (*ServerBasedPerformanceTierClient, error) { +func NewServerBasedPerformanceTierClientWithBaseURI(api sdkEnv.Api) (*ServerBasedPerformanceTierClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverbasedperformancetier", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerBasedPerformanceTierClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/serverrestart/client.go b/resource-manager/mariadb/2018-06-01/serverrestart/client.go index dda19ef0b54..898ac1f7eb0 100644 --- a/resource-manager/mariadb/2018-06-01/serverrestart/client.go +++ b/resource-manager/mariadb/2018-06-01/serverrestart/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerRestartClient struct { Client *resourcemanager.Client } -func NewServerRestartClientWithBaseURI(api environments.Api) (*ServerRestartClient, error) { +func NewServerRestartClientWithBaseURI(api sdkEnv.Api) (*ServerRestartClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverrestart", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerRestartClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/servers/client.go b/resource-manager/mariadb/2018-06-01/servers/client.go index a1e11668771..0788963b1fb 100644 --- a/resource-manager/mariadb/2018-06-01/servers/client.go +++ b/resource-manager/mariadb/2018-06-01/servers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServersClient struct { Client *resourcemanager.Client } -func NewServersClientWithBaseURI(api environments.Api) (*ServersClient, error) { +func NewServersClientWithBaseURI(api sdkEnv.Api) (*ServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServersClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/serversecurityalertpolicies/client.go b/resource-manager/mariadb/2018-06-01/serversecurityalertpolicies/client.go index 39566058ad5..14a7b7cdb0b 100644 --- a/resource-manager/mariadb/2018-06-01/serversecurityalertpolicies/client.go +++ b/resource-manager/mariadb/2018-06-01/serversecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewServerSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*ServerSecurityAlertPoliciesClient, error) { +func NewServerSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*ServerSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serversecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/topquerystatistics/client.go b/resource-manager/mariadb/2018-06-01/topquerystatistics/client.go index 1e155ee4048..a511e38d394 100644 --- a/resource-manager/mariadb/2018-06-01/topquerystatistics/client.go +++ b/resource-manager/mariadb/2018-06-01/topquerystatistics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TopQueryStatisticsClient struct { Client *resourcemanager.Client } -func NewTopQueryStatisticsClientWithBaseURI(api environments.Api) (*TopQueryStatisticsClient, error) { +func NewTopQueryStatisticsClientWithBaseURI(api sdkEnv.Api) (*TopQueryStatisticsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "topquerystatistics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TopQueryStatisticsClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/virtualnetworkrules/client.go b/resource-manager/mariadb/2018-06-01/virtualnetworkrules/client.go index b85d828ef86..6c65981bc1c 100644 --- a/resource-manager/mariadb/2018-06-01/virtualnetworkrules/client.go +++ b/resource-manager/mariadb/2018-06-01/virtualnetworkrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkRulesClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkRulesClientWithBaseURI(api environments.Api) (*VirtualNetworkRulesClient, error) { +func NewVirtualNetworkRulesClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworkrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkRulesClient: %+v", err) diff --git a/resource-manager/mariadb/2018-06-01/waitstatistics/client.go b/resource-manager/mariadb/2018-06-01/waitstatistics/client.go index 1a478d40bc0..fd50bd4b1eb 100644 --- a/resource-manager/mariadb/2018-06-01/waitstatistics/client.go +++ b/resource-manager/mariadb/2018-06-01/waitstatistics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WaitStatisticsClient struct { Client *resourcemanager.Client } -func NewWaitStatisticsClientWithBaseURI(api environments.Api) (*WaitStatisticsClient, error) { +func NewWaitStatisticsClientWithBaseURI(api sdkEnv.Api) (*WaitStatisticsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "waitstatistics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WaitStatisticsClient: %+v", err) diff --git a/resource-manager/mariadb/2020-01-01/client.go b/resource-manager/mariadb/2020-01-01/client.go index 6e3f82cb6d5..63f17eb40d4 100644 --- a/resource-manager/mariadb/2020-01-01/client.go +++ b/resource-manager/mariadb/2020-01-01/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2020-01-01/serverstart" "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2020-01-01/serverstop" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { ServerStop *serverstop.ServerStopClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { serverStartClient, err := serverstart.NewServerStartClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ServerStart client: %+v", err) diff --git a/resource-manager/mariadb/2020-01-01/serverstart/client.go b/resource-manager/mariadb/2020-01-01/serverstart/client.go index f24d38e00f9..58e29091c2a 100644 --- a/resource-manager/mariadb/2020-01-01/serverstart/client.go +++ b/resource-manager/mariadb/2020-01-01/serverstart/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerStartClient struct { Client *resourcemanager.Client } -func NewServerStartClientWithBaseURI(api environments.Api) (*ServerStartClient, error) { +func NewServerStartClientWithBaseURI(api sdkEnv.Api) (*ServerStartClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverstart", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerStartClient: %+v", err) diff --git a/resource-manager/mariadb/2020-01-01/serverstop/client.go b/resource-manager/mariadb/2020-01-01/serverstop/client.go index c47cb0e7335..963c73af50c 100644 --- a/resource-manager/mariadb/2020-01-01/serverstop/client.go +++ b/resource-manager/mariadb/2020-01-01/serverstop/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerStopClient struct { Client *resourcemanager.Client } -func NewServerStopClientWithBaseURI(api environments.Api) (*ServerStopClient, error) { +func NewServerStopClientWithBaseURI(api sdkEnv.Api) (*ServerStopClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverstop", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerStopClient: %+v", err) diff --git a/resource-manager/marketplaceordering/2015-06-01/agreements/client.go b/resource-manager/marketplaceordering/2015-06-01/agreements/client.go index 51de79b933c..40cdf7641ce 100644 --- a/resource-manager/marketplaceordering/2015-06-01/agreements/client.go +++ b/resource-manager/marketplaceordering/2015-06-01/agreements/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AgreementsClient struct { Client *resourcemanager.Client } -func NewAgreementsClientWithBaseURI(api environments.Api) (*AgreementsClient, error) { +func NewAgreementsClientWithBaseURI(api sdkEnv.Api) (*AgreementsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "agreements", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AgreementsClient: %+v", err) diff --git a/resource-manager/marketplaceordering/2015-06-01/client.go b/resource-manager/marketplaceordering/2015-06-01/client.go index 468adf8252d..4d18ef35583 100644 --- a/resource-manager/marketplaceordering/2015-06-01/client.go +++ b/resource-manager/marketplaceordering/2015-06-01/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/marketplaceordering/2015-06-01/agreements" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { Agreements *agreements.AgreementsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { agreementsClient, err := agreements.NewAgreementsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Agreements client: %+v", err) diff --git a/resource-manager/marketplaceordering/2021-01-01/agreements/client.go b/resource-manager/marketplaceordering/2021-01-01/agreements/client.go index 51de79b933c..40cdf7641ce 100644 --- a/resource-manager/marketplaceordering/2021-01-01/agreements/client.go +++ b/resource-manager/marketplaceordering/2021-01-01/agreements/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AgreementsClient struct { Client *resourcemanager.Client } -func NewAgreementsClientWithBaseURI(api environments.Api) (*AgreementsClient, error) { +func NewAgreementsClientWithBaseURI(api sdkEnv.Api) (*AgreementsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "agreements", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AgreementsClient: %+v", err) diff --git a/resource-manager/marketplaceordering/2021-01-01/client.go b/resource-manager/marketplaceordering/2021-01-01/client.go index f396628de64..02716e476ee 100644 --- a/resource-manager/marketplaceordering/2021-01-01/client.go +++ b/resource-manager/marketplaceordering/2021-01-01/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/marketplaceordering/2021-01-01/agreements" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { Agreements *agreements.AgreementsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { agreementsClient, err := agreements.NewAgreementsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Agreements client: %+v", err) diff --git a/resource-manager/media/2021-11-01/accountfilters/client.go b/resource-manager/media/2021-11-01/accountfilters/client.go index 8680ee0070d..9d772290865 100644 --- a/resource-manager/media/2021-11-01/accountfilters/client.go +++ b/resource-manager/media/2021-11-01/accountfilters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccountFiltersClient struct { Client *resourcemanager.Client } -func NewAccountFiltersClientWithBaseURI(api environments.Api) (*AccountFiltersClient, error) { +func NewAccountFiltersClientWithBaseURI(api sdkEnv.Api) (*AccountFiltersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "accountfilters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccountFiltersClient: %+v", err) diff --git a/resource-manager/media/2021-11-01/accounts/client.go b/resource-manager/media/2021-11-01/accounts/client.go index c227130d6c6..443dca551fe 100644 --- a/resource-manager/media/2021-11-01/accounts/client.go +++ b/resource-manager/media/2021-11-01/accounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccountsClient struct { Client *resourcemanager.Client } -func NewAccountsClientWithBaseURI(api environments.Api) (*AccountsClient, error) { +func NewAccountsClientWithBaseURI(api sdkEnv.Api) (*AccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "accounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccountsClient: %+v", err) diff --git a/resource-manager/media/2021-11-01/assetsandassetfilters/client.go b/resource-manager/media/2021-11-01/assetsandassetfilters/client.go index 9281e3acf30..3ad30c8e396 100644 --- a/resource-manager/media/2021-11-01/assetsandassetfilters/client.go +++ b/resource-manager/media/2021-11-01/assetsandassetfilters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AssetsAndAssetFiltersClient struct { Client *resourcemanager.Client } -func NewAssetsAndAssetFiltersClientWithBaseURI(api environments.Api) (*AssetsAndAssetFiltersClient, error) { +func NewAssetsAndAssetFiltersClientWithBaseURI(api sdkEnv.Api) (*AssetsAndAssetFiltersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "assetsandassetfilters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AssetsAndAssetFiltersClient: %+v", err) diff --git a/resource-manager/media/2021-11-01/client.go b/resource-manager/media/2021-11-01/client.go index b6ddbdfa4e6..8d188d49071 100644 --- a/resource-manager/media/2021-11-01/client.go +++ b/resource-manager/media/2021-11-01/client.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints" "github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -31,7 +31,7 @@ type Client struct { StreamingPoliciesAndStreamingLocators *streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { accountFiltersClient, err := accountfilters.NewAccountFiltersClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AccountFilters client: %+v", err) diff --git a/resource-manager/media/2021-11-01/contentkeypolicies/client.go b/resource-manager/media/2021-11-01/contentkeypolicies/client.go index 447225c35c9..9dc48873a97 100644 --- a/resource-manager/media/2021-11-01/contentkeypolicies/client.go +++ b/resource-manager/media/2021-11-01/contentkeypolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ContentKeyPoliciesClient struct { Client *resourcemanager.Client } -func NewContentKeyPoliciesClientWithBaseURI(api environments.Api) (*ContentKeyPoliciesClient, error) { +func NewContentKeyPoliciesClientWithBaseURI(api sdkEnv.Api) (*ContentKeyPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "contentkeypolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ContentKeyPoliciesClient: %+v", err) diff --git a/resource-manager/media/2021-11-01/encodings/client.go b/resource-manager/media/2021-11-01/encodings/client.go index e6efacb5e83..b5e8034c459 100644 --- a/resource-manager/media/2021-11-01/encodings/client.go +++ b/resource-manager/media/2021-11-01/encodings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EncodingsClient struct { Client *resourcemanager.Client } -func NewEncodingsClientWithBaseURI(api environments.Api) (*EncodingsClient, error) { +func NewEncodingsClientWithBaseURI(api sdkEnv.Api) (*EncodingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "encodings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EncodingsClient: %+v", err) diff --git a/resource-manager/media/2021-11-01/liveevents/client.go b/resource-manager/media/2021-11-01/liveevents/client.go index ad99a28a9aa..0f464821955 100644 --- a/resource-manager/media/2021-11-01/liveevents/client.go +++ b/resource-manager/media/2021-11-01/liveevents/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LiveEventsClient struct { Client *resourcemanager.Client } -func NewLiveEventsClientWithBaseURI(api environments.Api) (*LiveEventsClient, error) { +func NewLiveEventsClientWithBaseURI(api sdkEnv.Api) (*LiveEventsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "liveevents", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LiveEventsClient: %+v", err) diff --git a/resource-manager/media/2021-11-01/liveoutputs/client.go b/resource-manager/media/2021-11-01/liveoutputs/client.go index 655a497256c..7a85a924028 100644 --- a/resource-manager/media/2021-11-01/liveoutputs/client.go +++ b/resource-manager/media/2021-11-01/liveoutputs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LiveOutputsClient struct { Client *resourcemanager.Client } -func NewLiveOutputsClientWithBaseURI(api environments.Api) (*LiveOutputsClient, error) { +func NewLiveOutputsClientWithBaseURI(api sdkEnv.Api) (*LiveOutputsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "liveoutputs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LiveOutputsClient: %+v", err) diff --git a/resource-manager/media/2021-11-01/streamingendpoints/client.go b/resource-manager/media/2021-11-01/streamingendpoints/client.go index 3d83eb47655..7f44ec0738b 100644 --- a/resource-manager/media/2021-11-01/streamingendpoints/client.go +++ b/resource-manager/media/2021-11-01/streamingendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StreamingEndpointsClient struct { Client *resourcemanager.Client } -func NewStreamingEndpointsClientWithBaseURI(api environments.Api) (*StreamingEndpointsClient, error) { +func NewStreamingEndpointsClientWithBaseURI(api sdkEnv.Api) (*StreamingEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "streamingendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StreamingEndpointsClient: %+v", err) diff --git a/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/client.go b/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/client.go index 190fbb4f334..27890adda21 100644 --- a/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/client.go +++ b/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StreamingPoliciesAndStreamingLocatorsClient struct { Client *resourcemanager.Client } -func NewStreamingPoliciesAndStreamingLocatorsClientWithBaseURI(api environments.Api) (*StreamingPoliciesAndStreamingLocatorsClient, error) { +func NewStreamingPoliciesAndStreamingLocatorsClientWithBaseURI(api sdkEnv.Api) (*StreamingPoliciesAndStreamingLocatorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "streamingpoliciesandstreaminglocators", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StreamingPoliciesAndStreamingLocatorsClient: %+v", err) diff --git a/resource-manager/media/2022-07-01/client.go b/resource-manager/media/2022-07-01/client.go index ef365d1e7d7..422bd5d627b 100644 --- a/resource-manager/media/2022-07-01/client.go +++ b/resource-manager/media/2022-07-01/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-07-01/encodings" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { Encodings *encodings.EncodingsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { encodingsClient, err := encodings.NewEncodingsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Encodings client: %+v", err) diff --git a/resource-manager/media/2022-07-01/encodings/client.go b/resource-manager/media/2022-07-01/encodings/client.go index e6efacb5e83..b5e8034c459 100644 --- a/resource-manager/media/2022-07-01/encodings/client.go +++ b/resource-manager/media/2022-07-01/encodings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EncodingsClient struct { Client *resourcemanager.Client } -func NewEncodingsClientWithBaseURI(api environments.Api) (*EncodingsClient, error) { +func NewEncodingsClientWithBaseURI(api sdkEnv.Api) (*EncodingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "encodings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EncodingsClient: %+v", err) diff --git a/resource-manager/media/2022-08-01/accountfilters/client.go b/resource-manager/media/2022-08-01/accountfilters/client.go index 8680ee0070d..9d772290865 100644 --- a/resource-manager/media/2022-08-01/accountfilters/client.go +++ b/resource-manager/media/2022-08-01/accountfilters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccountFiltersClient struct { Client *resourcemanager.Client } -func NewAccountFiltersClientWithBaseURI(api environments.Api) (*AccountFiltersClient, error) { +func NewAccountFiltersClientWithBaseURI(api sdkEnv.Api) (*AccountFiltersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "accountfilters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccountFiltersClient: %+v", err) diff --git a/resource-manager/media/2022-08-01/assetsandassetfilters/client.go b/resource-manager/media/2022-08-01/assetsandassetfilters/client.go index 9281e3acf30..3ad30c8e396 100644 --- a/resource-manager/media/2022-08-01/assetsandassetfilters/client.go +++ b/resource-manager/media/2022-08-01/assetsandassetfilters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AssetsAndAssetFiltersClient struct { Client *resourcemanager.Client } -func NewAssetsAndAssetFiltersClientWithBaseURI(api environments.Api) (*AssetsAndAssetFiltersClient, error) { +func NewAssetsAndAssetFiltersClientWithBaseURI(api sdkEnv.Api) (*AssetsAndAssetFiltersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "assetsandassetfilters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AssetsAndAssetFiltersClient: %+v", err) diff --git a/resource-manager/media/2022-08-01/client.go b/resource-manager/media/2022-08-01/client.go index 08c8c985e15..acf66ea9ca9 100644 --- a/resource-manager/media/2022-08-01/client.go +++ b/resource-manager/media/2022-08-01/client.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints" "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -27,7 +27,7 @@ type Client struct { StreamingPoliciesAndStreamingLocators *streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { accountFiltersClient, err := accountfilters.NewAccountFiltersClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AccountFilters client: %+v", err) diff --git a/resource-manager/media/2022-08-01/contentkeypolicies/client.go b/resource-manager/media/2022-08-01/contentkeypolicies/client.go index 447225c35c9..9dc48873a97 100644 --- a/resource-manager/media/2022-08-01/contentkeypolicies/client.go +++ b/resource-manager/media/2022-08-01/contentkeypolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ContentKeyPoliciesClient struct { Client *resourcemanager.Client } -func NewContentKeyPoliciesClientWithBaseURI(api environments.Api) (*ContentKeyPoliciesClient, error) { +func NewContentKeyPoliciesClientWithBaseURI(api sdkEnv.Api) (*ContentKeyPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "contentkeypolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ContentKeyPoliciesClient: %+v", err) diff --git a/resource-manager/media/2022-08-01/liveevents/client.go b/resource-manager/media/2022-08-01/liveevents/client.go index ad99a28a9aa..0f464821955 100644 --- a/resource-manager/media/2022-08-01/liveevents/client.go +++ b/resource-manager/media/2022-08-01/liveevents/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LiveEventsClient struct { Client *resourcemanager.Client } -func NewLiveEventsClientWithBaseURI(api environments.Api) (*LiveEventsClient, error) { +func NewLiveEventsClientWithBaseURI(api sdkEnv.Api) (*LiveEventsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "liveevents", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LiveEventsClient: %+v", err) diff --git a/resource-manager/media/2022-08-01/liveoutputs/client.go b/resource-manager/media/2022-08-01/liveoutputs/client.go index 655a497256c..7a85a924028 100644 --- a/resource-manager/media/2022-08-01/liveoutputs/client.go +++ b/resource-manager/media/2022-08-01/liveoutputs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LiveOutputsClient struct { Client *resourcemanager.Client } -func NewLiveOutputsClientWithBaseURI(api environments.Api) (*LiveOutputsClient, error) { +func NewLiveOutputsClientWithBaseURI(api sdkEnv.Api) (*LiveOutputsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "liveoutputs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LiveOutputsClient: %+v", err) diff --git a/resource-manager/media/2022-08-01/streamingendpoints/client.go b/resource-manager/media/2022-08-01/streamingendpoints/client.go index 3d83eb47655..7f44ec0738b 100644 --- a/resource-manager/media/2022-08-01/streamingendpoints/client.go +++ b/resource-manager/media/2022-08-01/streamingendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StreamingEndpointsClient struct { Client *resourcemanager.Client } -func NewStreamingEndpointsClientWithBaseURI(api environments.Api) (*StreamingEndpointsClient, error) { +func NewStreamingEndpointsClientWithBaseURI(api sdkEnv.Api) (*StreamingEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "streamingendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StreamingEndpointsClient: %+v", err) diff --git a/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/client.go b/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/client.go index 190fbb4f334..27890adda21 100644 --- a/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/client.go +++ b/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StreamingPoliciesAndStreamingLocatorsClient struct { Client *resourcemanager.Client } -func NewStreamingPoliciesAndStreamingLocatorsClientWithBaseURI(api environments.Api) (*StreamingPoliciesAndStreamingLocatorsClient, error) { +func NewStreamingPoliciesAndStreamingLocatorsClientWithBaseURI(api sdkEnv.Api) (*StreamingPoliciesAndStreamingLocatorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "streamingpoliciesandstreaminglocators", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StreamingPoliciesAndStreamingLocatorsClient: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/client.go b/resource-manager/migrate/2020-01-01/client.go index 364a7bfe880..6fa4d87aa0f 100644 --- a/resource-manager/migrate/2020-01-01/client.go +++ b/resource-manager/migrate/2020-01-01/client.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/migrate/2020-01-01/sites" "github.com/hashicorp/go-azure-sdk/resource-manager/migrate/2020-01-01/vcenter" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -35,7 +35,7 @@ type Client struct { VCenter *vcenter.VCenterClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { hyperVClusterClient, err := hypervcluster.NewHyperVClusterClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building HyperVCluster client: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/hypervcluster/client.go b/resource-manager/migrate/2020-01-01/hypervcluster/client.go index ba36ad7bd75..f280b8eed07 100644 --- a/resource-manager/migrate/2020-01-01/hypervcluster/client.go +++ b/resource-manager/migrate/2020-01-01/hypervcluster/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVClusterClient struct { Client *resourcemanager.Client } -func NewHyperVClusterClientWithBaseURI(api environments.Api) (*HyperVClusterClient, error) { +func NewHyperVClusterClientWithBaseURI(api sdkEnv.Api) (*HyperVClusterClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervcluster", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVClusterClient: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/hypervhost/client.go b/resource-manager/migrate/2020-01-01/hypervhost/client.go index 39ae774b165..99ef26d137c 100644 --- a/resource-manager/migrate/2020-01-01/hypervhost/client.go +++ b/resource-manager/migrate/2020-01-01/hypervhost/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVHostClient struct { Client *resourcemanager.Client } -func NewHyperVHostClientWithBaseURI(api environments.Api) (*HyperVHostClient, error) { +func NewHyperVHostClientWithBaseURI(api sdkEnv.Api) (*HyperVHostClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervhost", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVHostClient: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/hypervjobs/client.go b/resource-manager/migrate/2020-01-01/hypervjobs/client.go index 1efbf98a636..0f79f484ab0 100644 --- a/resource-manager/migrate/2020-01-01/hypervjobs/client.go +++ b/resource-manager/migrate/2020-01-01/hypervjobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVJobsClient struct { Client *resourcemanager.Client } -func NewHyperVJobsClientWithBaseURI(api environments.Api) (*HyperVJobsClient, error) { +func NewHyperVJobsClientWithBaseURI(api sdkEnv.Api) (*HyperVJobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervjobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVJobsClient: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/hypervmachines/client.go b/resource-manager/migrate/2020-01-01/hypervmachines/client.go index 0b1bdd9b363..23d155f17ba 100644 --- a/resource-manager/migrate/2020-01-01/hypervmachines/client.go +++ b/resource-manager/migrate/2020-01-01/hypervmachines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVMachinesClient struct { Client *resourcemanager.Client } -func NewHyperVMachinesClientWithBaseURI(api environments.Api) (*HyperVMachinesClient, error) { +func NewHyperVMachinesClientWithBaseURI(api sdkEnv.Api) (*HyperVMachinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervmachines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVMachinesClient: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/hypervrunasaccounts/client.go b/resource-manager/migrate/2020-01-01/hypervrunasaccounts/client.go index 744a35c6510..dfdc65c6d72 100644 --- a/resource-manager/migrate/2020-01-01/hypervrunasaccounts/client.go +++ b/resource-manager/migrate/2020-01-01/hypervrunasaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVRunAsAccountsClient struct { Client *resourcemanager.Client } -func NewHyperVRunAsAccountsClientWithBaseURI(api environments.Api) (*HyperVRunAsAccountsClient, error) { +func NewHyperVRunAsAccountsClientWithBaseURI(api sdkEnv.Api) (*HyperVRunAsAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervrunasaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVRunAsAccountsClient: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/hypervsites/client.go b/resource-manager/migrate/2020-01-01/hypervsites/client.go index a888c6181f9..07d93caccd0 100644 --- a/resource-manager/migrate/2020-01-01/hypervsites/client.go +++ b/resource-manager/migrate/2020-01-01/hypervsites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVSitesClient struct { Client *resourcemanager.Client } -func NewHyperVSitesClientWithBaseURI(api environments.Api) (*HyperVSitesClient, error) { +func NewHyperVSitesClientWithBaseURI(api sdkEnv.Api) (*HyperVSitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervsites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVSitesClient: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/jobs/client.go b/resource-manager/migrate/2020-01-01/jobs/client.go index e2cca931b31..a7c521817f9 100644 --- a/resource-manager/migrate/2020-01-01/jobs/client.go +++ b/resource-manager/migrate/2020-01-01/jobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobsClient struct { Client *resourcemanager.Client } -func NewJobsClientWithBaseURI(api environments.Api) (*JobsClient, error) { +func NewJobsClientWithBaseURI(api sdkEnv.Api) (*JobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobsClient: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/machines/client.go b/resource-manager/migrate/2020-01-01/machines/client.go index 80e10f009c7..32808dc28be 100644 --- a/resource-manager/migrate/2020-01-01/machines/client.go +++ b/resource-manager/migrate/2020-01-01/machines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MachinesClient struct { Client *resourcemanager.Client } -func NewMachinesClientWithBaseURI(api environments.Api) (*MachinesClient, error) { +func NewMachinesClientWithBaseURI(api sdkEnv.Api) (*MachinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "machines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MachinesClient: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/runasaccounts/client.go b/resource-manager/migrate/2020-01-01/runasaccounts/client.go index d117011f8e5..0bab4f7c041 100644 --- a/resource-manager/migrate/2020-01-01/runasaccounts/client.go +++ b/resource-manager/migrate/2020-01-01/runasaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RunAsAccountsClient struct { Client *resourcemanager.Client } -func NewRunAsAccountsClientWithBaseURI(api environments.Api) (*RunAsAccountsClient, error) { +func NewRunAsAccountsClientWithBaseURI(api sdkEnv.Api) (*RunAsAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "runasaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RunAsAccountsClient: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/sites/client.go b/resource-manager/migrate/2020-01-01/sites/client.go index c5dde7e475d..02d986c1713 100644 --- a/resource-manager/migrate/2020-01-01/sites/client.go +++ b/resource-manager/migrate/2020-01-01/sites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SitesClient struct { Client *resourcemanager.Client } -func NewSitesClientWithBaseURI(api environments.Api) (*SitesClient, error) { +func NewSitesClientWithBaseURI(api sdkEnv.Api) (*SitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SitesClient: %+v", err) diff --git a/resource-manager/migrate/2020-01-01/vcenter/client.go b/resource-manager/migrate/2020-01-01/vcenter/client.go index d5b471e842e..af8d796db66 100644 --- a/resource-manager/migrate/2020-01-01/vcenter/client.go +++ b/resource-manager/migrate/2020-01-01/vcenter/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VCenterClient struct { Client *resourcemanager.Client } -func NewVCenterClientWithBaseURI(api environments.Api) (*VCenterClient, error) { +func NewVCenterClientWithBaseURI(api sdkEnv.Api) (*VCenterClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vcenter", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VCenterClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/client.go b/resource-manager/migrate/2020-07-07/client.go index f1969d75ff9..dfc6bff3043 100644 --- a/resource-manager/migrate/2020-07-07/client.go +++ b/resource-manager/migrate/2020-07-07/client.go @@ -22,7 +22,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/migrate/2020-07-07/sites" "github.com/hashicorp/go-azure-sdk/resource-manager/migrate/2020-07-07/vcenter" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -43,7 +43,7 @@ type Client struct { VCenter *vcenter.VCenterClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { hyperVClusterClient, err := hypervcluster.NewHyperVClusterClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building HyperVCluster client: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/hypervcluster/client.go b/resource-manager/migrate/2020-07-07/hypervcluster/client.go index ba36ad7bd75..f280b8eed07 100644 --- a/resource-manager/migrate/2020-07-07/hypervcluster/client.go +++ b/resource-manager/migrate/2020-07-07/hypervcluster/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVClusterClient struct { Client *resourcemanager.Client } -func NewHyperVClusterClientWithBaseURI(api environments.Api) (*HyperVClusterClient, error) { +func NewHyperVClusterClientWithBaseURI(api sdkEnv.Api) (*HyperVClusterClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervcluster", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVClusterClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/hypervhost/client.go b/resource-manager/migrate/2020-07-07/hypervhost/client.go index 39ae774b165..99ef26d137c 100644 --- a/resource-manager/migrate/2020-07-07/hypervhost/client.go +++ b/resource-manager/migrate/2020-07-07/hypervhost/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVHostClient struct { Client *resourcemanager.Client } -func NewHyperVHostClientWithBaseURI(api environments.Api) (*HyperVHostClient, error) { +func NewHyperVHostClientWithBaseURI(api sdkEnv.Api) (*HyperVHostClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervhost", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVHostClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/hypervjobs/client.go b/resource-manager/migrate/2020-07-07/hypervjobs/client.go index 1efbf98a636..0f79f484ab0 100644 --- a/resource-manager/migrate/2020-07-07/hypervjobs/client.go +++ b/resource-manager/migrate/2020-07-07/hypervjobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVJobsClient struct { Client *resourcemanager.Client } -func NewHyperVJobsClientWithBaseURI(api environments.Api) (*HyperVJobsClient, error) { +func NewHyperVJobsClientWithBaseURI(api sdkEnv.Api) (*HyperVJobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervjobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVJobsClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/hypervmachines/client.go b/resource-manager/migrate/2020-07-07/hypervmachines/client.go index 0b1bdd9b363..23d155f17ba 100644 --- a/resource-manager/migrate/2020-07-07/hypervmachines/client.go +++ b/resource-manager/migrate/2020-07-07/hypervmachines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVMachinesClient struct { Client *resourcemanager.Client } -func NewHyperVMachinesClientWithBaseURI(api environments.Api) (*HyperVMachinesClient, error) { +func NewHyperVMachinesClientWithBaseURI(api sdkEnv.Api) (*HyperVMachinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervmachines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVMachinesClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/hypervrunasaccounts/client.go b/resource-manager/migrate/2020-07-07/hypervrunasaccounts/client.go index 744a35c6510..dfdc65c6d72 100644 --- a/resource-manager/migrate/2020-07-07/hypervrunasaccounts/client.go +++ b/resource-manager/migrate/2020-07-07/hypervrunasaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVRunAsAccountsClient struct { Client *resourcemanager.Client } -func NewHyperVRunAsAccountsClientWithBaseURI(api environments.Api) (*HyperVRunAsAccountsClient, error) { +func NewHyperVRunAsAccountsClientWithBaseURI(api sdkEnv.Api) (*HyperVRunAsAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervrunasaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVRunAsAccountsClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/hypervsites/client.go b/resource-manager/migrate/2020-07-07/hypervsites/client.go index a888c6181f9..07d93caccd0 100644 --- a/resource-manager/migrate/2020-07-07/hypervsites/client.go +++ b/resource-manager/migrate/2020-07-07/hypervsites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HyperVSitesClient struct { Client *resourcemanager.Client } -func NewHyperVSitesClientWithBaseURI(api environments.Api) (*HyperVSitesClient, error) { +func NewHyperVSitesClientWithBaseURI(api sdkEnv.Api) (*HyperVSitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hypervsites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HyperVSitesClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/jobs/client.go b/resource-manager/migrate/2020-07-07/jobs/client.go index e2cca931b31..a7c521817f9 100644 --- a/resource-manager/migrate/2020-07-07/jobs/client.go +++ b/resource-manager/migrate/2020-07-07/jobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobsClient struct { Client *resourcemanager.Client } -func NewJobsClientWithBaseURI(api environments.Api) (*JobsClient, error) { +func NewJobsClientWithBaseURI(api sdkEnv.Api) (*JobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobsClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/machines/client.go b/resource-manager/migrate/2020-07-07/machines/client.go index 80e10f009c7..32808dc28be 100644 --- a/resource-manager/migrate/2020-07-07/machines/client.go +++ b/resource-manager/migrate/2020-07-07/machines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MachinesClient struct { Client *resourcemanager.Client } -func NewMachinesClientWithBaseURI(api environments.Api) (*MachinesClient, error) { +func NewMachinesClientWithBaseURI(api sdkEnv.Api) (*MachinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "machines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MachinesClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/mastersites/client.go b/resource-manager/migrate/2020-07-07/mastersites/client.go index f71d3f2641b..cbb906f5f43 100644 --- a/resource-manager/migrate/2020-07-07/mastersites/client.go +++ b/resource-manager/migrate/2020-07-07/mastersites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MasterSitesClient struct { Client *resourcemanager.Client } -func NewMasterSitesClientWithBaseURI(api environments.Api) (*MasterSitesClient, error) { +func NewMasterSitesClientWithBaseURI(api sdkEnv.Api) (*MasterSitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "mastersites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MasterSitesClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/migrates/client.go b/resource-manager/migrate/2020-07-07/migrates/client.go index 5e37e094be5..a7ebd5336cd 100644 --- a/resource-manager/migrate/2020-07-07/migrates/client.go +++ b/resource-manager/migrate/2020-07-07/migrates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MigratesClient struct { Client *resourcemanager.Client } -func NewMigratesClientWithBaseURI(api environments.Api) (*MigratesClient, error) { +func NewMigratesClientWithBaseURI(api sdkEnv.Api) (*MigratesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "migrates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MigratesClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/privateendpointconnection/client.go b/resource-manager/migrate/2020-07-07/privateendpointconnection/client.go index 35dcdf8567e..81fa9bc3329 100644 --- a/resource-manager/migrate/2020-07-07/privateendpointconnection/client.go +++ b/resource-manager/migrate/2020-07-07/privateendpointconnection/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionClient, error) { +func NewPrivateEndpointConnectionClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnection", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/privatelinkresources/client.go b/resource-manager/migrate/2020-07-07/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/migrate/2020-07-07/privatelinkresources/client.go +++ b/resource-manager/migrate/2020-07-07/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/runasaccounts/client.go b/resource-manager/migrate/2020-07-07/runasaccounts/client.go index d117011f8e5..0bab4f7c041 100644 --- a/resource-manager/migrate/2020-07-07/runasaccounts/client.go +++ b/resource-manager/migrate/2020-07-07/runasaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RunAsAccountsClient struct { Client *resourcemanager.Client } -func NewRunAsAccountsClientWithBaseURI(api environments.Api) (*RunAsAccountsClient, error) { +func NewRunAsAccountsClientWithBaseURI(api sdkEnv.Api) (*RunAsAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "runasaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RunAsAccountsClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/sites/client.go b/resource-manager/migrate/2020-07-07/sites/client.go index c5dde7e475d..02d986c1713 100644 --- a/resource-manager/migrate/2020-07-07/sites/client.go +++ b/resource-manager/migrate/2020-07-07/sites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SitesClient struct { Client *resourcemanager.Client } -func NewSitesClientWithBaseURI(api environments.Api) (*SitesClient, error) { +func NewSitesClientWithBaseURI(api sdkEnv.Api) (*SitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SitesClient: %+v", err) diff --git a/resource-manager/migrate/2020-07-07/vcenter/client.go b/resource-manager/migrate/2020-07-07/vcenter/client.go index d5b471e842e..af8d796db66 100644 --- a/resource-manager/migrate/2020-07-07/vcenter/client.go +++ b/resource-manager/migrate/2020-07-07/vcenter/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VCenterClient struct { Client *resourcemanager.Client } -func NewVCenterClientWithBaseURI(api environments.Api) (*VCenterClient, error) { +func NewVCenterClientWithBaseURI(api sdkEnv.Api) (*VCenterClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vcenter", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VCenterClient: %+v", err) diff --git a/resource-manager/mixedreality/2021-01-01/client.go b/resource-manager/mixedreality/2021-01-01/client.go index 583ab62028b..da766798651 100644 --- a/resource-manager/mixedreality/2021-01-01/client.go +++ b/resource-manager/mixedreality/2021-01-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/proxy" "github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { Resource *resource.ResourceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { keyClient, err := key.NewKeyClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Key client: %+v", err) diff --git a/resource-manager/mixedreality/2021-01-01/key/client.go b/resource-manager/mixedreality/2021-01-01/key/client.go index 599667dd787..f91b2325321 100644 --- a/resource-manager/mixedreality/2021-01-01/key/client.go +++ b/resource-manager/mixedreality/2021-01-01/key/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type KeyClient struct { Client *resourcemanager.Client } -func NewKeyClientWithBaseURI(api environments.Api) (*KeyClient, error) { +func NewKeyClientWithBaseURI(api sdkEnv.Api) (*KeyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "key", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating KeyClient: %+v", err) diff --git a/resource-manager/mixedreality/2021-01-01/proxy/client.go b/resource-manager/mixedreality/2021-01-01/proxy/client.go index 982cd2a3359..c7a905d2710 100644 --- a/resource-manager/mixedreality/2021-01-01/proxy/client.go +++ b/resource-manager/mixedreality/2021-01-01/proxy/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProxyClient struct { Client *resourcemanager.Client } -func NewProxyClientWithBaseURI(api environments.Api) (*ProxyClient, error) { +func NewProxyClientWithBaseURI(api sdkEnv.Api) (*ProxyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "proxy", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProxyClient: %+v", err) diff --git a/resource-manager/mixedreality/2021-01-01/resource/client.go b/resource-manager/mixedreality/2021-01-01/resource/client.go index 5137ab3e771..1152509990e 100644 --- a/resource-manager/mixedreality/2021-01-01/resource/client.go +++ b/resource-manager/mixedreality/2021-01-01/resource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResourceClient struct { Client *resourcemanager.Client } -func NewResourceClientWithBaseURI(api environments.Api) (*ResourceClient, error) { +func NewResourceClientWithBaseURI(api sdkEnv.Api) (*ResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResourceClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/attacheddatanetwork/client.go b/resource-manager/mobilenetwork/2022-11-01/attacheddatanetwork/client.go index 6a0e3971e0f..89159bad51a 100644 --- a/resource-manager/mobilenetwork/2022-11-01/attacheddatanetwork/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/attacheddatanetwork/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AttachedDataNetworkClient struct { Client *resourcemanager.Client } -func NewAttachedDataNetworkClientWithBaseURI(api environments.Api) (*AttachedDataNetworkClient, error) { +func NewAttachedDataNetworkClientWithBaseURI(api sdkEnv.Api) (*AttachedDataNetworkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "attacheddatanetwork", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AttachedDataNetworkClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/attacheddatanetworks/client.go b/resource-manager/mobilenetwork/2022-11-01/attacheddatanetworks/client.go index eda509c8f2a..15b0976ee40 100644 --- a/resource-manager/mobilenetwork/2022-11-01/attacheddatanetworks/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/attacheddatanetworks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AttachedDataNetworksClient struct { Client *resourcemanager.Client } -func NewAttachedDataNetworksClientWithBaseURI(api environments.Api) (*AttachedDataNetworksClient, error) { +func NewAttachedDataNetworksClientWithBaseURI(api sdkEnv.Api) (*AttachedDataNetworksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "attacheddatanetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AttachedDataNetworksClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/client.go b/resource-manager/mobilenetwork/2022-11-01/client.go index 75e0f0ce689..a769c178ee1 100644 --- a/resource-manager/mobilenetwork/2022-11-01/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/client.go @@ -33,7 +33,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice" "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slices" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -65,7 +65,7 @@ type Client struct { Slices *slices.SlicesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { attachedDataNetworkClient, err := attacheddatanetwork.NewAttachedDataNetworkClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AttachedDataNetwork client: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/datanetwork/client.go b/resource-manager/mobilenetwork/2022-11-01/datanetwork/client.go index edc3f6e6f8e..5407ff7eb70 100644 --- a/resource-manager/mobilenetwork/2022-11-01/datanetwork/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/datanetwork/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataNetworkClient struct { Client *resourcemanager.Client } -func NewDataNetworkClientWithBaseURI(api environments.Api) (*DataNetworkClient, error) { +func NewDataNetworkClientWithBaseURI(api sdkEnv.Api) (*DataNetworkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datanetwork", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataNetworkClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/datanetworks/client.go b/resource-manager/mobilenetwork/2022-11-01/datanetworks/client.go index fe004bcdaa6..4fffb0fb744 100644 --- a/resource-manager/mobilenetwork/2022-11-01/datanetworks/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/datanetworks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataNetworksClient struct { Client *resourcemanager.Client } -func NewDataNetworksClientWithBaseURI(api environments.Api) (*DataNetworksClient, error) { +func NewDataNetworksClientWithBaseURI(api sdkEnv.Api) (*DataNetworksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datanetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataNetworksClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/client.go b/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/client.go index 93d7b418f85..f230e2e0366 100644 --- a/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MobileNetworkClient struct { Client *resourcemanager.Client } -func NewMobileNetworkClientWithBaseURI(api environments.Api) (*MobileNetworkClient, error) { +func NewMobileNetworkClientWithBaseURI(api sdkEnv.Api) (*MobileNetworkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "mobilenetwork", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MobileNetworkClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/mobilenetworks/client.go b/resource-manager/mobilenetwork/2022-11-01/mobilenetworks/client.go index f1f23e81731..296351710e3 100644 --- a/resource-manager/mobilenetwork/2022-11-01/mobilenetworks/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/mobilenetworks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MobileNetworksClient struct { Client *resourcemanager.Client } -func NewMobileNetworksClientWithBaseURI(api environments.Api) (*MobileNetworksClient, error) { +func NewMobileNetworksClientWithBaseURI(api sdkEnv.Api) (*MobileNetworksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "mobilenetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MobileNetworksClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplane/client.go b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplane/client.go index f84ad490f91..e5507318624 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplane/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplane/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlaneClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlaneClientWithBaseURI(api environments.Api) (*PacketCoreControlPlaneClient, error) { +func NewPacketCoreControlPlaneClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlaneClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplane", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlaneClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanecollectdiagnosticspackage/client.go b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanecollectdiagnosticspackage/client.go index a6c7c315672..510f255dc61 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanecollectdiagnosticspackage/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanecollectdiagnosticspackage/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlaneCollectDiagnosticsPackageClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlaneCollectDiagnosticsPackageClientWithBaseURI(api environments.Api) (*PacketCoreControlPlaneCollectDiagnosticsPackageClient, error) { +func NewPacketCoreControlPlaneCollectDiagnosticsPackageClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlaneCollectDiagnosticsPackageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplanecollectdiagnosticspackage", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlaneCollectDiagnosticsPackageClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanereinstall/client.go b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanereinstall/client.go index 1b056f411cb..55b3959f401 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanereinstall/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanereinstall/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlaneReinstallClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlaneReinstallClientWithBaseURI(api environments.Api) (*PacketCoreControlPlaneReinstallClient, error) { +func NewPacketCoreControlPlaneReinstallClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlaneReinstallClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplanereinstall", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlaneReinstallClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanerollback/client.go b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanerollback/client.go index 0b54192dc2b..a909fe39565 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanerollback/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanerollback/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlaneRollbackClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlaneRollbackClientWithBaseURI(api environments.Api) (*PacketCoreControlPlaneRollbackClient, error) { +func NewPacketCoreControlPlaneRollbackClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlaneRollbackClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplanerollback", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlaneRollbackClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanes/client.go b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanes/client.go index bca49161179..16861b06499 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanes/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlanesClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlanesClientWithBaseURI(api environments.Api) (*PacketCoreControlPlanesClient, error) { +func NewPacketCoreControlPlanesClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlanesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplanes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlanesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplaneversion/client.go b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplaneversion/client.go index 43e37c70675..f0cba40006b 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplaneversion/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplaneversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlaneVersionClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlaneVersionClientWithBaseURI(api environments.Api) (*PacketCoreControlPlaneVersionClient, error) { +func NewPacketCoreControlPlaneVersionClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlaneVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplaneversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlaneVersionClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcoredataplane/client.go b/resource-manager/mobilenetwork/2022-11-01/packetcoredataplane/client.go index c8b33c12695..f3c6d42183c 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcoredataplane/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcoredataplane/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreDataPlaneClient struct { Client *resourcemanager.Client } -func NewPacketCoreDataPlaneClientWithBaseURI(api environments.Api) (*PacketCoreDataPlaneClient, error) { +func NewPacketCoreDataPlaneClientWithBaseURI(api sdkEnv.Api) (*PacketCoreDataPlaneClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcoredataplane", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreDataPlaneClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcoredataplanes/client.go b/resource-manager/mobilenetwork/2022-11-01/packetcoredataplanes/client.go index d8f82c40708..6731e93f93e 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcoredataplanes/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcoredataplanes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreDataPlanesClient struct { Client *resourcemanager.Client } -func NewPacketCoreDataPlanesClientWithBaseURI(api environments.Api) (*PacketCoreDataPlanesClient, error) { +func NewPacketCoreDataPlanesClientWithBaseURI(api sdkEnv.Api) (*PacketCoreDataPlanesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcoredataplanes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreDataPlanesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/service/client.go b/resource-manager/mobilenetwork/2022-11-01/service/client.go index 194b306561d..9564841620d 100644 --- a/resource-manager/mobilenetwork/2022-11-01/service/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/service/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServiceClient struct { Client *resourcemanager.Client } -func NewServiceClientWithBaseURI(api environments.Api) (*ServiceClient, error) { +func NewServiceClientWithBaseURI(api sdkEnv.Api) (*ServiceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "service", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServiceClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/services/client.go b/resource-manager/mobilenetwork/2022-11-01/services/client.go index 22ee3392d99..3b7b97f191e 100644 --- a/resource-manager/mobilenetwork/2022-11-01/services/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/services/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServicesClient struct { Client *resourcemanager.Client } -func NewServicesClientWithBaseURI(api environments.Api) (*ServicesClient, error) { +func NewServicesClientWithBaseURI(api sdkEnv.Api) (*ServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "services", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServicesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/sim/client.go b/resource-manager/mobilenetwork/2022-11-01/sim/client.go index 12e9eb4fc3a..f31d0fb8ea2 100644 --- a/resource-manager/mobilenetwork/2022-11-01/sim/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/sim/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMClient struct { Client *resourcemanager.Client } -func NewSIMClientWithBaseURI(api environments.Api) (*SIMClient, error) { +func NewSIMClientWithBaseURI(api sdkEnv.Api) (*SIMClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sim", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/simgroup/client.go b/resource-manager/mobilenetwork/2022-11-01/simgroup/client.go index 8e6dcac5b85..dc67f8a808b 100644 --- a/resource-manager/mobilenetwork/2022-11-01/simgroup/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/simgroup/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMGroupClient struct { Client *resourcemanager.Client } -func NewSIMGroupClientWithBaseURI(api environments.Api) (*SIMGroupClient, error) { +func NewSIMGroupClientWithBaseURI(api sdkEnv.Api) (*SIMGroupClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "simgroup", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMGroupClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/simgroups/client.go b/resource-manager/mobilenetwork/2022-11-01/simgroups/client.go index b8ea71d5555..799c9d21898 100644 --- a/resource-manager/mobilenetwork/2022-11-01/simgroups/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/simgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMGroupsClient struct { Client *resourcemanager.Client } -func NewSIMGroupsClientWithBaseURI(api environments.Api) (*SIMGroupsClient, error) { +func NewSIMGroupsClientWithBaseURI(api sdkEnv.Api) (*SIMGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "simgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMGroupsClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/simpolicies/client.go b/resource-manager/mobilenetwork/2022-11-01/simpolicies/client.go index aad773e1114..9fe6636d423 100644 --- a/resource-manager/mobilenetwork/2022-11-01/simpolicies/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/simpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMPoliciesClient struct { Client *resourcemanager.Client } -func NewSIMPoliciesClientWithBaseURI(api environments.Api) (*SIMPoliciesClient, error) { +func NewSIMPoliciesClientWithBaseURI(api sdkEnv.Api) (*SIMPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "simpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMPoliciesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/simpolicy/client.go b/resource-manager/mobilenetwork/2022-11-01/simpolicy/client.go index 819889550e2..039493c36ff 100644 --- a/resource-manager/mobilenetwork/2022-11-01/simpolicy/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/simpolicy/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMPolicyClient struct { Client *resourcemanager.Client } -func NewSIMPolicyClientWithBaseURI(api environments.Api) (*SIMPolicyClient, error) { +func NewSIMPolicyClientWithBaseURI(api sdkEnv.Api) (*SIMPolicyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "simpolicy", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMPolicyClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/sims/client.go b/resource-manager/mobilenetwork/2022-11-01/sims/client.go index 5a7828cd20f..40ab1d75a49 100644 --- a/resource-manager/mobilenetwork/2022-11-01/sims/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/sims/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMsClient struct { Client *resourcemanager.Client } -func NewSIMsClientWithBaseURI(api environments.Api) (*SIMsClient, error) { +func NewSIMsClientWithBaseURI(api sdkEnv.Api) (*SIMsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sims", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMsClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/site/client.go b/resource-manager/mobilenetwork/2022-11-01/site/client.go index 097bce6a465..a57c0014e4d 100644 --- a/resource-manager/mobilenetwork/2022-11-01/site/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/site/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SiteClient struct { Client *resourcemanager.Client } -func NewSiteClientWithBaseURI(api environments.Api) (*SiteClient, error) { +func NewSiteClientWithBaseURI(api sdkEnv.Api) (*SiteClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "site", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SiteClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/sites/client.go b/resource-manager/mobilenetwork/2022-11-01/sites/client.go index c5dde7e475d..02d986c1713 100644 --- a/resource-manager/mobilenetwork/2022-11-01/sites/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/sites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SitesClient struct { Client *resourcemanager.Client } -func NewSitesClientWithBaseURI(api environments.Api) (*SitesClient, error) { +func NewSitesClientWithBaseURI(api sdkEnv.Api) (*SitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SitesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/slice/client.go b/resource-manager/mobilenetwork/2022-11-01/slice/client.go index de032d59c51..f926a88ad01 100644 --- a/resource-manager/mobilenetwork/2022-11-01/slice/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/slice/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SliceClient struct { Client *resourcemanager.Client } -func NewSliceClientWithBaseURI(api environments.Api) (*SliceClient, error) { +func NewSliceClientWithBaseURI(api sdkEnv.Api) (*SliceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "slice", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SliceClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2022-11-01/slices/client.go b/resource-manager/mobilenetwork/2022-11-01/slices/client.go index 78c9ee11366..cc0f729b516 100644 --- a/resource-manager/mobilenetwork/2022-11-01/slices/client.go +++ b/resource-manager/mobilenetwork/2022-11-01/slices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SlicesClient struct { Client *resourcemanager.Client } -func NewSlicesClientWithBaseURI(api environments.Api) (*SlicesClient, error) { +func NewSlicesClientWithBaseURI(api sdkEnv.Api) (*SlicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "slices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SlicesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/attacheddatanetwork/client.go b/resource-manager/mobilenetwork/2023-06-01/attacheddatanetwork/client.go index 6a0e3971e0f..89159bad51a 100644 --- a/resource-manager/mobilenetwork/2023-06-01/attacheddatanetwork/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/attacheddatanetwork/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AttachedDataNetworkClient struct { Client *resourcemanager.Client } -func NewAttachedDataNetworkClientWithBaseURI(api environments.Api) (*AttachedDataNetworkClient, error) { +func NewAttachedDataNetworkClientWithBaseURI(api sdkEnv.Api) (*AttachedDataNetworkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "attacheddatanetwork", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AttachedDataNetworkClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/attacheddatanetworks/client.go b/resource-manager/mobilenetwork/2023-06-01/attacheddatanetworks/client.go index eda509c8f2a..15b0976ee40 100644 --- a/resource-manager/mobilenetwork/2023-06-01/attacheddatanetworks/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/attacheddatanetworks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AttachedDataNetworksClient struct { Client *resourcemanager.Client } -func NewAttachedDataNetworksClientWithBaseURI(api environments.Api) (*AttachedDataNetworksClient, error) { +func NewAttachedDataNetworksClientWithBaseURI(api sdkEnv.Api) (*AttachedDataNetworksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "attacheddatanetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AttachedDataNetworksClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/client.go b/resource-manager/mobilenetwork/2023-06-01/client.go index f987f7e1a30..c4eacb86a88 100644 --- a/resource-manager/mobilenetwork/2023-06-01/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/client.go @@ -35,7 +35,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2023-06-01/slice" "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2023-06-01/slices" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -69,7 +69,7 @@ type Client struct { Slices *slices.SlicesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { attachedDataNetworkClient, err := attacheddatanetwork.NewAttachedDataNetworkClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AttachedDataNetwork client: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/datanetwork/client.go b/resource-manager/mobilenetwork/2023-06-01/datanetwork/client.go index edc3f6e6f8e..5407ff7eb70 100644 --- a/resource-manager/mobilenetwork/2023-06-01/datanetwork/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/datanetwork/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataNetworkClient struct { Client *resourcemanager.Client } -func NewDataNetworkClientWithBaseURI(api environments.Api) (*DataNetworkClient, error) { +func NewDataNetworkClientWithBaseURI(api sdkEnv.Api) (*DataNetworkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datanetwork", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataNetworkClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/datanetworks/client.go b/resource-manager/mobilenetwork/2023-06-01/datanetworks/client.go index fe004bcdaa6..4fffb0fb744 100644 --- a/resource-manager/mobilenetwork/2023-06-01/datanetworks/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/datanetworks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataNetworksClient struct { Client *resourcemanager.Client } -func NewDataNetworksClientWithBaseURI(api environments.Api) (*DataNetworksClient, error) { +func NewDataNetworksClientWithBaseURI(api sdkEnv.Api) (*DataNetworksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datanetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataNetworksClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/client.go b/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/client.go index a1cbaec6aa0..f573c1f97ef 100644 --- a/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DiagnosticsPackagesClient struct { Client *resourcemanager.Client } -func NewDiagnosticsPackagesClientWithBaseURI(api environments.Api) (*DiagnosticsPackagesClient, error) { +func NewDiagnosticsPackagesClientWithBaseURI(api sdkEnv.Api) (*DiagnosticsPackagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "diagnosticspackages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DiagnosticsPackagesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/mobilenetwork/client.go b/resource-manager/mobilenetwork/2023-06-01/mobilenetwork/client.go index 93d7b418f85..f230e2e0366 100644 --- a/resource-manager/mobilenetwork/2023-06-01/mobilenetwork/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/mobilenetwork/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MobileNetworkClient struct { Client *resourcemanager.Client } -func NewMobileNetworkClientWithBaseURI(api environments.Api) (*MobileNetworkClient, error) { +func NewMobileNetworkClientWithBaseURI(api sdkEnv.Api) (*MobileNetworkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "mobilenetwork", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MobileNetworkClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/mobilenetworks/client.go b/resource-manager/mobilenetwork/2023-06-01/mobilenetworks/client.go index f1f23e81731..296351710e3 100644 --- a/resource-manager/mobilenetwork/2023-06-01/mobilenetworks/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/mobilenetworks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MobileNetworksClient struct { Client *resourcemanager.Client } -func NewMobileNetworksClientWithBaseURI(api environments.Api) (*MobileNetworksClient, error) { +func NewMobileNetworksClientWithBaseURI(api sdkEnv.Api) (*MobileNetworksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "mobilenetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MobileNetworksClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcaptures/client.go b/resource-manager/mobilenetwork/2023-06-01/packetcaptures/client.go index 0a4a3398869..5367931aba6 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcaptures/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcaptures/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCapturesClient struct { Client *resourcemanager.Client } -func NewPacketCapturesClientWithBaseURI(api environments.Api) (*PacketCapturesClient, error) { +func NewPacketCapturesClientWithBaseURI(api sdkEnv.Api) (*PacketCapturesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcaptures", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCapturesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplane/client.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplane/client.go index f84ad490f91..e5507318624 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplane/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplane/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlaneClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlaneClientWithBaseURI(api environments.Api) (*PacketCoreControlPlaneClient, error) { +func NewPacketCoreControlPlaneClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlaneClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplane", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlaneClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanecollectdiagnosticspackage/client.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanecollectdiagnosticspackage/client.go index a6c7c315672..510f255dc61 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanecollectdiagnosticspackage/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanecollectdiagnosticspackage/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlaneCollectDiagnosticsPackageClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlaneCollectDiagnosticsPackageClientWithBaseURI(api environments.Api) (*PacketCoreControlPlaneCollectDiagnosticsPackageClient, error) { +func NewPacketCoreControlPlaneCollectDiagnosticsPackageClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlaneCollectDiagnosticsPackageClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplanecollectdiagnosticspackage", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlaneCollectDiagnosticsPackageClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanereinstall/client.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanereinstall/client.go index 1b056f411cb..55b3959f401 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanereinstall/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanereinstall/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlaneReinstallClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlaneReinstallClientWithBaseURI(api environments.Api) (*PacketCoreControlPlaneReinstallClient, error) { +func NewPacketCoreControlPlaneReinstallClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlaneReinstallClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplanereinstall", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlaneReinstallClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanerollback/client.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanerollback/client.go index 0b54192dc2b..a909fe39565 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanerollback/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanerollback/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlaneRollbackClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlaneRollbackClientWithBaseURI(api environments.Api) (*PacketCoreControlPlaneRollbackClient, error) { +func NewPacketCoreControlPlaneRollbackClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlaneRollbackClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplanerollback", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlaneRollbackClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanes/client.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanes/client.go index bca49161179..16861b06499 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanes/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlanesClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlanesClientWithBaseURI(api environments.Api) (*PacketCoreControlPlanesClient, error) { +func NewPacketCoreControlPlanesClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlanesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplanes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlanesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/client.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/client.go index 43e37c70675..f0cba40006b 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreControlPlaneVersionClient struct { Client *resourcemanager.Client } -func NewPacketCoreControlPlaneVersionClientWithBaseURI(api environments.Api) (*PacketCoreControlPlaneVersionClient, error) { +func NewPacketCoreControlPlaneVersionClientWithBaseURI(api sdkEnv.Api) (*PacketCoreControlPlaneVersionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcorecontrolplaneversion", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreControlPlaneVersionClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcoredataplane/client.go b/resource-manager/mobilenetwork/2023-06-01/packetcoredataplane/client.go index c8b33c12695..f3c6d42183c 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcoredataplane/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcoredataplane/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreDataPlaneClient struct { Client *resourcemanager.Client } -func NewPacketCoreDataPlaneClientWithBaseURI(api environments.Api) (*PacketCoreDataPlaneClient, error) { +func NewPacketCoreDataPlaneClientWithBaseURI(api sdkEnv.Api) (*PacketCoreDataPlaneClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcoredataplane", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreDataPlaneClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcoredataplanes/client.go b/resource-manager/mobilenetwork/2023-06-01/packetcoredataplanes/client.go index d8f82c40708..6731e93f93e 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcoredataplanes/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcoredataplanes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCoreDataPlanesClient struct { Client *resourcemanager.Client } -func NewPacketCoreDataPlanesClientWithBaseURI(api environments.Api) (*PacketCoreDataPlanesClient, error) { +func NewPacketCoreDataPlanesClientWithBaseURI(api sdkEnv.Api) (*PacketCoreDataPlanesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcoredataplanes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCoreDataPlanesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/service/client.go b/resource-manager/mobilenetwork/2023-06-01/service/client.go index 194b306561d..9564841620d 100644 --- a/resource-manager/mobilenetwork/2023-06-01/service/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/service/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServiceClient struct { Client *resourcemanager.Client } -func NewServiceClientWithBaseURI(api environments.Api) (*ServiceClient, error) { +func NewServiceClientWithBaseURI(api sdkEnv.Api) (*ServiceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "service", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServiceClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/services/client.go b/resource-manager/mobilenetwork/2023-06-01/services/client.go index 22ee3392d99..3b7b97f191e 100644 --- a/resource-manager/mobilenetwork/2023-06-01/services/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/services/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServicesClient struct { Client *resourcemanager.Client } -func NewServicesClientWithBaseURI(api environments.Api) (*ServicesClient, error) { +func NewServicesClientWithBaseURI(api sdkEnv.Api) (*ServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "services", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServicesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/sim/client.go b/resource-manager/mobilenetwork/2023-06-01/sim/client.go index 12e9eb4fc3a..f31d0fb8ea2 100644 --- a/resource-manager/mobilenetwork/2023-06-01/sim/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/sim/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMClient struct { Client *resourcemanager.Client } -func NewSIMClientWithBaseURI(api environments.Api) (*SIMClient, error) { +func NewSIMClientWithBaseURI(api sdkEnv.Api) (*SIMClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sim", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/simgroup/client.go b/resource-manager/mobilenetwork/2023-06-01/simgroup/client.go index 8e6dcac5b85..dc67f8a808b 100644 --- a/resource-manager/mobilenetwork/2023-06-01/simgroup/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/simgroup/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMGroupClient struct { Client *resourcemanager.Client } -func NewSIMGroupClientWithBaseURI(api environments.Api) (*SIMGroupClient, error) { +func NewSIMGroupClientWithBaseURI(api sdkEnv.Api) (*SIMGroupClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "simgroup", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMGroupClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/simgroups/client.go b/resource-manager/mobilenetwork/2023-06-01/simgroups/client.go index b8ea71d5555..799c9d21898 100644 --- a/resource-manager/mobilenetwork/2023-06-01/simgroups/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/simgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMGroupsClient struct { Client *resourcemanager.Client } -func NewSIMGroupsClientWithBaseURI(api environments.Api) (*SIMGroupsClient, error) { +func NewSIMGroupsClientWithBaseURI(api sdkEnv.Api) (*SIMGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "simgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMGroupsClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/simpolicies/client.go b/resource-manager/mobilenetwork/2023-06-01/simpolicies/client.go index aad773e1114..9fe6636d423 100644 --- a/resource-manager/mobilenetwork/2023-06-01/simpolicies/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/simpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMPoliciesClient struct { Client *resourcemanager.Client } -func NewSIMPoliciesClientWithBaseURI(api environments.Api) (*SIMPoliciesClient, error) { +func NewSIMPoliciesClientWithBaseURI(api sdkEnv.Api) (*SIMPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "simpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMPoliciesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/simpolicy/client.go b/resource-manager/mobilenetwork/2023-06-01/simpolicy/client.go index 819889550e2..039493c36ff 100644 --- a/resource-manager/mobilenetwork/2023-06-01/simpolicy/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/simpolicy/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMPolicyClient struct { Client *resourcemanager.Client } -func NewSIMPolicyClientWithBaseURI(api environments.Api) (*SIMPolicyClient, error) { +func NewSIMPolicyClientWithBaseURI(api sdkEnv.Api) (*SIMPolicyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "simpolicy", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMPolicyClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/sims/client.go b/resource-manager/mobilenetwork/2023-06-01/sims/client.go index 5a7828cd20f..40ab1d75a49 100644 --- a/resource-manager/mobilenetwork/2023-06-01/sims/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/sims/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SIMsClient struct { Client *resourcemanager.Client } -func NewSIMsClientWithBaseURI(api environments.Api) (*SIMsClient, error) { +func NewSIMsClientWithBaseURI(api sdkEnv.Api) (*SIMsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sims", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SIMsClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/site/client.go b/resource-manager/mobilenetwork/2023-06-01/site/client.go index 097bce6a465..a57c0014e4d 100644 --- a/resource-manager/mobilenetwork/2023-06-01/site/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/site/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SiteClient struct { Client *resourcemanager.Client } -func NewSiteClientWithBaseURI(api environments.Api) (*SiteClient, error) { +func NewSiteClientWithBaseURI(api sdkEnv.Api) (*SiteClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "site", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SiteClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/sites/client.go b/resource-manager/mobilenetwork/2023-06-01/sites/client.go index c5dde7e475d..02d986c1713 100644 --- a/resource-manager/mobilenetwork/2023-06-01/sites/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/sites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SitesClient struct { Client *resourcemanager.Client } -func NewSitesClientWithBaseURI(api environments.Api) (*SitesClient, error) { +func NewSitesClientWithBaseURI(api sdkEnv.Api) (*SitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SitesClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/slice/client.go b/resource-manager/mobilenetwork/2023-06-01/slice/client.go index de032d59c51..f926a88ad01 100644 --- a/resource-manager/mobilenetwork/2023-06-01/slice/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/slice/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SliceClient struct { Client *resourcemanager.Client } -func NewSliceClientWithBaseURI(api environments.Api) (*SliceClient, error) { +func NewSliceClientWithBaseURI(api sdkEnv.Api) (*SliceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "slice", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SliceClient: %+v", err) diff --git a/resource-manager/mobilenetwork/2023-06-01/slices/client.go b/resource-manager/mobilenetwork/2023-06-01/slices/client.go index 78c9ee11366..cc0f729b516 100644 --- a/resource-manager/mobilenetwork/2023-06-01/slices/client.go +++ b/resource-manager/mobilenetwork/2023-06-01/slices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SlicesClient struct { Client *resourcemanager.Client } -func NewSlicesClientWithBaseURI(api environments.Api) (*SlicesClient, error) { +func NewSlicesClientWithBaseURI(api sdkEnv.Api) (*SlicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "slices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SlicesClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/backups/client.go b/resource-manager/mysql/2021-05-01/backups/client.go index ae4432efd22..b6e8894f3f9 100644 --- a/resource-manager/mysql/2021-05-01/backups/client.go +++ b/resource-manager/mysql/2021-05-01/backups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupsClient struct { Client *resourcemanager.Client } -func NewBackupsClientWithBaseURI(api environments.Api) (*BackupsClient, error) { +func NewBackupsClientWithBaseURI(api sdkEnv.Api) (*BackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupsClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/checknameavailability/client.go b/resource-manager/mysql/2021-05-01/checknameavailability/client.go index 81c73505778..5610e27c123 100644 --- a/resource-manager/mysql/2021-05-01/checknameavailability/client.go +++ b/resource-manager/mysql/2021-05-01/checknameavailability/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityClient, error) { +func NewCheckNameAvailabilityClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailability", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/client.go b/resource-manager/mysql/2021-05-01/client.go index 0da79cf67c2..adf9cbeb7f3 100644 --- a/resource-manager/mysql/2021-05-01/client.go +++ b/resource-manager/mysql/2021-05-01/client.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/serverstart" "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/serverstop" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -37,7 +37,7 @@ type Client struct { Servers *servers.ServersClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { backupsClient, err := backups.NewBackupsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Backups client: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/configurations/client.go b/resource-manager/mysql/2021-05-01/configurations/client.go index c2b3df6d8b8..b4d8c5d31c3 100644 --- a/resource-manager/mysql/2021-05-01/configurations/client.go +++ b/resource-manager/mysql/2021-05-01/configurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationsClient struct { Client *resourcemanager.Client } -func NewConfigurationsClientWithBaseURI(api environments.Api) (*ConfigurationsClient, error) { +func NewConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationsClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/databases/client.go b/resource-manager/mysql/2021-05-01/databases/client.go index bb94a331f78..6f48891ebd3 100644 --- a/resource-manager/mysql/2021-05-01/databases/client.go +++ b/resource-manager/mysql/2021-05-01/databases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabasesClient struct { Client *resourcemanager.Client } -func NewDatabasesClientWithBaseURI(api environments.Api) (*DatabasesClient, error) { +func NewDatabasesClientWithBaseURI(api sdkEnv.Api) (*DatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/firewallrules/client.go b/resource-manager/mysql/2021-05-01/firewallrules/client.go index 6493e429eb1..86eebdae36a 100644 --- a/resource-manager/mysql/2021-05-01/firewallrules/client.go +++ b/resource-manager/mysql/2021-05-01/firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallRulesClient struct { Client *resourcemanager.Client } -func NewFirewallRulesClientWithBaseURI(api environments.Api) (*FirewallRulesClient, error) { +func NewFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/getprivatednszonesuffix/client.go b/resource-manager/mysql/2021-05-01/getprivatednszonesuffix/client.go index 39cc68bc144..c2e8de57982 100644 --- a/resource-manager/mysql/2021-05-01/getprivatednszonesuffix/client.go +++ b/resource-manager/mysql/2021-05-01/getprivatednszonesuffix/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GetPrivateDnsZoneSuffixClient struct { Client *resourcemanager.Client } -func NewGetPrivateDnsZoneSuffixClientWithBaseURI(api environments.Api) (*GetPrivateDnsZoneSuffixClient, error) { +func NewGetPrivateDnsZoneSuffixClientWithBaseURI(api sdkEnv.Api) (*GetPrivateDnsZoneSuffixClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "getprivatednszonesuffix", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GetPrivateDnsZoneSuffixClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/locationbasedcapabilities/client.go b/resource-manager/mysql/2021-05-01/locationbasedcapabilities/client.go index c7ed45f57a6..b013ddc0399 100644 --- a/resource-manager/mysql/2021-05-01/locationbasedcapabilities/client.go +++ b/resource-manager/mysql/2021-05-01/locationbasedcapabilities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationBasedCapabilitiesClient struct { Client *resourcemanager.Client } -func NewLocationBasedCapabilitiesClientWithBaseURI(api environments.Api) (*LocationBasedCapabilitiesClient, error) { +func NewLocationBasedCapabilitiesClientWithBaseURI(api sdkEnv.Api) (*LocationBasedCapabilitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locationbasedcapabilities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationBasedCapabilitiesClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/serverfailover/client.go b/resource-manager/mysql/2021-05-01/serverfailover/client.go index d90a9229592..1c032e52598 100644 --- a/resource-manager/mysql/2021-05-01/serverfailover/client.go +++ b/resource-manager/mysql/2021-05-01/serverfailover/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerFailoverClient struct { Client *resourcemanager.Client } -func NewServerFailoverClientWithBaseURI(api environments.Api) (*ServerFailoverClient, error) { +func NewServerFailoverClientWithBaseURI(api sdkEnv.Api) (*ServerFailoverClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverfailover", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerFailoverClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/serverrestart/client.go b/resource-manager/mysql/2021-05-01/serverrestart/client.go index dda19ef0b54..898ac1f7eb0 100644 --- a/resource-manager/mysql/2021-05-01/serverrestart/client.go +++ b/resource-manager/mysql/2021-05-01/serverrestart/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerRestartClient struct { Client *resourcemanager.Client } -func NewServerRestartClientWithBaseURI(api environments.Api) (*ServerRestartClient, error) { +func NewServerRestartClientWithBaseURI(api sdkEnv.Api) (*ServerRestartClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverrestart", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerRestartClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/servers/client.go b/resource-manager/mysql/2021-05-01/servers/client.go index a1e11668771..0788963b1fb 100644 --- a/resource-manager/mysql/2021-05-01/servers/client.go +++ b/resource-manager/mysql/2021-05-01/servers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServersClient struct { Client *resourcemanager.Client } -func NewServersClientWithBaseURI(api environments.Api) (*ServersClient, error) { +func NewServersClientWithBaseURI(api sdkEnv.Api) (*ServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServersClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/serverstart/client.go b/resource-manager/mysql/2021-05-01/serverstart/client.go index f24d38e00f9..58e29091c2a 100644 --- a/resource-manager/mysql/2021-05-01/serverstart/client.go +++ b/resource-manager/mysql/2021-05-01/serverstart/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerStartClient struct { Client *resourcemanager.Client } -func NewServerStartClientWithBaseURI(api environments.Api) (*ServerStartClient, error) { +func NewServerStartClientWithBaseURI(api sdkEnv.Api) (*ServerStartClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverstart", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerStartClient: %+v", err) diff --git a/resource-manager/mysql/2021-05-01/serverstop/client.go b/resource-manager/mysql/2021-05-01/serverstop/client.go index c47cb0e7335..963c73af50c 100644 --- a/resource-manager/mysql/2021-05-01/serverstop/client.go +++ b/resource-manager/mysql/2021-05-01/serverstop/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerStopClient struct { Client *resourcemanager.Client } -func NewServerStopClientWithBaseURI(api environments.Api) (*ServerStopClient, error) { +func NewServerStopClientWithBaseURI(api sdkEnv.Api) (*ServerStopClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverstop", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerStopClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/azureadadministrators/client.go b/resource-manager/mysql/2021-12-01-preview/azureadadministrators/client.go index eb020534988..0f3c4956c6a 100644 --- a/resource-manager/mysql/2021-12-01-preview/azureadadministrators/client.go +++ b/resource-manager/mysql/2021-12-01-preview/azureadadministrators/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureADAdministratorsClient struct { Client *resourcemanager.Client } -func NewAzureADAdministratorsClientWithBaseURI(api environments.Api) (*AzureADAdministratorsClient, error) { +func NewAzureADAdministratorsClientWithBaseURI(api sdkEnv.Api) (*AzureADAdministratorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azureadadministrators", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureADAdministratorsClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/backups/client.go b/resource-manager/mysql/2021-12-01-preview/backups/client.go index ae4432efd22..b6e8894f3f9 100644 --- a/resource-manager/mysql/2021-12-01-preview/backups/client.go +++ b/resource-manager/mysql/2021-12-01-preview/backups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupsClient struct { Client *resourcemanager.Client } -func NewBackupsClientWithBaseURI(api environments.Api) (*BackupsClient, error) { +func NewBackupsClientWithBaseURI(api sdkEnv.Api) (*BackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupsClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/checknameavailability/client.go b/resource-manager/mysql/2021-12-01-preview/checknameavailability/client.go index 81c73505778..5610e27c123 100644 --- a/resource-manager/mysql/2021-12-01-preview/checknameavailability/client.go +++ b/resource-manager/mysql/2021-12-01-preview/checknameavailability/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityClient, error) { +func NewCheckNameAvailabilityClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailability", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/client.go b/resource-manager/mysql/2021-12-01-preview/client.go index 3ac7f438d8f..2e6790d15a7 100644 --- a/resource-manager/mysql/2021-12-01-preview/client.go +++ b/resource-manager/mysql/2021-12-01-preview/client.go @@ -21,7 +21,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-12-01-preview/serverstart" "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-12-01-preview/serverstop" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -41,7 +41,7 @@ type Client struct { Servers *servers.ServersClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { azureADAdministratorsClient, err := azureadadministrators.NewAzureADAdministratorsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AzureADAdministrators client: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/configurations/client.go b/resource-manager/mysql/2021-12-01-preview/configurations/client.go index c2b3df6d8b8..b4d8c5d31c3 100644 --- a/resource-manager/mysql/2021-12-01-preview/configurations/client.go +++ b/resource-manager/mysql/2021-12-01-preview/configurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationsClient struct { Client *resourcemanager.Client } -func NewConfigurationsClientWithBaseURI(api environments.Api) (*ConfigurationsClient, error) { +func NewConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationsClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/databases/client.go b/resource-manager/mysql/2021-12-01-preview/databases/client.go index bb94a331f78..6f48891ebd3 100644 --- a/resource-manager/mysql/2021-12-01-preview/databases/client.go +++ b/resource-manager/mysql/2021-12-01-preview/databases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabasesClient struct { Client *resourcemanager.Client } -func NewDatabasesClientWithBaseURI(api environments.Api) (*DatabasesClient, error) { +func NewDatabasesClientWithBaseURI(api sdkEnv.Api) (*DatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/firewallrules/client.go b/resource-manager/mysql/2021-12-01-preview/firewallrules/client.go index 6493e429eb1..86eebdae36a 100644 --- a/resource-manager/mysql/2021-12-01-preview/firewallrules/client.go +++ b/resource-manager/mysql/2021-12-01-preview/firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallRulesClient struct { Client *resourcemanager.Client } -func NewFirewallRulesClientWithBaseURI(api environments.Api) (*FirewallRulesClient, error) { +func NewFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/getprivatednszonesuffix/client.go b/resource-manager/mysql/2021-12-01-preview/getprivatednszonesuffix/client.go index 39cc68bc144..c2e8de57982 100644 --- a/resource-manager/mysql/2021-12-01-preview/getprivatednszonesuffix/client.go +++ b/resource-manager/mysql/2021-12-01-preview/getprivatednszonesuffix/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GetPrivateDnsZoneSuffixClient struct { Client *resourcemanager.Client } -func NewGetPrivateDnsZoneSuffixClientWithBaseURI(api environments.Api) (*GetPrivateDnsZoneSuffixClient, error) { +func NewGetPrivateDnsZoneSuffixClientWithBaseURI(api sdkEnv.Api) (*GetPrivateDnsZoneSuffixClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "getprivatednszonesuffix", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GetPrivateDnsZoneSuffixClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/locationbasedcapabilities/client.go b/resource-manager/mysql/2021-12-01-preview/locationbasedcapabilities/client.go index c7ed45f57a6..b013ddc0399 100644 --- a/resource-manager/mysql/2021-12-01-preview/locationbasedcapabilities/client.go +++ b/resource-manager/mysql/2021-12-01-preview/locationbasedcapabilities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationBasedCapabilitiesClient struct { Client *resourcemanager.Client } -func NewLocationBasedCapabilitiesClientWithBaseURI(api environments.Api) (*LocationBasedCapabilitiesClient, error) { +func NewLocationBasedCapabilitiesClientWithBaseURI(api sdkEnv.Api) (*LocationBasedCapabilitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locationbasedcapabilities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationBasedCapabilitiesClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/logfiles/client.go b/resource-manager/mysql/2021-12-01-preview/logfiles/client.go index 99d5dad075a..c63ea513661 100644 --- a/resource-manager/mysql/2021-12-01-preview/logfiles/client.go +++ b/resource-manager/mysql/2021-12-01-preview/logfiles/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LogFilesClient struct { Client *resourcemanager.Client } -func NewLogFilesClientWithBaseURI(api environments.Api) (*LogFilesClient, error) { +func NewLogFilesClientWithBaseURI(api sdkEnv.Api) (*LogFilesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "logfiles", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LogFilesClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/serverfailover/client.go b/resource-manager/mysql/2021-12-01-preview/serverfailover/client.go index d90a9229592..1c032e52598 100644 --- a/resource-manager/mysql/2021-12-01-preview/serverfailover/client.go +++ b/resource-manager/mysql/2021-12-01-preview/serverfailover/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerFailoverClient struct { Client *resourcemanager.Client } -func NewServerFailoverClientWithBaseURI(api environments.Api) (*ServerFailoverClient, error) { +func NewServerFailoverClientWithBaseURI(api sdkEnv.Api) (*ServerFailoverClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverfailover", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerFailoverClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/serverrestart/client.go b/resource-manager/mysql/2021-12-01-preview/serverrestart/client.go index dda19ef0b54..898ac1f7eb0 100644 --- a/resource-manager/mysql/2021-12-01-preview/serverrestart/client.go +++ b/resource-manager/mysql/2021-12-01-preview/serverrestart/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerRestartClient struct { Client *resourcemanager.Client } -func NewServerRestartClientWithBaseURI(api environments.Api) (*ServerRestartClient, error) { +func NewServerRestartClientWithBaseURI(api sdkEnv.Api) (*ServerRestartClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverrestart", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerRestartClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/servers/client.go b/resource-manager/mysql/2021-12-01-preview/servers/client.go index a1e11668771..0788963b1fb 100644 --- a/resource-manager/mysql/2021-12-01-preview/servers/client.go +++ b/resource-manager/mysql/2021-12-01-preview/servers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServersClient struct { Client *resourcemanager.Client } -func NewServersClientWithBaseURI(api environments.Api) (*ServersClient, error) { +func NewServersClientWithBaseURI(api sdkEnv.Api) (*ServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServersClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/serverstart/client.go b/resource-manager/mysql/2021-12-01-preview/serverstart/client.go index f24d38e00f9..58e29091c2a 100644 --- a/resource-manager/mysql/2021-12-01-preview/serverstart/client.go +++ b/resource-manager/mysql/2021-12-01-preview/serverstart/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerStartClient struct { Client *resourcemanager.Client } -func NewServerStartClientWithBaseURI(api environments.Api) (*ServerStartClient, error) { +func NewServerStartClientWithBaseURI(api sdkEnv.Api) (*ServerStartClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverstart", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerStartClient: %+v", err) diff --git a/resource-manager/mysql/2021-12-01-preview/serverstop/client.go b/resource-manager/mysql/2021-12-01-preview/serverstop/client.go index c47cb0e7335..963c73af50c 100644 --- a/resource-manager/mysql/2021-12-01-preview/serverstop/client.go +++ b/resource-manager/mysql/2021-12-01-preview/serverstop/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerStopClient struct { Client *resourcemanager.Client } -func NewServerStopClientWithBaseURI(api environments.Api) (*ServerStopClient, error) { +func NewServerStopClientWithBaseURI(api sdkEnv.Api) (*ServerStopClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverstop", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerStopClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/azureadadministrators/client.go b/resource-manager/mysql/2022-01-01/azureadadministrators/client.go index eb020534988..0f3c4956c6a 100644 --- a/resource-manager/mysql/2022-01-01/azureadadministrators/client.go +++ b/resource-manager/mysql/2022-01-01/azureadadministrators/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureADAdministratorsClient struct { Client *resourcemanager.Client } -func NewAzureADAdministratorsClientWithBaseURI(api environments.Api) (*AzureADAdministratorsClient, error) { +func NewAzureADAdministratorsClientWithBaseURI(api sdkEnv.Api) (*AzureADAdministratorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azureadadministrators", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureADAdministratorsClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/backups/client.go b/resource-manager/mysql/2022-01-01/backups/client.go index ae4432efd22..b6e8894f3f9 100644 --- a/resource-manager/mysql/2022-01-01/backups/client.go +++ b/resource-manager/mysql/2022-01-01/backups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupsClient struct { Client *resourcemanager.Client } -func NewBackupsClientWithBaseURI(api environments.Api) (*BackupsClient, error) { +func NewBackupsClientWithBaseURI(api sdkEnv.Api) (*BackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupsClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/checknameavailability/client.go b/resource-manager/mysql/2022-01-01/checknameavailability/client.go index 81c73505778..5610e27c123 100644 --- a/resource-manager/mysql/2022-01-01/checknameavailability/client.go +++ b/resource-manager/mysql/2022-01-01/checknameavailability/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckNameAvailabilityClient struct { Client *resourcemanager.Client } -func NewCheckNameAvailabilityClientWithBaseURI(api environments.Api) (*CheckNameAvailabilityClient, error) { +func NewCheckNameAvailabilityClientWithBaseURI(api sdkEnv.Api) (*CheckNameAvailabilityClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checknameavailability", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckNameAvailabilityClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/client.go b/resource-manager/mysql/2022-01-01/client.go index 41d61d2f244..568b8423843 100644 --- a/resource-manager/mysql/2022-01-01/client.go +++ b/resource-manager/mysql/2022-01-01/client.go @@ -21,7 +21,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/serverstart" "github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2022-01-01/serverstop" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -41,7 +41,7 @@ type Client struct { Servers *servers.ServersClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { azureADAdministratorsClient, err := azureadadministrators.NewAzureADAdministratorsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AzureADAdministrators client: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/configurations/client.go b/resource-manager/mysql/2022-01-01/configurations/client.go index c2b3df6d8b8..b4d8c5d31c3 100644 --- a/resource-manager/mysql/2022-01-01/configurations/client.go +++ b/resource-manager/mysql/2022-01-01/configurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConfigurationsClient struct { Client *resourcemanager.Client } -func NewConfigurationsClientWithBaseURI(api environments.Api) (*ConfigurationsClient, error) { +func NewConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "configurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConfigurationsClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/databases/client.go b/resource-manager/mysql/2022-01-01/databases/client.go index bb94a331f78..6f48891ebd3 100644 --- a/resource-manager/mysql/2022-01-01/databases/client.go +++ b/resource-manager/mysql/2022-01-01/databases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabasesClient struct { Client *resourcemanager.Client } -func NewDatabasesClientWithBaseURI(api environments.Api) (*DatabasesClient, error) { +func NewDatabasesClientWithBaseURI(api sdkEnv.Api) (*DatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/firewallrules/client.go b/resource-manager/mysql/2022-01-01/firewallrules/client.go index 6493e429eb1..86eebdae36a 100644 --- a/resource-manager/mysql/2022-01-01/firewallrules/client.go +++ b/resource-manager/mysql/2022-01-01/firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallRulesClient struct { Client *resourcemanager.Client } -func NewFirewallRulesClientWithBaseURI(api environments.Api) (*FirewallRulesClient, error) { +func NewFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/getprivatednszonesuffix/client.go b/resource-manager/mysql/2022-01-01/getprivatednszonesuffix/client.go index 39cc68bc144..c2e8de57982 100644 --- a/resource-manager/mysql/2022-01-01/getprivatednszonesuffix/client.go +++ b/resource-manager/mysql/2022-01-01/getprivatednszonesuffix/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GetPrivateDnsZoneSuffixClient struct { Client *resourcemanager.Client } -func NewGetPrivateDnsZoneSuffixClientWithBaseURI(api environments.Api) (*GetPrivateDnsZoneSuffixClient, error) { +func NewGetPrivateDnsZoneSuffixClientWithBaseURI(api sdkEnv.Api) (*GetPrivateDnsZoneSuffixClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "getprivatednszonesuffix", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GetPrivateDnsZoneSuffixClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/locationbasedcapabilities/client.go b/resource-manager/mysql/2022-01-01/locationbasedcapabilities/client.go index c7ed45f57a6..b013ddc0399 100644 --- a/resource-manager/mysql/2022-01-01/locationbasedcapabilities/client.go +++ b/resource-manager/mysql/2022-01-01/locationbasedcapabilities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationBasedCapabilitiesClient struct { Client *resourcemanager.Client } -func NewLocationBasedCapabilitiesClientWithBaseURI(api environments.Api) (*LocationBasedCapabilitiesClient, error) { +func NewLocationBasedCapabilitiesClientWithBaseURI(api sdkEnv.Api) (*LocationBasedCapabilitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locationbasedcapabilities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationBasedCapabilitiesClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/logfiles/client.go b/resource-manager/mysql/2022-01-01/logfiles/client.go index 99d5dad075a..c63ea513661 100644 --- a/resource-manager/mysql/2022-01-01/logfiles/client.go +++ b/resource-manager/mysql/2022-01-01/logfiles/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LogFilesClient struct { Client *resourcemanager.Client } -func NewLogFilesClientWithBaseURI(api environments.Api) (*LogFilesClient, error) { +func NewLogFilesClientWithBaseURI(api sdkEnv.Api) (*LogFilesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "logfiles", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LogFilesClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/serverfailover/client.go b/resource-manager/mysql/2022-01-01/serverfailover/client.go index d90a9229592..1c032e52598 100644 --- a/resource-manager/mysql/2022-01-01/serverfailover/client.go +++ b/resource-manager/mysql/2022-01-01/serverfailover/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerFailoverClient struct { Client *resourcemanager.Client } -func NewServerFailoverClientWithBaseURI(api environments.Api) (*ServerFailoverClient, error) { +func NewServerFailoverClientWithBaseURI(api sdkEnv.Api) (*ServerFailoverClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverfailover", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerFailoverClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/serverrestart/client.go b/resource-manager/mysql/2022-01-01/serverrestart/client.go index dda19ef0b54..898ac1f7eb0 100644 --- a/resource-manager/mysql/2022-01-01/serverrestart/client.go +++ b/resource-manager/mysql/2022-01-01/serverrestart/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerRestartClient struct { Client *resourcemanager.Client } -func NewServerRestartClientWithBaseURI(api environments.Api) (*ServerRestartClient, error) { +func NewServerRestartClientWithBaseURI(api sdkEnv.Api) (*ServerRestartClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverrestart", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerRestartClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/servers/client.go b/resource-manager/mysql/2022-01-01/servers/client.go index a1e11668771..0788963b1fb 100644 --- a/resource-manager/mysql/2022-01-01/servers/client.go +++ b/resource-manager/mysql/2022-01-01/servers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServersClient struct { Client *resourcemanager.Client } -func NewServersClientWithBaseURI(api environments.Api) (*ServersClient, error) { +func NewServersClientWithBaseURI(api sdkEnv.Api) (*ServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServersClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/serverstart/client.go b/resource-manager/mysql/2022-01-01/serverstart/client.go index f24d38e00f9..58e29091c2a 100644 --- a/resource-manager/mysql/2022-01-01/serverstart/client.go +++ b/resource-manager/mysql/2022-01-01/serverstart/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerStartClient struct { Client *resourcemanager.Client } -func NewServerStartClientWithBaseURI(api environments.Api) (*ServerStartClient, error) { +func NewServerStartClientWithBaseURI(api sdkEnv.Api) (*ServerStartClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverstart", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerStartClient: %+v", err) diff --git a/resource-manager/mysql/2022-01-01/serverstop/client.go b/resource-manager/mysql/2022-01-01/serverstop/client.go index c47cb0e7335..963c73af50c 100644 --- a/resource-manager/mysql/2022-01-01/serverstop/client.go +++ b/resource-manager/mysql/2022-01-01/serverstop/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerStopClient struct { Client *resourcemanager.Client } -func NewServerStopClientWithBaseURI(api environments.Api) (*ServerStopClient, error) { +func NewServerStopClientWithBaseURI(api sdkEnv.Api) (*ServerStopClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverstop", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerStopClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/backuppolicy/client.go b/resource-manager/netapp/2022-05-01/backuppolicy/client.go index d8d053de926..c39ee4d0ee0 100644 --- a/resource-manager/netapp/2022-05-01/backuppolicy/client.go +++ b/resource-manager/netapp/2022-05-01/backuppolicy/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupPolicyClient struct { Client *resourcemanager.Client } -func NewBackupPolicyClientWithBaseURI(api environments.Api) (*BackupPolicyClient, error) { +func NewBackupPolicyClientWithBaseURI(api sdkEnv.Api) (*BackupPolicyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backuppolicy", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupPolicyClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/backups/client.go b/resource-manager/netapp/2022-05-01/backups/client.go index ae4432efd22..b6e8894f3f9 100644 --- a/resource-manager/netapp/2022-05-01/backups/client.go +++ b/resource-manager/netapp/2022-05-01/backups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupsClient struct { Client *resourcemanager.Client } -func NewBackupsClientWithBaseURI(api environments.Api) (*BackupsClient, error) { +func NewBackupsClientWithBaseURI(api sdkEnv.Api) (*BackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupsClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/capacitypools/client.go b/resource-manager/netapp/2022-05-01/capacitypools/client.go index 19738515c34..fcad38a6be7 100644 --- a/resource-manager/netapp/2022-05-01/capacitypools/client.go +++ b/resource-manager/netapp/2022-05-01/capacitypools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CapacityPoolsClient struct { Client *resourcemanager.Client } -func NewCapacityPoolsClientWithBaseURI(api environments.Api) (*CapacityPoolsClient, error) { +func NewCapacityPoolsClientWithBaseURI(api sdkEnv.Api) (*CapacityPoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "capacitypools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CapacityPoolsClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/client.go b/resource-manager/netapp/2022-05-01/client.go index 3e816a6bc7c..1014b4e092f 100644 --- a/resource-manager/netapp/2022-05-01/client.go +++ b/resource-manager/netapp/2022-05-01/client.go @@ -26,7 +26,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesreplication" "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesrevert" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -51,7 +51,7 @@ type Client struct { VolumesRevert *volumesrevert.VolumesRevertClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { backupPolicyClient, err := backuppolicy.NewBackupPolicyClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building BackupPolicy client: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/client.go b/resource-manager/netapp/2022-05-01/netappaccounts/client.go index 1d2c063f1fb..0611d66f32c 100644 --- a/resource-manager/netapp/2022-05-01/netappaccounts/client.go +++ b/resource-manager/netapp/2022-05-01/netappaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetAppAccountsClient struct { Client *resourcemanager.Client } -func NewNetAppAccountsClientWithBaseURI(api environments.Api) (*NetAppAccountsClient, error) { +func NewNetAppAccountsClientWithBaseURI(api sdkEnv.Api) (*NetAppAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "netappaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetAppAccountsClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/netappresource/client.go b/resource-manager/netapp/2022-05-01/netappresource/client.go index 1a445ec535b..55994e38989 100644 --- a/resource-manager/netapp/2022-05-01/netappresource/client.go +++ b/resource-manager/netapp/2022-05-01/netappresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetAppResourceClient struct { Client *resourcemanager.Client } -func NewNetAppResourceClientWithBaseURI(api environments.Api) (*NetAppResourceClient, error) { +func NewNetAppResourceClientWithBaseURI(api sdkEnv.Api) (*NetAppResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "netappresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetAppResourceClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/poolchange/client.go b/resource-manager/netapp/2022-05-01/poolchange/client.go index ab9088151a4..e237d97022c 100644 --- a/resource-manager/netapp/2022-05-01/poolchange/client.go +++ b/resource-manager/netapp/2022-05-01/poolchange/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PoolChangeClient struct { Client *resourcemanager.Client } -func NewPoolChangeClientWithBaseURI(api environments.Api) (*PoolChangeClient, error) { +func NewPoolChangeClientWithBaseURI(api sdkEnv.Api) (*PoolChangeClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "poolchange", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PoolChangeClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/resetcifspassword/client.go b/resource-manager/netapp/2022-05-01/resetcifspassword/client.go index 21c2e586fc3..8f978c85c43 100644 --- a/resource-manager/netapp/2022-05-01/resetcifspassword/client.go +++ b/resource-manager/netapp/2022-05-01/resetcifspassword/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResetCifsPasswordClient struct { Client *resourcemanager.Client } -func NewResetCifsPasswordClientWithBaseURI(api environments.Api) (*ResetCifsPasswordClient, error) { +func NewResetCifsPasswordClientWithBaseURI(api sdkEnv.Api) (*ResetCifsPasswordClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resetcifspassword", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResetCifsPasswordClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/restore/client.go b/resource-manager/netapp/2022-05-01/restore/client.go index 7a5deda5777..1c537b29234 100644 --- a/resource-manager/netapp/2022-05-01/restore/client.go +++ b/resource-manager/netapp/2022-05-01/restore/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RestoreClient struct { Client *resourcemanager.Client } -func NewRestoreClientWithBaseURI(api environments.Api) (*RestoreClient, error) { +func NewRestoreClientWithBaseURI(api sdkEnv.Api) (*RestoreClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "restore", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RestoreClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/client.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/client.go index 3dcb8ae4c43..471d9880ee7 100644 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/client.go +++ b/resource-manager/netapp/2022-05-01/snapshotpolicy/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SnapshotPolicyClient struct { Client *resourcemanager.Client } -func NewSnapshotPolicyClientWithBaseURI(api environments.Api) (*SnapshotPolicyClient, error) { +func NewSnapshotPolicyClientWithBaseURI(api sdkEnv.Api) (*SnapshotPolicyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "snapshotpolicy", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SnapshotPolicyClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/client.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/client.go index 1ff05cdb05f..0abcacc6d65 100644 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/client.go +++ b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SnapshotPolicyListVolumesClient struct { Client *resourcemanager.Client } -func NewSnapshotPolicyListVolumesClientWithBaseURI(api environments.Api) (*SnapshotPolicyListVolumesClient, error) { +func NewSnapshotPolicyListVolumesClientWithBaseURI(api sdkEnv.Api) (*SnapshotPolicyListVolumesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "snapshotpolicylistvolumes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SnapshotPolicyListVolumesClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/snapshots/client.go b/resource-manager/netapp/2022-05-01/snapshots/client.go index 3324c03a2b3..b28fb3b2bc4 100644 --- a/resource-manager/netapp/2022-05-01/snapshots/client.go +++ b/resource-manager/netapp/2022-05-01/snapshots/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SnapshotsClient struct { Client *resourcemanager.Client } -func NewSnapshotsClientWithBaseURI(api environments.Api) (*SnapshotsClient, error) { +func NewSnapshotsClientWithBaseURI(api sdkEnv.Api) (*SnapshotsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "snapshots", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SnapshotsClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/subvolumes/client.go b/resource-manager/netapp/2022-05-01/subvolumes/client.go index e21835bbc02..3aa315b862d 100644 --- a/resource-manager/netapp/2022-05-01/subvolumes/client.go +++ b/resource-manager/netapp/2022-05-01/subvolumes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SubVolumesClient struct { Client *resourcemanager.Client } -func NewSubVolumesClientWithBaseURI(api environments.Api) (*SubVolumesClient, error) { +func NewSubVolumesClientWithBaseURI(api sdkEnv.Api) (*SubVolumesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "subvolumes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SubVolumesClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/vaults/client.go b/resource-manager/netapp/2022-05-01/vaults/client.go index 878e3226482..4a7ef29c575 100644 --- a/resource-manager/netapp/2022-05-01/vaults/client.go +++ b/resource-manager/netapp/2022-05-01/vaults/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VaultsClient struct { Client *resourcemanager.Client } -func NewVaultsClientWithBaseURI(api environments.Api) (*VaultsClient, error) { +func NewVaultsClientWithBaseURI(api sdkEnv.Api) (*VaultsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vaults", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VaultsClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/volumegroups/client.go b/resource-manager/netapp/2022-05-01/volumegroups/client.go index c9b0b6c7aa5..21bfda0f382 100644 --- a/resource-manager/netapp/2022-05-01/volumegroups/client.go +++ b/resource-manager/netapp/2022-05-01/volumegroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumeGroupsClient struct { Client *resourcemanager.Client } -func NewVolumeGroupsClientWithBaseURI(api environments.Api) (*VolumeGroupsClient, error) { +func NewVolumeGroupsClientWithBaseURI(api sdkEnv.Api) (*VolumeGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumegroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumeGroupsClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/client.go b/resource-manager/netapp/2022-05-01/volumequotarules/client.go index d863c8cb379..6263abfa45b 100644 --- a/resource-manager/netapp/2022-05-01/volumequotarules/client.go +++ b/resource-manager/netapp/2022-05-01/volumequotarules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumeQuotaRulesClient struct { Client *resourcemanager.Client } -func NewVolumeQuotaRulesClientWithBaseURI(api environments.Api) (*VolumeQuotaRulesClient, error) { +func NewVolumeQuotaRulesClientWithBaseURI(api sdkEnv.Api) (*VolumeQuotaRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumequotarules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumeQuotaRulesClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/volumes/client.go b/resource-manager/netapp/2022-05-01/volumes/client.go index b55d7772812..37cd09571b5 100644 --- a/resource-manager/netapp/2022-05-01/volumes/client.go +++ b/resource-manager/netapp/2022-05-01/volumes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesClient struct { Client *resourcemanager.Client } -func NewVolumesClientWithBaseURI(api environments.Api) (*VolumesClient, error) { +func NewVolumesClientWithBaseURI(api sdkEnv.Api) (*VolumesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/volumesrelocation/client.go b/resource-manager/netapp/2022-05-01/volumesrelocation/client.go index ea74ff13a05..fd554fc3174 100644 --- a/resource-manager/netapp/2022-05-01/volumesrelocation/client.go +++ b/resource-manager/netapp/2022-05-01/volumesrelocation/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesRelocationClient struct { Client *resourcemanager.Client } -func NewVolumesRelocationClientWithBaseURI(api environments.Api) (*VolumesRelocationClient, error) { +func NewVolumesRelocationClientWithBaseURI(api sdkEnv.Api) (*VolumesRelocationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumesrelocation", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesRelocationClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/client.go b/resource-manager/netapp/2022-05-01/volumesreplication/client.go index 158479dcbce..1413a634a5a 100644 --- a/resource-manager/netapp/2022-05-01/volumesreplication/client.go +++ b/resource-manager/netapp/2022-05-01/volumesreplication/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesReplicationClient struct { Client *resourcemanager.Client } -func NewVolumesReplicationClientWithBaseURI(api environments.Api) (*VolumesReplicationClient, error) { +func NewVolumesReplicationClientWithBaseURI(api sdkEnv.Api) (*VolumesReplicationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumesreplication", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesReplicationClient: %+v", err) diff --git a/resource-manager/netapp/2022-05-01/volumesrevert/client.go b/resource-manager/netapp/2022-05-01/volumesrevert/client.go index 1477991c327..fdfdc6f3ebb 100644 --- a/resource-manager/netapp/2022-05-01/volumesrevert/client.go +++ b/resource-manager/netapp/2022-05-01/volumesrevert/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesRevertClient struct { Client *resourcemanager.Client } -func NewVolumesRevertClientWithBaseURI(api environments.Api) (*VolumesRevertClient, error) { +func NewVolumesRevertClientWithBaseURI(api sdkEnv.Api) (*VolumesRevertClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumesrevert", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesRevertClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/backuppolicy/client.go b/resource-manager/netapp/2022-09-01/backuppolicy/client.go index d8d053de926..c39ee4d0ee0 100644 --- a/resource-manager/netapp/2022-09-01/backuppolicy/client.go +++ b/resource-manager/netapp/2022-09-01/backuppolicy/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupPolicyClient struct { Client *resourcemanager.Client } -func NewBackupPolicyClientWithBaseURI(api environments.Api) (*BackupPolicyClient, error) { +func NewBackupPolicyClientWithBaseURI(api sdkEnv.Api) (*BackupPolicyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backuppolicy", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupPolicyClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/backups/client.go b/resource-manager/netapp/2022-09-01/backups/client.go index ae4432efd22..b6e8894f3f9 100644 --- a/resource-manager/netapp/2022-09-01/backups/client.go +++ b/resource-manager/netapp/2022-09-01/backups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupsClient struct { Client *resourcemanager.Client } -func NewBackupsClientWithBaseURI(api environments.Api) (*BackupsClient, error) { +func NewBackupsClientWithBaseURI(api sdkEnv.Api) (*BackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupsClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/capacitypools/client.go b/resource-manager/netapp/2022-09-01/capacitypools/client.go index 19738515c34..fcad38a6be7 100644 --- a/resource-manager/netapp/2022-09-01/capacitypools/client.go +++ b/resource-manager/netapp/2022-09-01/capacitypools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CapacityPoolsClient struct { Client *resourcemanager.Client } -func NewCapacityPoolsClientWithBaseURI(api environments.Api) (*CapacityPoolsClient, error) { +func NewCapacityPoolsClientWithBaseURI(api sdkEnv.Api) (*CapacityPoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "capacitypools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CapacityPoolsClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/client.go b/resource-manager/netapp/2022-09-01/client.go index 1841e067389..8a0ba8b3f77 100644 --- a/resource-manager/netapp/2022-09-01/client.go +++ b/resource-manager/netapp/2022-09-01/client.go @@ -26,7 +26,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumesreplication" "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumesrevert" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -51,7 +51,7 @@ type Client struct { VolumesRevert *volumesrevert.VolumesRevertClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { backupPolicyClient, err := backuppolicy.NewBackupPolicyClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building BackupPolicy client: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/filelocks/client.go b/resource-manager/netapp/2022-09-01/filelocks/client.go index 340a187e67e..fc911b7b725 100644 --- a/resource-manager/netapp/2022-09-01/filelocks/client.go +++ b/resource-manager/netapp/2022-09-01/filelocks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FileLocksClient struct { Client *resourcemanager.Client } -func NewFileLocksClientWithBaseURI(api environments.Api) (*FileLocksClient, error) { +func NewFileLocksClientWithBaseURI(api sdkEnv.Api) (*FileLocksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "filelocks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FileLocksClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/client.go b/resource-manager/netapp/2022-09-01/netappaccounts/client.go index 1d2c063f1fb..0611d66f32c 100644 --- a/resource-manager/netapp/2022-09-01/netappaccounts/client.go +++ b/resource-manager/netapp/2022-09-01/netappaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetAppAccountsClient struct { Client *resourcemanager.Client } -func NewNetAppAccountsClientWithBaseURI(api environments.Api) (*NetAppAccountsClient, error) { +func NewNetAppAccountsClientWithBaseURI(api sdkEnv.Api) (*NetAppAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "netappaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetAppAccountsClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/netappresource/client.go b/resource-manager/netapp/2022-09-01/netappresource/client.go index 1a445ec535b..55994e38989 100644 --- a/resource-manager/netapp/2022-09-01/netappresource/client.go +++ b/resource-manager/netapp/2022-09-01/netappresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetAppResourceClient struct { Client *resourcemanager.Client } -func NewNetAppResourceClientWithBaseURI(api environments.Api) (*NetAppResourceClient, error) { +func NewNetAppResourceClientWithBaseURI(api sdkEnv.Api) (*NetAppResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "netappresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetAppResourceClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/poolchange/client.go b/resource-manager/netapp/2022-09-01/poolchange/client.go index ab9088151a4..e237d97022c 100644 --- a/resource-manager/netapp/2022-09-01/poolchange/client.go +++ b/resource-manager/netapp/2022-09-01/poolchange/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PoolChangeClient struct { Client *resourcemanager.Client } -func NewPoolChangeClientWithBaseURI(api environments.Api) (*PoolChangeClient, error) { +func NewPoolChangeClientWithBaseURI(api sdkEnv.Api) (*PoolChangeClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "poolchange", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PoolChangeClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/resetcifspassword/client.go b/resource-manager/netapp/2022-09-01/resetcifspassword/client.go index 21c2e586fc3..8f978c85c43 100644 --- a/resource-manager/netapp/2022-09-01/resetcifspassword/client.go +++ b/resource-manager/netapp/2022-09-01/resetcifspassword/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResetCifsPasswordClient struct { Client *resourcemanager.Client } -func NewResetCifsPasswordClientWithBaseURI(api environments.Api) (*ResetCifsPasswordClient, error) { +func NewResetCifsPasswordClientWithBaseURI(api sdkEnv.Api) (*ResetCifsPasswordClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resetcifspassword", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResetCifsPasswordClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/restore/client.go b/resource-manager/netapp/2022-09-01/restore/client.go index 7a5deda5777..1c537b29234 100644 --- a/resource-manager/netapp/2022-09-01/restore/client.go +++ b/resource-manager/netapp/2022-09-01/restore/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RestoreClient struct { Client *resourcemanager.Client } -func NewRestoreClientWithBaseURI(api environments.Api) (*RestoreClient, error) { +func NewRestoreClientWithBaseURI(api sdkEnv.Api) (*RestoreClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "restore", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RestoreClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/client.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/client.go index 3dcb8ae4c43..471d9880ee7 100644 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/client.go +++ b/resource-manager/netapp/2022-09-01/snapshotpolicy/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SnapshotPolicyClient struct { Client *resourcemanager.Client } -func NewSnapshotPolicyClientWithBaseURI(api environments.Api) (*SnapshotPolicyClient, error) { +func NewSnapshotPolicyClientWithBaseURI(api sdkEnv.Api) (*SnapshotPolicyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "snapshotpolicy", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SnapshotPolicyClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/client.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/client.go index 1ff05cdb05f..0abcacc6d65 100644 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/client.go +++ b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SnapshotPolicyListVolumesClient struct { Client *resourcemanager.Client } -func NewSnapshotPolicyListVolumesClientWithBaseURI(api environments.Api) (*SnapshotPolicyListVolumesClient, error) { +func NewSnapshotPolicyListVolumesClientWithBaseURI(api sdkEnv.Api) (*SnapshotPolicyListVolumesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "snapshotpolicylistvolumes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SnapshotPolicyListVolumesClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/snapshots/client.go b/resource-manager/netapp/2022-09-01/snapshots/client.go index 3324c03a2b3..b28fb3b2bc4 100644 --- a/resource-manager/netapp/2022-09-01/snapshots/client.go +++ b/resource-manager/netapp/2022-09-01/snapshots/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SnapshotsClient struct { Client *resourcemanager.Client } -func NewSnapshotsClientWithBaseURI(api environments.Api) (*SnapshotsClient, error) { +func NewSnapshotsClientWithBaseURI(api sdkEnv.Api) (*SnapshotsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "snapshots", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SnapshotsClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/subvolumes/client.go b/resource-manager/netapp/2022-09-01/subvolumes/client.go index e21835bbc02..3aa315b862d 100644 --- a/resource-manager/netapp/2022-09-01/subvolumes/client.go +++ b/resource-manager/netapp/2022-09-01/subvolumes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SubVolumesClient struct { Client *resourcemanager.Client } -func NewSubVolumesClientWithBaseURI(api environments.Api) (*SubVolumesClient, error) { +func NewSubVolumesClientWithBaseURI(api sdkEnv.Api) (*SubVolumesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "subvolumes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SubVolumesClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/volumegroups/client.go b/resource-manager/netapp/2022-09-01/volumegroups/client.go index c9b0b6c7aa5..21bfda0f382 100644 --- a/resource-manager/netapp/2022-09-01/volumegroups/client.go +++ b/resource-manager/netapp/2022-09-01/volumegroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumeGroupsClient struct { Client *resourcemanager.Client } -func NewVolumeGroupsClientWithBaseURI(api environments.Api) (*VolumeGroupsClient, error) { +func NewVolumeGroupsClientWithBaseURI(api sdkEnv.Api) (*VolumeGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumegroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumeGroupsClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/client.go b/resource-manager/netapp/2022-09-01/volumequotarules/client.go index d863c8cb379..6263abfa45b 100644 --- a/resource-manager/netapp/2022-09-01/volumequotarules/client.go +++ b/resource-manager/netapp/2022-09-01/volumequotarules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumeQuotaRulesClient struct { Client *resourcemanager.Client } -func NewVolumeQuotaRulesClientWithBaseURI(api environments.Api) (*VolumeQuotaRulesClient, error) { +func NewVolumeQuotaRulesClientWithBaseURI(api sdkEnv.Api) (*VolumeQuotaRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumequotarules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumeQuotaRulesClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/volumes/client.go b/resource-manager/netapp/2022-09-01/volumes/client.go index b55d7772812..37cd09571b5 100644 --- a/resource-manager/netapp/2022-09-01/volumes/client.go +++ b/resource-manager/netapp/2022-09-01/volumes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesClient struct { Client *resourcemanager.Client } -func NewVolumesClientWithBaseURI(api environments.Api) (*VolumesClient, error) { +func NewVolumesClientWithBaseURI(api sdkEnv.Api) (*VolumesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/volumesrelocation/client.go b/resource-manager/netapp/2022-09-01/volumesrelocation/client.go index ea74ff13a05..fd554fc3174 100644 --- a/resource-manager/netapp/2022-09-01/volumesrelocation/client.go +++ b/resource-manager/netapp/2022-09-01/volumesrelocation/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesRelocationClient struct { Client *resourcemanager.Client } -func NewVolumesRelocationClientWithBaseURI(api environments.Api) (*VolumesRelocationClient, error) { +func NewVolumesRelocationClientWithBaseURI(api sdkEnv.Api) (*VolumesRelocationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumesrelocation", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesRelocationClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/client.go b/resource-manager/netapp/2022-09-01/volumesreplication/client.go index 158479dcbce..1413a634a5a 100644 --- a/resource-manager/netapp/2022-09-01/volumesreplication/client.go +++ b/resource-manager/netapp/2022-09-01/volumesreplication/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesReplicationClient struct { Client *resourcemanager.Client } -func NewVolumesReplicationClientWithBaseURI(api environments.Api) (*VolumesReplicationClient, error) { +func NewVolumesReplicationClientWithBaseURI(api sdkEnv.Api) (*VolumesReplicationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumesreplication", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesReplicationClient: %+v", err) diff --git a/resource-manager/netapp/2022-09-01/volumesrevert/client.go b/resource-manager/netapp/2022-09-01/volumesrevert/client.go index 1477991c327..fdfdc6f3ebb 100644 --- a/resource-manager/netapp/2022-09-01/volumesrevert/client.go +++ b/resource-manager/netapp/2022-09-01/volumesrevert/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesRevertClient struct { Client *resourcemanager.Client } -func NewVolumesRevertClientWithBaseURI(api environments.Api) (*VolumesRevertClient, error) { +func NewVolumesRevertClientWithBaseURI(api sdkEnv.Api) (*VolumesRevertClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumesrevert", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesRevertClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/backuppolicy/client.go b/resource-manager/netapp/2022-11-01/backuppolicy/client.go index d8d053de926..c39ee4d0ee0 100644 --- a/resource-manager/netapp/2022-11-01/backuppolicy/client.go +++ b/resource-manager/netapp/2022-11-01/backuppolicy/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupPolicyClient struct { Client *resourcemanager.Client } -func NewBackupPolicyClientWithBaseURI(api environments.Api) (*BackupPolicyClient, error) { +func NewBackupPolicyClientWithBaseURI(api sdkEnv.Api) (*BackupPolicyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backuppolicy", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupPolicyClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/backups/client.go b/resource-manager/netapp/2022-11-01/backups/client.go index ae4432efd22..b6e8894f3f9 100644 --- a/resource-manager/netapp/2022-11-01/backups/client.go +++ b/resource-manager/netapp/2022-11-01/backups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupsClient struct { Client *resourcemanager.Client } -func NewBackupsClientWithBaseURI(api environments.Api) (*BackupsClient, error) { +func NewBackupsClientWithBaseURI(api sdkEnv.Api) (*BackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupsClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/capacitypools/client.go b/resource-manager/netapp/2022-11-01/capacitypools/client.go index 19738515c34..fcad38a6be7 100644 --- a/resource-manager/netapp/2022-11-01/capacitypools/client.go +++ b/resource-manager/netapp/2022-11-01/capacitypools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CapacityPoolsClient struct { Client *resourcemanager.Client } -func NewCapacityPoolsClientWithBaseURI(api environments.Api) (*CapacityPoolsClient, error) { +func NewCapacityPoolsClientWithBaseURI(api sdkEnv.Api) (*CapacityPoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "capacitypools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CapacityPoolsClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/client.go b/resource-manager/netapp/2022-11-01/client.go index efa4ac2c9ac..8c8e4fd0040 100644 --- a/resource-manager/netapp/2022-11-01/client.go +++ b/resource-manager/netapp/2022-11-01/client.go @@ -27,7 +27,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumesreplication" "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumesrevert" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -53,7 +53,7 @@ type Client struct { VolumesRevert *volumesrevert.VolumesRevertClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { backupPolicyClient, err := backuppolicy.NewBackupPolicyClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building BackupPolicy client: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/filelocks/client.go b/resource-manager/netapp/2022-11-01/filelocks/client.go index 340a187e67e..fc911b7b725 100644 --- a/resource-manager/netapp/2022-11-01/filelocks/client.go +++ b/resource-manager/netapp/2022-11-01/filelocks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FileLocksClient struct { Client *resourcemanager.Client } -func NewFileLocksClientWithBaseURI(api environments.Api) (*FileLocksClient, error) { +func NewFileLocksClientWithBaseURI(api sdkEnv.Api) (*FileLocksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "filelocks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FileLocksClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/client.go b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/client.go index 0f139bf01e9..27dc3d3ac23 100644 --- a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/client.go +++ b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GroupIdListForLDAPUserClient struct { Client *resourcemanager.Client } -func NewGroupIdListForLDAPUserClientWithBaseURI(api environments.Api) (*GroupIdListForLDAPUserClient, error) { +func NewGroupIdListForLDAPUserClientWithBaseURI(api sdkEnv.Api) (*GroupIdListForLDAPUserClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "groupidlistforldapuser", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GroupIdListForLDAPUserClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/client.go b/resource-manager/netapp/2022-11-01/netappaccounts/client.go index 1d2c063f1fb..0611d66f32c 100644 --- a/resource-manager/netapp/2022-11-01/netappaccounts/client.go +++ b/resource-manager/netapp/2022-11-01/netappaccounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetAppAccountsClient struct { Client *resourcemanager.Client } -func NewNetAppAccountsClientWithBaseURI(api environments.Api) (*NetAppAccountsClient, error) { +func NewNetAppAccountsClientWithBaseURI(api sdkEnv.Api) (*NetAppAccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "netappaccounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetAppAccountsClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/netappresource/client.go b/resource-manager/netapp/2022-11-01/netappresource/client.go index 1a445ec535b..55994e38989 100644 --- a/resource-manager/netapp/2022-11-01/netappresource/client.go +++ b/resource-manager/netapp/2022-11-01/netappresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetAppResourceClient struct { Client *resourcemanager.Client } -func NewNetAppResourceClientWithBaseURI(api environments.Api) (*NetAppResourceClient, error) { +func NewNetAppResourceClientWithBaseURI(api sdkEnv.Api) (*NetAppResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "netappresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetAppResourceClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/poolchange/client.go b/resource-manager/netapp/2022-11-01/poolchange/client.go index ab9088151a4..e237d97022c 100644 --- a/resource-manager/netapp/2022-11-01/poolchange/client.go +++ b/resource-manager/netapp/2022-11-01/poolchange/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PoolChangeClient struct { Client *resourcemanager.Client } -func NewPoolChangeClientWithBaseURI(api environments.Api) (*PoolChangeClient, error) { +func NewPoolChangeClientWithBaseURI(api sdkEnv.Api) (*PoolChangeClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "poolchange", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PoolChangeClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/resetcifspassword/client.go b/resource-manager/netapp/2022-11-01/resetcifspassword/client.go index 21c2e586fc3..8f978c85c43 100644 --- a/resource-manager/netapp/2022-11-01/resetcifspassword/client.go +++ b/resource-manager/netapp/2022-11-01/resetcifspassword/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResetCifsPasswordClient struct { Client *resourcemanager.Client } -func NewResetCifsPasswordClientWithBaseURI(api environments.Api) (*ResetCifsPasswordClient, error) { +func NewResetCifsPasswordClientWithBaseURI(api sdkEnv.Api) (*ResetCifsPasswordClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resetcifspassword", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResetCifsPasswordClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/restore/client.go b/resource-manager/netapp/2022-11-01/restore/client.go index 7a5deda5777..1c537b29234 100644 --- a/resource-manager/netapp/2022-11-01/restore/client.go +++ b/resource-manager/netapp/2022-11-01/restore/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RestoreClient struct { Client *resourcemanager.Client } -func NewRestoreClientWithBaseURI(api environments.Api) (*RestoreClient, error) { +func NewRestoreClientWithBaseURI(api sdkEnv.Api) (*RestoreClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "restore", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RestoreClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/client.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/client.go index 3dcb8ae4c43..471d9880ee7 100644 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/client.go +++ b/resource-manager/netapp/2022-11-01/snapshotpolicy/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SnapshotPolicyClient struct { Client *resourcemanager.Client } -func NewSnapshotPolicyClientWithBaseURI(api environments.Api) (*SnapshotPolicyClient, error) { +func NewSnapshotPolicyClientWithBaseURI(api sdkEnv.Api) (*SnapshotPolicyClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "snapshotpolicy", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SnapshotPolicyClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/client.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/client.go index 1ff05cdb05f..0abcacc6d65 100644 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/client.go +++ b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SnapshotPolicyListVolumesClient struct { Client *resourcemanager.Client } -func NewSnapshotPolicyListVolumesClientWithBaseURI(api environments.Api) (*SnapshotPolicyListVolumesClient, error) { +func NewSnapshotPolicyListVolumesClientWithBaseURI(api sdkEnv.Api) (*SnapshotPolicyListVolumesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "snapshotpolicylistvolumes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SnapshotPolicyListVolumesClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/snapshots/client.go b/resource-manager/netapp/2022-11-01/snapshots/client.go index 3324c03a2b3..b28fb3b2bc4 100644 --- a/resource-manager/netapp/2022-11-01/snapshots/client.go +++ b/resource-manager/netapp/2022-11-01/snapshots/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SnapshotsClient struct { Client *resourcemanager.Client } -func NewSnapshotsClientWithBaseURI(api environments.Api) (*SnapshotsClient, error) { +func NewSnapshotsClientWithBaseURI(api sdkEnv.Api) (*SnapshotsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "snapshots", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SnapshotsClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/subvolumes/client.go b/resource-manager/netapp/2022-11-01/subvolumes/client.go index e21835bbc02..3aa315b862d 100644 --- a/resource-manager/netapp/2022-11-01/subvolumes/client.go +++ b/resource-manager/netapp/2022-11-01/subvolumes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SubVolumesClient struct { Client *resourcemanager.Client } -func NewSubVolumesClientWithBaseURI(api environments.Api) (*SubVolumesClient, error) { +func NewSubVolumesClientWithBaseURI(api sdkEnv.Api) (*SubVolumesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "subvolumes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SubVolumesClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/volumegroups/client.go b/resource-manager/netapp/2022-11-01/volumegroups/client.go index c9b0b6c7aa5..21bfda0f382 100644 --- a/resource-manager/netapp/2022-11-01/volumegroups/client.go +++ b/resource-manager/netapp/2022-11-01/volumegroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumeGroupsClient struct { Client *resourcemanager.Client } -func NewVolumeGroupsClientWithBaseURI(api environments.Api) (*VolumeGroupsClient, error) { +func NewVolumeGroupsClientWithBaseURI(api sdkEnv.Api) (*VolumeGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumegroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumeGroupsClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/client.go b/resource-manager/netapp/2022-11-01/volumequotarules/client.go index d863c8cb379..6263abfa45b 100644 --- a/resource-manager/netapp/2022-11-01/volumequotarules/client.go +++ b/resource-manager/netapp/2022-11-01/volumequotarules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumeQuotaRulesClient struct { Client *resourcemanager.Client } -func NewVolumeQuotaRulesClientWithBaseURI(api environments.Api) (*VolumeQuotaRulesClient, error) { +func NewVolumeQuotaRulesClientWithBaseURI(api sdkEnv.Api) (*VolumeQuotaRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumequotarules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumeQuotaRulesClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/volumes/client.go b/resource-manager/netapp/2022-11-01/volumes/client.go index b55d7772812..37cd09571b5 100644 --- a/resource-manager/netapp/2022-11-01/volumes/client.go +++ b/resource-manager/netapp/2022-11-01/volumes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesClient struct { Client *resourcemanager.Client } -func NewVolumesClientWithBaseURI(api environments.Api) (*VolumesClient, error) { +func NewVolumesClientWithBaseURI(api sdkEnv.Api) (*VolumesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/volumesrelocation/client.go b/resource-manager/netapp/2022-11-01/volumesrelocation/client.go index ea74ff13a05..fd554fc3174 100644 --- a/resource-manager/netapp/2022-11-01/volumesrelocation/client.go +++ b/resource-manager/netapp/2022-11-01/volumesrelocation/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesRelocationClient struct { Client *resourcemanager.Client } -func NewVolumesRelocationClientWithBaseURI(api environments.Api) (*VolumesRelocationClient, error) { +func NewVolumesRelocationClientWithBaseURI(api sdkEnv.Api) (*VolumesRelocationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumesrelocation", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesRelocationClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/client.go b/resource-manager/netapp/2022-11-01/volumesreplication/client.go index 158479dcbce..1413a634a5a 100644 --- a/resource-manager/netapp/2022-11-01/volumesreplication/client.go +++ b/resource-manager/netapp/2022-11-01/volumesreplication/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesReplicationClient struct { Client *resourcemanager.Client } -func NewVolumesReplicationClientWithBaseURI(api environments.Api) (*VolumesReplicationClient, error) { +func NewVolumesReplicationClientWithBaseURI(api sdkEnv.Api) (*VolumesReplicationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumesreplication", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesReplicationClient: %+v", err) diff --git a/resource-manager/netapp/2022-11-01/volumesrevert/client.go b/resource-manager/netapp/2022-11-01/volumesrevert/client.go index 1477991c327..fdfdc6f3ebb 100644 --- a/resource-manager/netapp/2022-11-01/volumesrevert/client.go +++ b/resource-manager/netapp/2022-11-01/volumesrevert/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VolumesRevertClient struct { Client *resourcemanager.Client } -func NewVolumesRevertClientWithBaseURI(api environments.Api) (*VolumesRevertClient, error) { +func NewVolumesRevertClientWithBaseURI(api sdkEnv.Api) (*VolumesRevertClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "volumesrevert", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VolumesRevertClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/adminrulecollections/client.go b/resource-manager/network/2023-02-01/adminrulecollections/client.go index 8178e8ff455..2eaead35494 100644 --- a/resource-manager/network/2023-02-01/adminrulecollections/client.go +++ b/resource-manager/network/2023-02-01/adminrulecollections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AdminRuleCollectionsClient struct { Client *resourcemanager.Client } -func NewAdminRuleCollectionsClientWithBaseURI(api environments.Api) (*AdminRuleCollectionsClient, error) { +func NewAdminRuleCollectionsClientWithBaseURI(api sdkEnv.Api) (*AdminRuleCollectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "adminrulecollections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AdminRuleCollectionsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/adminrules/client.go b/resource-manager/network/2023-02-01/adminrules/client.go index 30ee4dc30a9..13ae830ab34 100644 --- a/resource-manager/network/2023-02-01/adminrules/client.go +++ b/resource-manager/network/2023-02-01/adminrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AdminRulesClient struct { Client *resourcemanager.Client } -func NewAdminRulesClientWithBaseURI(api environments.Api) (*AdminRulesClient, error) { +func NewAdminRulesClientWithBaseURI(api sdkEnv.Api) (*AdminRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "adminrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AdminRulesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/applicationgatewayprivateendpointconnections/client.go b/resource-manager/network/2023-02-01/applicationgatewayprivateendpointconnections/client.go index 82e12c872f2..ea44eb9d433 100644 --- a/resource-manager/network/2023-02-01/applicationgatewayprivateendpointconnections/client.go +++ b/resource-manager/network/2023-02-01/applicationgatewayprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGatewayPrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewApplicationGatewayPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*ApplicationGatewayPrivateEndpointConnectionsClient, error) { +func NewApplicationGatewayPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*ApplicationGatewayPrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgatewayprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGatewayPrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/applicationgatewayprivatelinkresources/client.go b/resource-manager/network/2023-02-01/applicationgatewayprivatelinkresources/client.go index 6e8b9365411..6af36474e36 100644 --- a/resource-manager/network/2023-02-01/applicationgatewayprivatelinkresources/client.go +++ b/resource-manager/network/2023-02-01/applicationgatewayprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGatewayPrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewApplicationGatewayPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*ApplicationGatewayPrivateLinkResourcesClient, error) { +func NewApplicationGatewayPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*ApplicationGatewayPrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgatewayprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGatewayPrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/applicationgateways/client.go b/resource-manager/network/2023-02-01/applicationgateways/client.go index eeadef05934..3d86579afb8 100644 --- a/resource-manager/network/2023-02-01/applicationgateways/client.go +++ b/resource-manager/network/2023-02-01/applicationgateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGatewaysClient struct { Client *resourcemanager.Client } -func NewApplicationGatewaysClientWithBaseURI(api environments.Api) (*ApplicationGatewaysClient, error) { +func NewApplicationGatewaysClientWithBaseURI(api sdkEnv.Api) (*ApplicationGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/applicationgatewaywafdynamicmanifests/client.go b/resource-manager/network/2023-02-01/applicationgatewaywafdynamicmanifests/client.go index 9f40236f2da..42a068f3a9e 100644 --- a/resource-manager/network/2023-02-01/applicationgatewaywafdynamicmanifests/client.go +++ b/resource-manager/network/2023-02-01/applicationgatewaywafdynamicmanifests/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGatewayWafDynamicManifestsClient struct { Client *resourcemanager.Client } -func NewApplicationGatewayWafDynamicManifestsClientWithBaseURI(api environments.Api) (*ApplicationGatewayWafDynamicManifestsClient, error) { +func NewApplicationGatewayWafDynamicManifestsClientWithBaseURI(api sdkEnv.Api) (*ApplicationGatewayWafDynamicManifestsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgatewaywafdynamicmanifests", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGatewayWafDynamicManifestsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/applicationsecuritygroups/client.go b/resource-manager/network/2023-02-01/applicationsecuritygroups/client.go index dd9e39290e5..7ca3740cb77 100644 --- a/resource-manager/network/2023-02-01/applicationsecuritygroups/client.go +++ b/resource-manager/network/2023-02-01/applicationsecuritygroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationSecurityGroupsClient struct { Client *resourcemanager.Client } -func NewApplicationSecurityGroupsClientWithBaseURI(api environments.Api) (*ApplicationSecurityGroupsClient, error) { +func NewApplicationSecurityGroupsClientWithBaseURI(api sdkEnv.Api) (*ApplicationSecurityGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationsecuritygroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationSecurityGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/availabledelegations/client.go b/resource-manager/network/2023-02-01/availabledelegations/client.go index 89733dd49b8..be6635afe98 100644 --- a/resource-manager/network/2023-02-01/availabledelegations/client.go +++ b/resource-manager/network/2023-02-01/availabledelegations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AvailableDelegationsClient struct { Client *resourcemanager.Client } -func NewAvailableDelegationsClientWithBaseURI(api environments.Api) (*AvailableDelegationsClient, error) { +func NewAvailableDelegationsClientWithBaseURI(api sdkEnv.Api) (*AvailableDelegationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "availabledelegations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AvailableDelegationsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/availableservicealiases/client.go b/resource-manager/network/2023-02-01/availableservicealiases/client.go index d4e19363f94..3ed32820b32 100644 --- a/resource-manager/network/2023-02-01/availableservicealiases/client.go +++ b/resource-manager/network/2023-02-01/availableservicealiases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AvailableServiceAliasesClient struct { Client *resourcemanager.Client } -func NewAvailableServiceAliasesClientWithBaseURI(api environments.Api) (*AvailableServiceAliasesClient, error) { +func NewAvailableServiceAliasesClientWithBaseURI(api sdkEnv.Api) (*AvailableServiceAliasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "availableservicealiases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AvailableServiceAliasesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/azurefirewalls/client.go b/resource-manager/network/2023-02-01/azurefirewalls/client.go index 3ea45e69959..3eca5e45e21 100644 --- a/resource-manager/network/2023-02-01/azurefirewalls/client.go +++ b/resource-manager/network/2023-02-01/azurefirewalls/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureFirewallsClient struct { Client *resourcemanager.Client } -func NewAzureFirewallsClientWithBaseURI(api environments.Api) (*AzureFirewallsClient, error) { +func NewAzureFirewallsClientWithBaseURI(api sdkEnv.Api) (*AzureFirewallsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azurefirewalls", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureFirewallsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/bastionhosts/client.go b/resource-manager/network/2023-02-01/bastionhosts/client.go index 1cea8c22bf7..0f13e81c2cb 100644 --- a/resource-manager/network/2023-02-01/bastionhosts/client.go +++ b/resource-manager/network/2023-02-01/bastionhosts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BastionHostsClient struct { Client *resourcemanager.Client } -func NewBastionHostsClientWithBaseURI(api environments.Api) (*BastionHostsClient, error) { +func NewBastionHostsClientWithBaseURI(api sdkEnv.Api) (*BastionHostsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "bastionhosts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BastionHostsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/bastionshareablelink/client.go b/resource-manager/network/2023-02-01/bastionshareablelink/client.go index 6a702fa865f..27248e64437 100644 --- a/resource-manager/network/2023-02-01/bastionshareablelink/client.go +++ b/resource-manager/network/2023-02-01/bastionshareablelink/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BastionShareableLinkClient struct { Client *resourcemanager.Client } -func NewBastionShareableLinkClientWithBaseURI(api environments.Api) (*BastionShareableLinkClient, error) { +func NewBastionShareableLinkClientWithBaseURI(api sdkEnv.Api) (*BastionShareableLinkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "bastionshareablelink", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BastionShareableLinkClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/bgpservicecommunities/client.go b/resource-manager/network/2023-02-01/bgpservicecommunities/client.go index 8b4af98886b..8c24a379ec2 100644 --- a/resource-manager/network/2023-02-01/bgpservicecommunities/client.go +++ b/resource-manager/network/2023-02-01/bgpservicecommunities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BgpServiceCommunitiesClient struct { Client *resourcemanager.Client } -func NewBgpServiceCommunitiesClientWithBaseURI(api environments.Api) (*BgpServiceCommunitiesClient, error) { +func NewBgpServiceCommunitiesClientWithBaseURI(api sdkEnv.Api) (*BgpServiceCommunitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "bgpservicecommunities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BgpServiceCommunitiesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/checkdnsavailabilities/client.go b/resource-manager/network/2023-02-01/checkdnsavailabilities/client.go index 9e9e5e81b3f..d07849ac4ac 100644 --- a/resource-manager/network/2023-02-01/checkdnsavailabilities/client.go +++ b/resource-manager/network/2023-02-01/checkdnsavailabilities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckDnsAvailabilitiesClient struct { Client *resourcemanager.Client } -func NewCheckDnsAvailabilitiesClientWithBaseURI(api environments.Api) (*CheckDnsAvailabilitiesClient, error) { +func NewCheckDnsAvailabilitiesClientWithBaseURI(api sdkEnv.Api) (*CheckDnsAvailabilitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checkdnsavailabilities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckDnsAvailabilitiesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/client.go b/resource-manager/network/2023-02-01/client.go index 1594b8682c8..43b0570d5b7 100644 --- a/resource-manager/network/2023-02-01/client.go +++ b/resource-manager/network/2023-02-01/client.go @@ -114,7 +114,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-02-01/webapplicationfirewallpolicies" "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-02-01/webcategories" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -227,7 +227,7 @@ type Client struct { WebCategories *webcategories.WebCategoriesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { adminRuleCollectionsClient, err := adminrulecollections.NewAdminRuleCollectionsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AdminRuleCollections client: %+v", err) diff --git a/resource-manager/network/2023-02-01/cloudservicepublicipaddresses/client.go b/resource-manager/network/2023-02-01/cloudservicepublicipaddresses/client.go index 621129e8737..04c184c000c 100644 --- a/resource-manager/network/2023-02-01/cloudservicepublicipaddresses/client.go +++ b/resource-manager/network/2023-02-01/cloudservicepublicipaddresses/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CloudServicePublicIPAddressesClient struct { Client *resourcemanager.Client } -func NewCloudServicePublicIPAddressesClientWithBaseURI(api environments.Api) (*CloudServicePublicIPAddressesClient, error) { +func NewCloudServicePublicIPAddressesClientWithBaseURI(api sdkEnv.Api) (*CloudServicePublicIPAddressesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "cloudservicepublicipaddresses", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CloudServicePublicIPAddressesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/connectionmonitors/client.go b/resource-manager/network/2023-02-01/connectionmonitors/client.go index 75b9acef7e8..29a35eb9a26 100644 --- a/resource-manager/network/2023-02-01/connectionmonitors/client.go +++ b/resource-manager/network/2023-02-01/connectionmonitors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConnectionMonitorsClient struct { Client *resourcemanager.Client } -func NewConnectionMonitorsClientWithBaseURI(api environments.Api) (*ConnectionMonitorsClient, error) { +func NewConnectionMonitorsClientWithBaseURI(api sdkEnv.Api) (*ConnectionMonitorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "connectionmonitors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConnectionMonitorsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/connectivityconfigurations/client.go b/resource-manager/network/2023-02-01/connectivityconfigurations/client.go index ff548b06d0f..3d5049ab191 100644 --- a/resource-manager/network/2023-02-01/connectivityconfigurations/client.go +++ b/resource-manager/network/2023-02-01/connectivityconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConnectivityConfigurationsClient struct { Client *resourcemanager.Client } -func NewConnectivityConfigurationsClientWithBaseURI(api environments.Api) (*ConnectivityConfigurationsClient, error) { +func NewConnectivityConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConnectivityConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "connectivityconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConnectivityConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/customipprefixes/client.go b/resource-manager/network/2023-02-01/customipprefixes/client.go index 31f10177172..5a7199b239a 100644 --- a/resource-manager/network/2023-02-01/customipprefixes/client.go +++ b/resource-manager/network/2023-02-01/customipprefixes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CustomIPPrefixesClient struct { Client *resourcemanager.Client } -func NewCustomIPPrefixesClientWithBaseURI(api environments.Api) (*CustomIPPrefixesClient, error) { +func NewCustomIPPrefixesClientWithBaseURI(api sdkEnv.Api) (*CustomIPPrefixesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "customipprefixes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CustomIPPrefixesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/ddoscustompolicies/client.go b/resource-manager/network/2023-02-01/ddoscustompolicies/client.go index e9d35f8b060..6b6f1542bb7 100644 --- a/resource-manager/network/2023-02-01/ddoscustompolicies/client.go +++ b/resource-manager/network/2023-02-01/ddoscustompolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DdosCustomPoliciesClient struct { Client *resourcemanager.Client } -func NewDdosCustomPoliciesClientWithBaseURI(api environments.Api) (*DdosCustomPoliciesClient, error) { +func NewDdosCustomPoliciesClientWithBaseURI(api sdkEnv.Api) (*DdosCustomPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ddoscustompolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DdosCustomPoliciesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/ddosprotectionplans/client.go b/resource-manager/network/2023-02-01/ddosprotectionplans/client.go index df2917fd5cf..1849f2c3bfa 100644 --- a/resource-manager/network/2023-02-01/ddosprotectionplans/client.go +++ b/resource-manager/network/2023-02-01/ddosprotectionplans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DdosProtectionPlansClient struct { Client *resourcemanager.Client } -func NewDdosProtectionPlansClientWithBaseURI(api environments.Api) (*DdosProtectionPlansClient, error) { +func NewDdosProtectionPlansClientWithBaseURI(api sdkEnv.Api) (*DdosProtectionPlansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ddosprotectionplans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DdosProtectionPlansClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/dscpconfiguration/client.go b/resource-manager/network/2023-02-01/dscpconfiguration/client.go index dd1ba400a66..6d8cc0e19c7 100644 --- a/resource-manager/network/2023-02-01/dscpconfiguration/client.go +++ b/resource-manager/network/2023-02-01/dscpconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DscpConfigurationClient struct { Client *resourcemanager.Client } -func NewDscpConfigurationClientWithBaseURI(api environments.Api) (*DscpConfigurationClient, error) { +func NewDscpConfigurationClientWithBaseURI(api sdkEnv.Api) (*DscpConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dscpconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DscpConfigurationClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/dscpconfigurations/client.go b/resource-manager/network/2023-02-01/dscpconfigurations/client.go index 23c3e89b48f..59faae1af96 100644 --- a/resource-manager/network/2023-02-01/dscpconfigurations/client.go +++ b/resource-manager/network/2023-02-01/dscpconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DscpConfigurationsClient struct { Client *resourcemanager.Client } -func NewDscpConfigurationsClientWithBaseURI(api environments.Api) (*DscpConfigurationsClient, error) { +func NewDscpConfigurationsClientWithBaseURI(api sdkEnv.Api) (*DscpConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dscpconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DscpConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/endpointservices/client.go b/resource-manager/network/2023-02-01/endpointservices/client.go index 2cf01f43cdd..262f10d12ed 100644 --- a/resource-manager/network/2023-02-01/endpointservices/client.go +++ b/resource-manager/network/2023-02-01/endpointservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EndpointServicesClient struct { Client *resourcemanager.Client } -func NewEndpointServicesClientWithBaseURI(api environments.Api) (*EndpointServicesClient, error) { +func NewEndpointServicesClientWithBaseURI(api sdkEnv.Api) (*EndpointServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "endpointservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EndpointServicesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecircuitarptable/client.go b/resource-manager/network/2023-02-01/expressroutecircuitarptable/client.go index daef3b62246..22d680b7411 100644 --- a/resource-manager/network/2023-02-01/expressroutecircuitarptable/client.go +++ b/resource-manager/network/2023-02-01/expressroutecircuitarptable/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitArpTableClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitArpTableClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitArpTableClient, error) { +func NewExpressRouteCircuitArpTableClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitArpTableClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitarptable", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitArpTableClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecircuitauthorizations/client.go b/resource-manager/network/2023-02-01/expressroutecircuitauthorizations/client.go index 8ee64242c49..0d7bb179887 100644 --- a/resource-manager/network/2023-02-01/expressroutecircuitauthorizations/client.go +++ b/resource-manager/network/2023-02-01/expressroutecircuitauthorizations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitAuthorizationsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitAuthorizationsClient, error) { +func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitAuthorizationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitauthorizations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitAuthorizationsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecircuitconnections/client.go b/resource-manager/network/2023-02-01/expressroutecircuitconnections/client.go index 0fc743a7f46..999d2e53637 100644 --- a/resource-manager/network/2023-02-01/expressroutecircuitconnections/client.go +++ b/resource-manager/network/2023-02-01/expressroutecircuitconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitConnectionsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitConnectionsClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitConnectionsClient, error) { +func NewExpressRouteCircuitConnectionsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecircuitpeerings/client.go b/resource-manager/network/2023-02-01/expressroutecircuitpeerings/client.go index 3d549f1e88d..6251e002c81 100644 --- a/resource-manager/network/2023-02-01/expressroutecircuitpeerings/client.go +++ b/resource-manager/network/2023-02-01/expressroutecircuitpeerings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitPeeringsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitPeeringsClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitPeeringsClient, error) { +func NewExpressRouteCircuitPeeringsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitPeeringsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitpeerings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitPeeringsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecircuitroutestable/client.go b/resource-manager/network/2023-02-01/expressroutecircuitroutestable/client.go index 4122036f496..5350326f6db 100644 --- a/resource-manager/network/2023-02-01/expressroutecircuitroutestable/client.go +++ b/resource-manager/network/2023-02-01/expressroutecircuitroutestable/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitRoutesTableClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitRoutesTableClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitRoutesTableClient, error) { +func NewExpressRouteCircuitRoutesTableClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitRoutesTableClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitroutestable", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitRoutesTableClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecircuitroutestablesummary/client.go b/resource-manager/network/2023-02-01/expressroutecircuitroutestablesummary/client.go index 93516365ad8..78565f4e478 100644 --- a/resource-manager/network/2023-02-01/expressroutecircuitroutestablesummary/client.go +++ b/resource-manager/network/2023-02-01/expressroutecircuitroutestablesummary/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitRoutesTableSummaryClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitRoutesTableSummaryClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitRoutesTableSummaryClient, error) { +func NewExpressRouteCircuitRoutesTableSummaryClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitRoutesTableSummaryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitroutestablesummary", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitRoutesTableSummaryClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecircuits/client.go b/resource-manager/network/2023-02-01/expressroutecircuits/client.go index 380fde4f56c..2210d04845f 100644 --- a/resource-manager/network/2023-02-01/expressroutecircuits/client.go +++ b/resource-manager/network/2023-02-01/expressroutecircuits/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitsClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitsClient, error) { +func NewExpressRouteCircuitsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuits", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecircuitstats/client.go b/resource-manager/network/2023-02-01/expressroutecircuitstats/client.go index 1ccb263389c..ba8460f5591 100644 --- a/resource-manager/network/2023-02-01/expressroutecircuitstats/client.go +++ b/resource-manager/network/2023-02-01/expressroutecircuitstats/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitStatsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitStatsClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitStatsClient, error) { +func NewExpressRouteCircuitStatsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitStatsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitstats", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitStatsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressrouteconnections/client.go b/resource-manager/network/2023-02-01/expressrouteconnections/client.go index 9fb5bde933b..42e9b0b6c07 100644 --- a/resource-manager/network/2023-02-01/expressrouteconnections/client.go +++ b/resource-manager/network/2023-02-01/expressrouteconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteConnectionsClient struct { Client *resourcemanager.Client } -func NewExpressRouteConnectionsClientWithBaseURI(api environments.Api) (*ExpressRouteConnectionsClient, error) { +func NewExpressRouteConnectionsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecrossconnectionarptable/client.go b/resource-manager/network/2023-02-01/expressroutecrossconnectionarptable/client.go index 674582d3ee4..d9ce222e3f1 100644 --- a/resource-manager/network/2023-02-01/expressroutecrossconnectionarptable/client.go +++ b/resource-manager/network/2023-02-01/expressroutecrossconnectionarptable/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCrossConnectionArpTableClient struct { Client *resourcemanager.Client } -func NewExpressRouteCrossConnectionArpTableClientWithBaseURI(api environments.Api) (*ExpressRouteCrossConnectionArpTableClient, error) { +func NewExpressRouteCrossConnectionArpTableClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCrossConnectionArpTableClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecrossconnectionarptable", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCrossConnectionArpTableClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecrossconnectionpeerings/client.go b/resource-manager/network/2023-02-01/expressroutecrossconnectionpeerings/client.go index 320a0785b8d..3da491c8f95 100644 --- a/resource-manager/network/2023-02-01/expressroutecrossconnectionpeerings/client.go +++ b/resource-manager/network/2023-02-01/expressroutecrossconnectionpeerings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCrossConnectionPeeringsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCrossConnectionPeeringsClientWithBaseURI(api environments.Api) (*ExpressRouteCrossConnectionPeeringsClient, error) { +func NewExpressRouteCrossConnectionPeeringsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCrossConnectionPeeringsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecrossconnectionpeerings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCrossConnectionPeeringsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecrossconnectionroutetable/client.go b/resource-manager/network/2023-02-01/expressroutecrossconnectionroutetable/client.go index 4437ac75b0d..993654ed031 100644 --- a/resource-manager/network/2023-02-01/expressroutecrossconnectionroutetable/client.go +++ b/resource-manager/network/2023-02-01/expressroutecrossconnectionroutetable/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCrossConnectionRouteTableClient struct { Client *resourcemanager.Client } -func NewExpressRouteCrossConnectionRouteTableClientWithBaseURI(api environments.Api) (*ExpressRouteCrossConnectionRouteTableClient, error) { +func NewExpressRouteCrossConnectionRouteTableClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCrossConnectionRouteTableClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecrossconnectionroutetable", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCrossConnectionRouteTableClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecrossconnectionroutetablesummary/client.go b/resource-manager/network/2023-02-01/expressroutecrossconnectionroutetablesummary/client.go index d9ffe2f386e..d0fe26bb8e3 100644 --- a/resource-manager/network/2023-02-01/expressroutecrossconnectionroutetablesummary/client.go +++ b/resource-manager/network/2023-02-01/expressroutecrossconnectionroutetablesummary/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCrossConnectionRouteTableSummaryClient struct { Client *resourcemanager.Client } -func NewExpressRouteCrossConnectionRouteTableSummaryClientWithBaseURI(api environments.Api) (*ExpressRouteCrossConnectionRouteTableSummaryClient, error) { +func NewExpressRouteCrossConnectionRouteTableSummaryClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCrossConnectionRouteTableSummaryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecrossconnectionroutetablesummary", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCrossConnectionRouteTableSummaryClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutecrossconnections/client.go b/resource-manager/network/2023-02-01/expressroutecrossconnections/client.go index 6c02cfc4b39..bbdf9157b55 100644 --- a/resource-manager/network/2023-02-01/expressroutecrossconnections/client.go +++ b/resource-manager/network/2023-02-01/expressroutecrossconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCrossConnectionsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCrossConnectionsClientWithBaseURI(api environments.Api) (*ExpressRouteCrossConnectionsClient, error) { +func NewExpressRouteCrossConnectionsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCrossConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecrossconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCrossConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutegateways/client.go b/resource-manager/network/2023-02-01/expressroutegateways/client.go index 474f4529b5a..308dc4f777a 100644 --- a/resource-manager/network/2023-02-01/expressroutegateways/client.go +++ b/resource-manager/network/2023-02-01/expressroutegateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteGatewaysClient struct { Client *resourcemanager.Client } -func NewExpressRouteGatewaysClientWithBaseURI(api environments.Api) (*ExpressRouteGatewaysClient, error) { +func NewExpressRouteGatewaysClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutegateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressroutelinks/client.go b/resource-manager/network/2023-02-01/expressroutelinks/client.go index 316b515aeba..7c2242b9273 100644 --- a/resource-manager/network/2023-02-01/expressroutelinks/client.go +++ b/resource-manager/network/2023-02-01/expressroutelinks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteLinksClient struct { Client *resourcemanager.Client } -func NewExpressRouteLinksClientWithBaseURI(api environments.Api) (*ExpressRouteLinksClient, error) { +func NewExpressRouteLinksClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteLinksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutelinks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteLinksClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressrouteportauthorizations/client.go b/resource-manager/network/2023-02-01/expressrouteportauthorizations/client.go index 532d877b9fe..35b23f59857 100644 --- a/resource-manager/network/2023-02-01/expressrouteportauthorizations/client.go +++ b/resource-manager/network/2023-02-01/expressrouteportauthorizations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRoutePortAuthorizationsClient struct { Client *resourcemanager.Client } -func NewExpressRoutePortAuthorizationsClientWithBaseURI(api environments.Api) (*ExpressRoutePortAuthorizationsClient, error) { +func NewExpressRoutePortAuthorizationsClientWithBaseURI(api sdkEnv.Api) (*ExpressRoutePortAuthorizationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteportauthorizations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRoutePortAuthorizationsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressrouteports/client.go b/resource-manager/network/2023-02-01/expressrouteports/client.go index e0be48aade5..edd33580fdf 100644 --- a/resource-manager/network/2023-02-01/expressrouteports/client.go +++ b/resource-manager/network/2023-02-01/expressrouteports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRoutePortsClient struct { Client *resourcemanager.Client } -func NewExpressRoutePortsClientWithBaseURI(api environments.Api) (*ExpressRoutePortsClient, error) { +func NewExpressRoutePortsClientWithBaseURI(api sdkEnv.Api) (*ExpressRoutePortsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRoutePortsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressrouteportslocations/client.go b/resource-manager/network/2023-02-01/expressrouteportslocations/client.go index e57bad8052e..6c930f05fa5 100644 --- a/resource-manager/network/2023-02-01/expressrouteportslocations/client.go +++ b/resource-manager/network/2023-02-01/expressrouteportslocations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRoutePortsLocationsClient struct { Client *resourcemanager.Client } -func NewExpressRoutePortsLocationsClientWithBaseURI(api environments.Api) (*ExpressRoutePortsLocationsClient, error) { +func NewExpressRoutePortsLocationsClientWithBaseURI(api sdkEnv.Api) (*ExpressRoutePortsLocationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteportslocations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRoutePortsLocationsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressrouteproviderports/client.go b/resource-manager/network/2023-02-01/expressrouteproviderports/client.go index 276d5877f63..3b9ac2c870c 100644 --- a/resource-manager/network/2023-02-01/expressrouteproviderports/client.go +++ b/resource-manager/network/2023-02-01/expressrouteproviderports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteProviderPortsClient struct { Client *resourcemanager.Client } -func NewExpressRouteProviderPortsClientWithBaseURI(api environments.Api) (*ExpressRouteProviderPortsClient, error) { +func NewExpressRouteProviderPortsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteProviderPortsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteproviderports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteProviderPortsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/expressrouteserviceproviders/client.go b/resource-manager/network/2023-02-01/expressrouteserviceproviders/client.go index 68ed2324e0d..690b45f48fe 100644 --- a/resource-manager/network/2023-02-01/expressrouteserviceproviders/client.go +++ b/resource-manager/network/2023-02-01/expressrouteserviceproviders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteServiceProvidersClient struct { Client *resourcemanager.Client } -func NewExpressRouteServiceProvidersClientWithBaseURI(api environments.Api) (*ExpressRouteServiceProvidersClient, error) { +func NewExpressRouteServiceProvidersClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteServiceProvidersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteserviceproviders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteServiceProvidersClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/firewallpolicies/client.go b/resource-manager/network/2023-02-01/firewallpolicies/client.go index 791b0949b8c..6821e085a20 100644 --- a/resource-manager/network/2023-02-01/firewallpolicies/client.go +++ b/resource-manager/network/2023-02-01/firewallpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallPoliciesClient struct { Client *resourcemanager.Client } -func NewFirewallPoliciesClientWithBaseURI(api environments.Api) (*FirewallPoliciesClient, error) { +func NewFirewallPoliciesClientWithBaseURI(api sdkEnv.Api) (*FirewallPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallPoliciesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/firewallpolicyrulecollectiongroups/client.go b/resource-manager/network/2023-02-01/firewallpolicyrulecollectiongroups/client.go index 1066038440b..3e78f3041c9 100644 --- a/resource-manager/network/2023-02-01/firewallpolicyrulecollectiongroups/client.go +++ b/resource-manager/network/2023-02-01/firewallpolicyrulecollectiongroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallPolicyRuleCollectionGroupsClient struct { Client *resourcemanager.Client } -func NewFirewallPolicyRuleCollectionGroupsClientWithBaseURI(api environments.Api) (*FirewallPolicyRuleCollectionGroupsClient, error) { +func NewFirewallPolicyRuleCollectionGroupsClientWithBaseURI(api sdkEnv.Api) (*FirewallPolicyRuleCollectionGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallpolicyrulecollectiongroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallPolicyRuleCollectionGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/flowlogs/client.go b/resource-manager/network/2023-02-01/flowlogs/client.go index 51ae4558663..34fce459441 100644 --- a/resource-manager/network/2023-02-01/flowlogs/client.go +++ b/resource-manager/network/2023-02-01/flowlogs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FlowLogsClient struct { Client *resourcemanager.Client } -func NewFlowLogsClientWithBaseURI(api environments.Api) (*FlowLogsClient, error) { +func NewFlowLogsClientWithBaseURI(api sdkEnv.Api) (*FlowLogsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "flowlogs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FlowLogsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/ipallocations/client.go b/resource-manager/network/2023-02-01/ipallocations/client.go index a9a2ce87420..e6099d4dd9b 100644 --- a/resource-manager/network/2023-02-01/ipallocations/client.go +++ b/resource-manager/network/2023-02-01/ipallocations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IPAllocationsClient struct { Client *resourcemanager.Client } -func NewIPAllocationsClientWithBaseURI(api environments.Api) (*IPAllocationsClient, error) { +func NewIPAllocationsClientWithBaseURI(api sdkEnv.Api) (*IPAllocationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ipallocations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IPAllocationsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/ipgroups/client.go b/resource-manager/network/2023-02-01/ipgroups/client.go index 74e63c13a67..de34f7ed9cd 100644 --- a/resource-manager/network/2023-02-01/ipgroups/client.go +++ b/resource-manager/network/2023-02-01/ipgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IPGroupsClient struct { Client *resourcemanager.Client } -func NewIPGroupsClientWithBaseURI(api environments.Api) (*IPGroupsClient, error) { +func NewIPGroupsClientWithBaseURI(api sdkEnv.Api) (*IPGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ipgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IPGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/loadbalancers/client.go b/resource-manager/network/2023-02-01/loadbalancers/client.go index c61a342321c..27563667676 100644 --- a/resource-manager/network/2023-02-01/loadbalancers/client.go +++ b/resource-manager/network/2023-02-01/loadbalancers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LoadBalancersClient struct { Client *resourcemanager.Client } -func NewLoadBalancersClientWithBaseURI(api environments.Api) (*LoadBalancersClient, error) { +func NewLoadBalancersClientWithBaseURI(api sdkEnv.Api) (*LoadBalancersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "loadbalancers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LoadBalancersClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/localnetworkgateways/client.go b/resource-manager/network/2023-02-01/localnetworkgateways/client.go index b52d286c069..39a94814e1e 100644 --- a/resource-manager/network/2023-02-01/localnetworkgateways/client.go +++ b/resource-manager/network/2023-02-01/localnetworkgateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocalNetworkGatewaysClient struct { Client *resourcemanager.Client } -func NewLocalNetworkGatewaysClientWithBaseURI(api environments.Api) (*LocalNetworkGatewaysClient, error) { +func NewLocalNetworkGatewaysClientWithBaseURI(api sdkEnv.Api) (*LocalNetworkGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "localnetworkgateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocalNetworkGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/natgateways/client.go b/resource-manager/network/2023-02-01/natgateways/client.go index 043b69b83b7..baab856035a 100644 --- a/resource-manager/network/2023-02-01/natgateways/client.go +++ b/resource-manager/network/2023-02-01/natgateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NatGatewaysClient struct { Client *resourcemanager.Client } -func NewNatGatewaysClientWithBaseURI(api environments.Api) (*NatGatewaysClient, error) { +func NewNatGatewaysClientWithBaseURI(api sdkEnv.Api) (*NatGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "natgateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NatGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networkgroups/client.go b/resource-manager/network/2023-02-01/networkgroups/client.go index 7c9fe140203..9588e4e2e7a 100644 --- a/resource-manager/network/2023-02-01/networkgroups/client.go +++ b/resource-manager/network/2023-02-01/networkgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkGroupsClient struct { Client *resourcemanager.Client } -func NewNetworkGroupsClientWithBaseURI(api environments.Api) (*NetworkGroupsClient, error) { +func NewNetworkGroupsClientWithBaseURI(api sdkEnv.Api) (*NetworkGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networkinterfaces/client.go b/resource-manager/network/2023-02-01/networkinterfaces/client.go index c0faee67c81..82096d5749b 100644 --- a/resource-manager/network/2023-02-01/networkinterfaces/client.go +++ b/resource-manager/network/2023-02-01/networkinterfaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkInterfacesClient struct { Client *resourcemanager.Client } -func NewNetworkInterfacesClientWithBaseURI(api environments.Api) (*NetworkInterfacesClient, error) { +func NewNetworkInterfacesClientWithBaseURI(api sdkEnv.Api) (*NetworkInterfacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkinterfaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkInterfacesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networkmanageractiveconfigurations/client.go b/resource-manager/network/2023-02-01/networkmanageractiveconfigurations/client.go index 221c88c6510..8ba7b7fb4c2 100644 --- a/resource-manager/network/2023-02-01/networkmanageractiveconfigurations/client.go +++ b/resource-manager/network/2023-02-01/networkmanageractiveconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagerActiveConfigurationsClient struct { Client *resourcemanager.Client } -func NewNetworkManagerActiveConfigurationsClientWithBaseURI(api environments.Api) (*NetworkManagerActiveConfigurationsClient, error) { +func NewNetworkManagerActiveConfigurationsClientWithBaseURI(api sdkEnv.Api) (*NetworkManagerActiveConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanageractiveconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagerActiveConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networkmanageractiveconnectivityconfigurations/client.go b/resource-manager/network/2023-02-01/networkmanageractiveconnectivityconfigurations/client.go index 23ed55c7d15..95b5115b546 100644 --- a/resource-manager/network/2023-02-01/networkmanageractiveconnectivityconfigurations/client.go +++ b/resource-manager/network/2023-02-01/networkmanageractiveconnectivityconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagerActiveConnectivityConfigurationsClient struct { Client *resourcemanager.Client } -func NewNetworkManagerActiveConnectivityConfigurationsClientWithBaseURI(api environments.Api) (*NetworkManagerActiveConnectivityConfigurationsClient, error) { +func NewNetworkManagerActiveConnectivityConfigurationsClientWithBaseURI(api sdkEnv.Api) (*NetworkManagerActiveConnectivityConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanageractiveconnectivityconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagerActiveConnectivityConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networkmanagerconnections/client.go b/resource-manager/network/2023-02-01/networkmanagerconnections/client.go index 6e918e232b8..e056f14d41b 100644 --- a/resource-manager/network/2023-02-01/networkmanagerconnections/client.go +++ b/resource-manager/network/2023-02-01/networkmanagerconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagerConnectionsClient struct { Client *resourcemanager.Client } -func NewNetworkManagerConnectionsClientWithBaseURI(api environments.Api) (*NetworkManagerConnectionsClient, error) { +func NewNetworkManagerConnectionsClientWithBaseURI(api sdkEnv.Api) (*NetworkManagerConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanagerconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagerConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networkmanagereffectiveconnectivityconfiguration/client.go b/resource-manager/network/2023-02-01/networkmanagereffectiveconnectivityconfiguration/client.go index e1cc279732c..4fc00377fb4 100644 --- a/resource-manager/network/2023-02-01/networkmanagereffectiveconnectivityconfiguration/client.go +++ b/resource-manager/network/2023-02-01/networkmanagereffectiveconnectivityconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagerEffectiveConnectivityConfigurationClient struct { Client *resourcemanager.Client } -func NewNetworkManagerEffectiveConnectivityConfigurationClientWithBaseURI(api environments.Api) (*NetworkManagerEffectiveConnectivityConfigurationClient, error) { +func NewNetworkManagerEffectiveConnectivityConfigurationClientWithBaseURI(api sdkEnv.Api) (*NetworkManagerEffectiveConnectivityConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanagereffectiveconnectivityconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagerEffectiveConnectivityConfigurationClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networkmanagereffectivesecurityadminrules/client.go b/resource-manager/network/2023-02-01/networkmanagereffectivesecurityadminrules/client.go index ea0d80cd16d..fa0f9b6242b 100644 --- a/resource-manager/network/2023-02-01/networkmanagereffectivesecurityadminrules/client.go +++ b/resource-manager/network/2023-02-01/networkmanagereffectivesecurityadminrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagerEffectiveSecurityAdminRulesClient struct { Client *resourcemanager.Client } -func NewNetworkManagerEffectiveSecurityAdminRulesClientWithBaseURI(api environments.Api) (*NetworkManagerEffectiveSecurityAdminRulesClient, error) { +func NewNetworkManagerEffectiveSecurityAdminRulesClientWithBaseURI(api sdkEnv.Api) (*NetworkManagerEffectiveSecurityAdminRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanagereffectivesecurityadminrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagerEffectiveSecurityAdminRulesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networkmanagers/client.go b/resource-manager/network/2023-02-01/networkmanagers/client.go index d3cd73d8b1c..fbce4ce936f 100644 --- a/resource-manager/network/2023-02-01/networkmanagers/client.go +++ b/resource-manager/network/2023-02-01/networkmanagers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagersClient struct { Client *resourcemanager.Client } -func NewNetworkManagersClientWithBaseURI(api environments.Api) (*NetworkManagersClient, error) { +func NewNetworkManagersClientWithBaseURI(api sdkEnv.Api) (*NetworkManagersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanagers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagersClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networkprofiles/client.go b/resource-manager/network/2023-02-01/networkprofiles/client.go index c0d65005107..ad7a4890693 100644 --- a/resource-manager/network/2023-02-01/networkprofiles/client.go +++ b/resource-manager/network/2023-02-01/networkprofiles/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkProfilesClient struct { Client *resourcemanager.Client } -func NewNetworkProfilesClientWithBaseURI(api environments.Api) (*NetworkProfilesClient, error) { +func NewNetworkProfilesClientWithBaseURI(api sdkEnv.Api) (*NetworkProfilesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkprofiles", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkProfilesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networksecuritygroups/client.go b/resource-manager/network/2023-02-01/networksecuritygroups/client.go index a297cbae4a7..34116bb47e7 100644 --- a/resource-manager/network/2023-02-01/networksecuritygroups/client.go +++ b/resource-manager/network/2023-02-01/networksecuritygroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkSecurityGroupsClient struct { Client *resourcemanager.Client } -func NewNetworkSecurityGroupsClientWithBaseURI(api environments.Api) (*NetworkSecurityGroupsClient, error) { +func NewNetworkSecurityGroupsClientWithBaseURI(api sdkEnv.Api) (*NetworkSecurityGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networksecuritygroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkSecurityGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networkvirtualappliances/client.go b/resource-manager/network/2023-02-01/networkvirtualappliances/client.go index 78dbf8c120b..e9f7ca45687 100644 --- a/resource-manager/network/2023-02-01/networkvirtualappliances/client.go +++ b/resource-manager/network/2023-02-01/networkvirtualappliances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkVirtualAppliancesClient struct { Client *resourcemanager.Client } -func NewNetworkVirtualAppliancesClientWithBaseURI(api environments.Api) (*NetworkVirtualAppliancesClient, error) { +func NewNetworkVirtualAppliancesClientWithBaseURI(api sdkEnv.Api) (*NetworkVirtualAppliancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkvirtualappliances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkVirtualAppliancesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/networkwatchers/client.go b/resource-manager/network/2023-02-01/networkwatchers/client.go index d0f44155ba5..331d904fb90 100644 --- a/resource-manager/network/2023-02-01/networkwatchers/client.go +++ b/resource-manager/network/2023-02-01/networkwatchers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkWatchersClient struct { Client *resourcemanager.Client } -func NewNetworkWatchersClientWithBaseURI(api environments.Api) (*NetworkWatchersClient, error) { +func NewNetworkWatchersClientWithBaseURI(api sdkEnv.Api) (*NetworkWatchersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkwatchers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkWatchersClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/p2svpngateways/client.go b/resource-manager/network/2023-02-01/p2svpngateways/client.go index 893958568c2..d669d17929a 100644 --- a/resource-manager/network/2023-02-01/p2svpngateways/client.go +++ b/resource-manager/network/2023-02-01/p2svpngateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type P2sVpnGatewaysClient struct { Client *resourcemanager.Client } -func NewP2sVpnGatewaysClientWithBaseURI(api environments.Api) (*P2sVpnGatewaysClient, error) { +func NewP2sVpnGatewaysClientWithBaseURI(api sdkEnv.Api) (*P2sVpnGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "p2svpngateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating P2sVpnGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/packetcaptures/client.go b/resource-manager/network/2023-02-01/packetcaptures/client.go index 0a4a3398869..5367931aba6 100644 --- a/resource-manager/network/2023-02-01/packetcaptures/client.go +++ b/resource-manager/network/2023-02-01/packetcaptures/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCapturesClient struct { Client *resourcemanager.Client } -func NewPacketCapturesClientWithBaseURI(api environments.Api) (*PacketCapturesClient, error) { +func NewPacketCapturesClientWithBaseURI(api sdkEnv.Api) (*PacketCapturesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcaptures", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCapturesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/peerexpressroutecircuitconnections/client.go b/resource-manager/network/2023-02-01/peerexpressroutecircuitconnections/client.go index c153e5d3b4a..a204a19106c 100644 --- a/resource-manager/network/2023-02-01/peerexpressroutecircuitconnections/client.go +++ b/resource-manager/network/2023-02-01/peerexpressroutecircuitconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PeerExpressRouteCircuitConnectionsClient struct { Client *resourcemanager.Client } -func NewPeerExpressRouteCircuitConnectionsClientWithBaseURI(api environments.Api) (*PeerExpressRouteCircuitConnectionsClient, error) { +func NewPeerExpressRouteCircuitConnectionsClientWithBaseURI(api sdkEnv.Api) (*PeerExpressRouteCircuitConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "peerexpressroutecircuitconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PeerExpressRouteCircuitConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/privatednszonegroups/client.go b/resource-manager/network/2023-02-01/privatednszonegroups/client.go index 872a0ea57cd..b5fe0d3134a 100644 --- a/resource-manager/network/2023-02-01/privatednszonegroups/client.go +++ b/resource-manager/network/2023-02-01/privatednszonegroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateDnsZoneGroupsClient struct { Client *resourcemanager.Client } -func NewPrivateDnsZoneGroupsClientWithBaseURI(api environments.Api) (*PrivateDnsZoneGroupsClient, error) { +func NewPrivateDnsZoneGroupsClientWithBaseURI(api sdkEnv.Api) (*PrivateDnsZoneGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatednszonegroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateDnsZoneGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/privateendpoints/client.go b/resource-manager/network/2023-02-01/privateendpoints/client.go index 8ef83ec0060..8300f305f02 100644 --- a/resource-manager/network/2023-02-01/privateendpoints/client.go +++ b/resource-manager/network/2023-02-01/privateendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointsClientWithBaseURI(api environments.Api) (*PrivateEndpointsClient, error) { +func NewPrivateEndpointsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/privatelinkservice/client.go b/resource-manager/network/2023-02-01/privatelinkservice/client.go index b2b1cce0fce..427397e995d 100644 --- a/resource-manager/network/2023-02-01/privatelinkservice/client.go +++ b/resource-manager/network/2023-02-01/privatelinkservice/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkServiceClient struct { Client *resourcemanager.Client } -func NewPrivateLinkServiceClientWithBaseURI(api environments.Api) (*PrivateLinkServiceClient, error) { +func NewPrivateLinkServiceClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkServiceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkservice", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkServiceClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/privatelinkservices/client.go b/resource-manager/network/2023-02-01/privatelinkservices/client.go index ef379b0edb5..3707d0cc162 100644 --- a/resource-manager/network/2023-02-01/privatelinkservices/client.go +++ b/resource-manager/network/2023-02-01/privatelinkservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkServicesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkServicesClientWithBaseURI(api environments.Api) (*PrivateLinkServicesClient, error) { +func NewPrivateLinkServicesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkServicesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/publicipaddresses/client.go b/resource-manager/network/2023-02-01/publicipaddresses/client.go index 58a629943e3..e1bc3d5e86e 100644 --- a/resource-manager/network/2023-02-01/publicipaddresses/client.go +++ b/resource-manager/network/2023-02-01/publicipaddresses/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PublicIPAddressesClient struct { Client *resourcemanager.Client } -func NewPublicIPAddressesClientWithBaseURI(api environments.Api) (*PublicIPAddressesClient, error) { +func NewPublicIPAddressesClientWithBaseURI(api sdkEnv.Api) (*PublicIPAddressesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "publicipaddresses", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PublicIPAddressesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/publicipprefixes/client.go b/resource-manager/network/2023-02-01/publicipprefixes/client.go index 9a1637fc3ce..8f8c8241331 100644 --- a/resource-manager/network/2023-02-01/publicipprefixes/client.go +++ b/resource-manager/network/2023-02-01/publicipprefixes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PublicIPPrefixesClient struct { Client *resourcemanager.Client } -func NewPublicIPPrefixesClientWithBaseURI(api environments.Api) (*PublicIPPrefixesClient, error) { +func NewPublicIPPrefixesClientWithBaseURI(api sdkEnv.Api) (*PublicIPPrefixesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "publicipprefixes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PublicIPPrefixesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/routefilterrules/client.go b/resource-manager/network/2023-02-01/routefilterrules/client.go index 44483c23138..26f9695593a 100644 --- a/resource-manager/network/2023-02-01/routefilterrules/client.go +++ b/resource-manager/network/2023-02-01/routefilterrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RouteFilterRulesClient struct { Client *resourcemanager.Client } -func NewRouteFilterRulesClientWithBaseURI(api environments.Api) (*RouteFilterRulesClient, error) { +func NewRouteFilterRulesClientWithBaseURI(api sdkEnv.Api) (*RouteFilterRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "routefilterrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RouteFilterRulesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/routefilters/client.go b/resource-manager/network/2023-02-01/routefilters/client.go index e233141d003..45bd1d7d099 100644 --- a/resource-manager/network/2023-02-01/routefilters/client.go +++ b/resource-manager/network/2023-02-01/routefilters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RouteFiltersClient struct { Client *resourcemanager.Client } -func NewRouteFiltersClientWithBaseURI(api environments.Api) (*RouteFiltersClient, error) { +func NewRouteFiltersClientWithBaseURI(api sdkEnv.Api) (*RouteFiltersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "routefilters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RouteFiltersClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/routes/client.go b/resource-manager/network/2023-02-01/routes/client.go index d82a569dd0e..357e0d15dac 100644 --- a/resource-manager/network/2023-02-01/routes/client.go +++ b/resource-manager/network/2023-02-01/routes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoutesClient struct { Client *resourcemanager.Client } -func NewRoutesClientWithBaseURI(api environments.Api) (*RoutesClient, error) { +func NewRoutesClientWithBaseURI(api sdkEnv.Api) (*RoutesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "routes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoutesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/routetables/client.go b/resource-manager/network/2023-02-01/routetables/client.go index 98894d48e67..4b013bcb471 100644 --- a/resource-manager/network/2023-02-01/routetables/client.go +++ b/resource-manager/network/2023-02-01/routetables/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RouteTablesClient struct { Client *resourcemanager.Client } -func NewRouteTablesClientWithBaseURI(api environments.Api) (*RouteTablesClient, error) { +func NewRouteTablesClientWithBaseURI(api sdkEnv.Api) (*RouteTablesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "routetables", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RouteTablesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/scopeconnections/client.go b/resource-manager/network/2023-02-01/scopeconnections/client.go index 65a0f58dd04..89ced27c443 100644 --- a/resource-manager/network/2023-02-01/scopeconnections/client.go +++ b/resource-manager/network/2023-02-01/scopeconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScopeConnectionsClient struct { Client *resourcemanager.Client } -func NewScopeConnectionsClientWithBaseURI(api environments.Api) (*ScopeConnectionsClient, error) { +func NewScopeConnectionsClientWithBaseURI(api sdkEnv.Api) (*ScopeConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scopeconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScopeConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/securityadminconfigurations/client.go b/resource-manager/network/2023-02-01/securityadminconfigurations/client.go index 4462d9db2c9..6e5471ef2ec 100644 --- a/resource-manager/network/2023-02-01/securityadminconfigurations/client.go +++ b/resource-manager/network/2023-02-01/securityadminconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SecurityAdminConfigurationsClient struct { Client *resourcemanager.Client } -func NewSecurityAdminConfigurationsClientWithBaseURI(api environments.Api) (*SecurityAdminConfigurationsClient, error) { +func NewSecurityAdminConfigurationsClientWithBaseURI(api sdkEnv.Api) (*SecurityAdminConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "securityadminconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SecurityAdminConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/securitypartnerproviders/client.go b/resource-manager/network/2023-02-01/securitypartnerproviders/client.go index 8e43fdacd61..99c5c85cab5 100644 --- a/resource-manager/network/2023-02-01/securitypartnerproviders/client.go +++ b/resource-manager/network/2023-02-01/securitypartnerproviders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SecurityPartnerProvidersClient struct { Client *resourcemanager.Client } -func NewSecurityPartnerProvidersClientWithBaseURI(api environments.Api) (*SecurityPartnerProvidersClient, error) { +func NewSecurityPartnerProvidersClientWithBaseURI(api sdkEnv.Api) (*SecurityPartnerProvidersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "securitypartnerproviders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SecurityPartnerProvidersClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/securityrules/client.go b/resource-manager/network/2023-02-01/securityrules/client.go index a386b6c0dec..569786c9a6d 100644 --- a/resource-manager/network/2023-02-01/securityrules/client.go +++ b/resource-manager/network/2023-02-01/securityrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SecurityRulesClient struct { Client *resourcemanager.Client } -func NewSecurityRulesClientWithBaseURI(api environments.Api) (*SecurityRulesClient, error) { +func NewSecurityRulesClientWithBaseURI(api sdkEnv.Api) (*SecurityRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "securityrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SecurityRulesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/serviceendpointpolicies/client.go b/resource-manager/network/2023-02-01/serviceendpointpolicies/client.go index aa0cce53c77..0443b85f684 100644 --- a/resource-manager/network/2023-02-01/serviceendpointpolicies/client.go +++ b/resource-manager/network/2023-02-01/serviceendpointpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServiceEndpointPoliciesClient struct { Client *resourcemanager.Client } -func NewServiceEndpointPoliciesClientWithBaseURI(api environments.Api) (*ServiceEndpointPoliciesClient, error) { +func NewServiceEndpointPoliciesClientWithBaseURI(api sdkEnv.Api) (*ServiceEndpointPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serviceendpointpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServiceEndpointPoliciesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/serviceendpointpolicydefinitions/client.go b/resource-manager/network/2023-02-01/serviceendpointpolicydefinitions/client.go index 255a599b606..3bd79658a66 100644 --- a/resource-manager/network/2023-02-01/serviceendpointpolicydefinitions/client.go +++ b/resource-manager/network/2023-02-01/serviceendpointpolicydefinitions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServiceEndpointPolicyDefinitionsClient struct { Client *resourcemanager.Client } -func NewServiceEndpointPolicyDefinitionsClientWithBaseURI(api environments.Api) (*ServiceEndpointPolicyDefinitionsClient, error) { +func NewServiceEndpointPolicyDefinitionsClientWithBaseURI(api sdkEnv.Api) (*ServiceEndpointPolicyDefinitionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serviceendpointpolicydefinitions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServiceEndpointPolicyDefinitionsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/servicetags/client.go b/resource-manager/network/2023-02-01/servicetags/client.go index 6ce184db9bc..a225a424ac3 100644 --- a/resource-manager/network/2023-02-01/servicetags/client.go +++ b/resource-manager/network/2023-02-01/servicetags/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServiceTagsClient struct { Client *resourcemanager.Client } -func NewServiceTagsClientWithBaseURI(api environments.Api) (*ServiceTagsClient, error) { +func NewServiceTagsClientWithBaseURI(api sdkEnv.Api) (*ServiceTagsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servicetags", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServiceTagsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/staticmembers/client.go b/resource-manager/network/2023-02-01/staticmembers/client.go index bc0383f9c3c..4b864eb3ccb 100644 --- a/resource-manager/network/2023-02-01/staticmembers/client.go +++ b/resource-manager/network/2023-02-01/staticmembers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StaticMembersClient struct { Client *resourcemanager.Client } -func NewStaticMembersClientWithBaseURI(api environments.Api) (*StaticMembersClient, error) { +func NewStaticMembersClientWithBaseURI(api sdkEnv.Api) (*StaticMembersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "staticmembers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StaticMembersClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/subnets/client.go b/resource-manager/network/2023-02-01/subnets/client.go index 3efe55fa485..32af290d090 100644 --- a/resource-manager/network/2023-02-01/subnets/client.go +++ b/resource-manager/network/2023-02-01/subnets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SubnetsClient struct { Client *resourcemanager.Client } -func NewSubnetsClientWithBaseURI(api environments.Api) (*SubnetsClient, error) { +func NewSubnetsClientWithBaseURI(api sdkEnv.Api) (*SubnetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "subnets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SubnetsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/trafficanalytics/client.go b/resource-manager/network/2023-02-01/trafficanalytics/client.go index 3dd5fd4cf96..a316e21d1fc 100644 --- a/resource-manager/network/2023-02-01/trafficanalytics/client.go +++ b/resource-manager/network/2023-02-01/trafficanalytics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TrafficAnalyticsClient struct { Client *resourcemanager.Client } -func NewTrafficAnalyticsClientWithBaseURI(api environments.Api) (*TrafficAnalyticsClient, error) { +func NewTrafficAnalyticsClientWithBaseURI(api sdkEnv.Api) (*TrafficAnalyticsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "trafficanalytics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TrafficAnalyticsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/usages/client.go b/resource-manager/network/2023-02-01/usages/client.go index 99b2625224d..9319b1a1f51 100644 --- a/resource-manager/network/2023-02-01/usages/client.go +++ b/resource-manager/network/2023-02-01/usages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsagesClient struct { Client *resourcemanager.Client } -func NewUsagesClientWithBaseURI(api environments.Api) (*UsagesClient, error) { +func NewUsagesClientWithBaseURI(api sdkEnv.Api) (*UsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsagesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/vipswap/client.go b/resource-manager/network/2023-02-01/vipswap/client.go index 1f634dd13c3..3d9df26fde2 100644 --- a/resource-manager/network/2023-02-01/vipswap/client.go +++ b/resource-manager/network/2023-02-01/vipswap/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VipSwapClient struct { Client *resourcemanager.Client } -func NewVipSwapClientWithBaseURI(api environments.Api) (*VipSwapClient, error) { +func NewVipSwapClientWithBaseURI(api sdkEnv.Api) (*VipSwapClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vipswap", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VipSwapClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/virtualappliancesites/client.go b/resource-manager/network/2023-02-01/virtualappliancesites/client.go index 32de5368a81..ffac4b46d23 100644 --- a/resource-manager/network/2023-02-01/virtualappliancesites/client.go +++ b/resource-manager/network/2023-02-01/virtualappliancesites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualApplianceSitesClient struct { Client *resourcemanager.Client } -func NewVirtualApplianceSitesClientWithBaseURI(api environments.Api) (*VirtualApplianceSitesClient, error) { +func NewVirtualApplianceSitesClientWithBaseURI(api sdkEnv.Api) (*VirtualApplianceSitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualappliancesites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualApplianceSitesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/virtualapplianceskus/client.go b/resource-manager/network/2023-02-01/virtualapplianceskus/client.go index 63ec1eff1ea..b7e8336339e 100644 --- a/resource-manager/network/2023-02-01/virtualapplianceskus/client.go +++ b/resource-manager/network/2023-02-01/virtualapplianceskus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualApplianceSkusClient struct { Client *resourcemanager.Client } -func NewVirtualApplianceSkusClientWithBaseURI(api environments.Api) (*VirtualApplianceSkusClient, error) { +func NewVirtualApplianceSkusClientWithBaseURI(api sdkEnv.Api) (*VirtualApplianceSkusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualapplianceskus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualApplianceSkusClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/virtualnetworkgatewayconnections/client.go b/resource-manager/network/2023-02-01/virtualnetworkgatewayconnections/client.go index a2b5610883b..9c308e2a95d 100644 --- a/resource-manager/network/2023-02-01/virtualnetworkgatewayconnections/client.go +++ b/resource-manager/network/2023-02-01/virtualnetworkgatewayconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkGatewayConnectionsClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(api environments.Api) (*VirtualNetworkGatewayConnectionsClient, error) { +func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkGatewayConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworkgatewayconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkGatewayConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/virtualnetworkgateways/client.go b/resource-manager/network/2023-02-01/virtualnetworkgateways/client.go index c99ea430c0a..b63032cff60 100644 --- a/resource-manager/network/2023-02-01/virtualnetworkgateways/client.go +++ b/resource-manager/network/2023-02-01/virtualnetworkgateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkGatewaysClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkGatewaysClientWithBaseURI(api environments.Api) (*VirtualNetworkGatewaysClient, error) { +func NewVirtualNetworkGatewaysClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworkgateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/virtualnetworkpeerings/client.go b/resource-manager/network/2023-02-01/virtualnetworkpeerings/client.go index becd896b345..87afc671995 100644 --- a/resource-manager/network/2023-02-01/virtualnetworkpeerings/client.go +++ b/resource-manager/network/2023-02-01/virtualnetworkpeerings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkPeeringsClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkPeeringsClientWithBaseURI(api environments.Api) (*VirtualNetworkPeeringsClient, error) { +func NewVirtualNetworkPeeringsClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkPeeringsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworkpeerings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkPeeringsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/virtualnetworks/client.go b/resource-manager/network/2023-02-01/virtualnetworks/client.go index c274c9c87de..5c9e7698630 100644 --- a/resource-manager/network/2023-02-01/virtualnetworks/client.go +++ b/resource-manager/network/2023-02-01/virtualnetworks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworksClient struct { Client *resourcemanager.Client } -func NewVirtualNetworksClientWithBaseURI(api environments.Api) (*VirtualNetworksClient, error) { +func NewVirtualNetworksClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworksClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/virtualnetworktap/client.go b/resource-manager/network/2023-02-01/virtualnetworktap/client.go index ed44f57de37..124497a5075 100644 --- a/resource-manager/network/2023-02-01/virtualnetworktap/client.go +++ b/resource-manager/network/2023-02-01/virtualnetworktap/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkTapClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkTapClientWithBaseURI(api environments.Api) (*VirtualNetworkTapClient, error) { +func NewVirtualNetworkTapClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkTapClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworktap", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkTapClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/virtualnetworktaps/client.go b/resource-manager/network/2023-02-01/virtualnetworktaps/client.go index ef1af892cdc..674f3e8401f 100644 --- a/resource-manager/network/2023-02-01/virtualnetworktaps/client.go +++ b/resource-manager/network/2023-02-01/virtualnetworktaps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkTapsClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkTapsClientWithBaseURI(api environments.Api) (*VirtualNetworkTapsClient, error) { +func NewVirtualNetworkTapsClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkTapsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworktaps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkTapsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/virtualrouterpeerings/client.go b/resource-manager/network/2023-02-01/virtualrouterpeerings/client.go index 06dbd163078..3ffff04a284 100644 --- a/resource-manager/network/2023-02-01/virtualrouterpeerings/client.go +++ b/resource-manager/network/2023-02-01/virtualrouterpeerings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualRouterPeeringsClient struct { Client *resourcemanager.Client } -func NewVirtualRouterPeeringsClientWithBaseURI(api environments.Api) (*VirtualRouterPeeringsClient, error) { +func NewVirtualRouterPeeringsClientWithBaseURI(api sdkEnv.Api) (*VirtualRouterPeeringsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualrouterpeerings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualRouterPeeringsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/virtualrouters/client.go b/resource-manager/network/2023-02-01/virtualrouters/client.go index 0c0a8fa4887..c7474c28200 100644 --- a/resource-manager/network/2023-02-01/virtualrouters/client.go +++ b/resource-manager/network/2023-02-01/virtualrouters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualRoutersClient struct { Client *resourcemanager.Client } -func NewVirtualRoutersClientWithBaseURI(api environments.Api) (*VirtualRoutersClient, error) { +func NewVirtualRoutersClientWithBaseURI(api sdkEnv.Api) (*VirtualRoutersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualrouters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualRoutersClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/virtualwans/client.go b/resource-manager/network/2023-02-01/virtualwans/client.go index ae4ecc81d13..b91e1d00910 100644 --- a/resource-manager/network/2023-02-01/virtualwans/client.go +++ b/resource-manager/network/2023-02-01/virtualwans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualWANsClient struct { Client *resourcemanager.Client } -func NewVirtualWANsClientWithBaseURI(api environments.Api) (*VirtualWANsClient, error) { +func NewVirtualWANsClientWithBaseURI(api sdkEnv.Api) (*VirtualWANsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualwans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualWANsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/vmsspublicipaddresses/client.go b/resource-manager/network/2023-02-01/vmsspublicipaddresses/client.go index f563b8df586..8030bbc3083 100644 --- a/resource-manager/network/2023-02-01/vmsspublicipaddresses/client.go +++ b/resource-manager/network/2023-02-01/vmsspublicipaddresses/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VMSSPublicIPAddressesClient struct { Client *resourcemanager.Client } -func NewVMSSPublicIPAddressesClientWithBaseURI(api environments.Api) (*VMSSPublicIPAddressesClient, error) { +func NewVMSSPublicIPAddressesClientWithBaseURI(api sdkEnv.Api) (*VMSSPublicIPAddressesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vmsspublicipaddresses", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VMSSPublicIPAddressesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/vpngateways/client.go b/resource-manager/network/2023-02-01/vpngateways/client.go index 08ab0ce47db..21565c92be3 100644 --- a/resource-manager/network/2023-02-01/vpngateways/client.go +++ b/resource-manager/network/2023-02-01/vpngateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VpnGatewaysClient struct { Client *resourcemanager.Client } -func NewVpnGatewaysClientWithBaseURI(api environments.Api) (*VpnGatewaysClient, error) { +func NewVpnGatewaysClientWithBaseURI(api sdkEnv.Api) (*VpnGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vpngateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VpnGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/vpnlinkconnections/client.go b/resource-manager/network/2023-02-01/vpnlinkconnections/client.go index d5db633fa84..63cc8936312 100644 --- a/resource-manager/network/2023-02-01/vpnlinkconnections/client.go +++ b/resource-manager/network/2023-02-01/vpnlinkconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VpnLinkConnectionsClient struct { Client *resourcemanager.Client } -func NewVpnLinkConnectionsClientWithBaseURI(api environments.Api) (*VpnLinkConnectionsClient, error) { +func NewVpnLinkConnectionsClientWithBaseURI(api sdkEnv.Api) (*VpnLinkConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vpnlinkconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VpnLinkConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/vpnserverconfigurations/client.go b/resource-manager/network/2023-02-01/vpnserverconfigurations/client.go index 722cdb26573..eecdd36d98c 100644 --- a/resource-manager/network/2023-02-01/vpnserverconfigurations/client.go +++ b/resource-manager/network/2023-02-01/vpnserverconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VpnServerConfigurationsClient struct { Client *resourcemanager.Client } -func NewVpnServerConfigurationsClientWithBaseURI(api environments.Api) (*VpnServerConfigurationsClient, error) { +func NewVpnServerConfigurationsClientWithBaseURI(api sdkEnv.Api) (*VpnServerConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vpnserverconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VpnServerConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/vpnsites/client.go b/resource-manager/network/2023-02-01/vpnsites/client.go index d5f3209b45d..377e00d651b 100644 --- a/resource-manager/network/2023-02-01/vpnsites/client.go +++ b/resource-manager/network/2023-02-01/vpnsites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VpnSitesClient struct { Client *resourcemanager.Client } -func NewVpnSitesClientWithBaseURI(api environments.Api) (*VpnSitesClient, error) { +func NewVpnSitesClientWithBaseURI(api sdkEnv.Api) (*VpnSitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vpnsites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VpnSitesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/webapplicationfirewallpolicies/client.go b/resource-manager/network/2023-02-01/webapplicationfirewallpolicies/client.go index 10b02bcdf85..7bf4ccb52fa 100644 --- a/resource-manager/network/2023-02-01/webapplicationfirewallpolicies/client.go +++ b/resource-manager/network/2023-02-01/webapplicationfirewallpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WebApplicationFirewallPoliciesClient struct { Client *resourcemanager.Client } -func NewWebApplicationFirewallPoliciesClientWithBaseURI(api environments.Api) (*WebApplicationFirewallPoliciesClient, error) { +func NewWebApplicationFirewallPoliciesClientWithBaseURI(api sdkEnv.Api) (*WebApplicationFirewallPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "webapplicationfirewallpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WebApplicationFirewallPoliciesClient: %+v", err) diff --git a/resource-manager/network/2023-02-01/webcategories/client.go b/resource-manager/network/2023-02-01/webcategories/client.go index 7d213fbca46..69ffe2d802c 100644 --- a/resource-manager/network/2023-02-01/webcategories/client.go +++ b/resource-manager/network/2023-02-01/webcategories/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WebCategoriesClient struct { Client *resourcemanager.Client } -func NewWebCategoriesClientWithBaseURI(api environments.Api) (*WebCategoriesClient, error) { +func NewWebCategoriesClientWithBaseURI(api sdkEnv.Api) (*WebCategoriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "webcategories", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WebCategoriesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/adminrulecollections/client.go b/resource-manager/network/2023-04-01/adminrulecollections/client.go index 8178e8ff455..2eaead35494 100644 --- a/resource-manager/network/2023-04-01/adminrulecollections/client.go +++ b/resource-manager/network/2023-04-01/adminrulecollections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AdminRuleCollectionsClient struct { Client *resourcemanager.Client } -func NewAdminRuleCollectionsClientWithBaseURI(api environments.Api) (*AdminRuleCollectionsClient, error) { +func NewAdminRuleCollectionsClientWithBaseURI(api sdkEnv.Api) (*AdminRuleCollectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "adminrulecollections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AdminRuleCollectionsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/adminrules/client.go b/resource-manager/network/2023-04-01/adminrules/client.go index 30ee4dc30a9..13ae830ab34 100644 --- a/resource-manager/network/2023-04-01/adminrules/client.go +++ b/resource-manager/network/2023-04-01/adminrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AdminRulesClient struct { Client *resourcemanager.Client } -func NewAdminRulesClientWithBaseURI(api environments.Api) (*AdminRulesClient, error) { +func NewAdminRulesClientWithBaseURI(api sdkEnv.Api) (*AdminRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "adminrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AdminRulesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/client.go b/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/client.go index 82e12c872f2..ea44eb9d433 100644 --- a/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/client.go +++ b/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGatewayPrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewApplicationGatewayPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*ApplicationGatewayPrivateEndpointConnectionsClient, error) { +func NewApplicationGatewayPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*ApplicationGatewayPrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgatewayprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGatewayPrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/applicationgatewayprivatelinkresources/client.go b/resource-manager/network/2023-04-01/applicationgatewayprivatelinkresources/client.go index 6e8b9365411..6af36474e36 100644 --- a/resource-manager/network/2023-04-01/applicationgatewayprivatelinkresources/client.go +++ b/resource-manager/network/2023-04-01/applicationgatewayprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGatewayPrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewApplicationGatewayPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*ApplicationGatewayPrivateLinkResourcesClient, error) { +func NewApplicationGatewayPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*ApplicationGatewayPrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgatewayprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGatewayPrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/applicationgateways/client.go b/resource-manager/network/2023-04-01/applicationgateways/client.go index eeadef05934..3d86579afb8 100644 --- a/resource-manager/network/2023-04-01/applicationgateways/client.go +++ b/resource-manager/network/2023-04-01/applicationgateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGatewaysClient struct { Client *resourcemanager.Client } -func NewApplicationGatewaysClientWithBaseURI(api environments.Api) (*ApplicationGatewaysClient, error) { +func NewApplicationGatewaysClientWithBaseURI(api sdkEnv.Api) (*ApplicationGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/applicationgatewaywafdynamicmanifests/client.go b/resource-manager/network/2023-04-01/applicationgatewaywafdynamicmanifests/client.go index 9f40236f2da..42a068f3a9e 100644 --- a/resource-manager/network/2023-04-01/applicationgatewaywafdynamicmanifests/client.go +++ b/resource-manager/network/2023-04-01/applicationgatewaywafdynamicmanifests/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationGatewayWafDynamicManifestsClient struct { Client *resourcemanager.Client } -func NewApplicationGatewayWafDynamicManifestsClientWithBaseURI(api environments.Api) (*ApplicationGatewayWafDynamicManifestsClient, error) { +func NewApplicationGatewayWafDynamicManifestsClientWithBaseURI(api sdkEnv.Api) (*ApplicationGatewayWafDynamicManifestsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationgatewaywafdynamicmanifests", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationGatewayWafDynamicManifestsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/applicationsecuritygroups/client.go b/resource-manager/network/2023-04-01/applicationsecuritygroups/client.go index dd9e39290e5..7ca3740cb77 100644 --- a/resource-manager/network/2023-04-01/applicationsecuritygroups/client.go +++ b/resource-manager/network/2023-04-01/applicationsecuritygroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ApplicationSecurityGroupsClient struct { Client *resourcemanager.Client } -func NewApplicationSecurityGroupsClientWithBaseURI(api environments.Api) (*ApplicationSecurityGroupsClient, error) { +func NewApplicationSecurityGroupsClientWithBaseURI(api sdkEnv.Api) (*ApplicationSecurityGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "applicationsecuritygroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ApplicationSecurityGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/availabledelegations/client.go b/resource-manager/network/2023-04-01/availabledelegations/client.go index 89733dd49b8..be6635afe98 100644 --- a/resource-manager/network/2023-04-01/availabledelegations/client.go +++ b/resource-manager/network/2023-04-01/availabledelegations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AvailableDelegationsClient struct { Client *resourcemanager.Client } -func NewAvailableDelegationsClientWithBaseURI(api environments.Api) (*AvailableDelegationsClient, error) { +func NewAvailableDelegationsClientWithBaseURI(api sdkEnv.Api) (*AvailableDelegationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "availabledelegations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AvailableDelegationsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/availableservicealiases/client.go b/resource-manager/network/2023-04-01/availableservicealiases/client.go index d4e19363f94..3ed32820b32 100644 --- a/resource-manager/network/2023-04-01/availableservicealiases/client.go +++ b/resource-manager/network/2023-04-01/availableservicealiases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AvailableServiceAliasesClient struct { Client *resourcemanager.Client } -func NewAvailableServiceAliasesClientWithBaseURI(api environments.Api) (*AvailableServiceAliasesClient, error) { +func NewAvailableServiceAliasesClientWithBaseURI(api sdkEnv.Api) (*AvailableServiceAliasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "availableservicealiases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AvailableServiceAliasesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/azurefirewalls/client.go b/resource-manager/network/2023-04-01/azurefirewalls/client.go index 3ea45e69959..3eca5e45e21 100644 --- a/resource-manager/network/2023-04-01/azurefirewalls/client.go +++ b/resource-manager/network/2023-04-01/azurefirewalls/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureFirewallsClient struct { Client *resourcemanager.Client } -func NewAzureFirewallsClientWithBaseURI(api environments.Api) (*AzureFirewallsClient, error) { +func NewAzureFirewallsClientWithBaseURI(api sdkEnv.Api) (*AzureFirewallsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azurefirewalls", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureFirewallsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/bastionhosts/client.go b/resource-manager/network/2023-04-01/bastionhosts/client.go index 1cea8c22bf7..0f13e81c2cb 100644 --- a/resource-manager/network/2023-04-01/bastionhosts/client.go +++ b/resource-manager/network/2023-04-01/bastionhosts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BastionHostsClient struct { Client *resourcemanager.Client } -func NewBastionHostsClientWithBaseURI(api environments.Api) (*BastionHostsClient, error) { +func NewBastionHostsClientWithBaseURI(api sdkEnv.Api) (*BastionHostsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "bastionhosts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BastionHostsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/bastionshareablelink/client.go b/resource-manager/network/2023-04-01/bastionshareablelink/client.go index 6a702fa865f..27248e64437 100644 --- a/resource-manager/network/2023-04-01/bastionshareablelink/client.go +++ b/resource-manager/network/2023-04-01/bastionshareablelink/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BastionShareableLinkClient struct { Client *resourcemanager.Client } -func NewBastionShareableLinkClientWithBaseURI(api environments.Api) (*BastionShareableLinkClient, error) { +func NewBastionShareableLinkClientWithBaseURI(api sdkEnv.Api) (*BastionShareableLinkClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "bastionshareablelink", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BastionShareableLinkClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/bgpservicecommunities/client.go b/resource-manager/network/2023-04-01/bgpservicecommunities/client.go index 8b4af98886b..8c24a379ec2 100644 --- a/resource-manager/network/2023-04-01/bgpservicecommunities/client.go +++ b/resource-manager/network/2023-04-01/bgpservicecommunities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BgpServiceCommunitiesClient struct { Client *resourcemanager.Client } -func NewBgpServiceCommunitiesClientWithBaseURI(api environments.Api) (*BgpServiceCommunitiesClient, error) { +func NewBgpServiceCommunitiesClientWithBaseURI(api sdkEnv.Api) (*BgpServiceCommunitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "bgpservicecommunities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BgpServiceCommunitiesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/checkdnsavailabilities/client.go b/resource-manager/network/2023-04-01/checkdnsavailabilities/client.go index 9e9e5e81b3f..d07849ac4ac 100644 --- a/resource-manager/network/2023-04-01/checkdnsavailabilities/client.go +++ b/resource-manager/network/2023-04-01/checkdnsavailabilities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CheckDnsAvailabilitiesClient struct { Client *resourcemanager.Client } -func NewCheckDnsAvailabilitiesClientWithBaseURI(api environments.Api) (*CheckDnsAvailabilitiesClient, error) { +func NewCheckDnsAvailabilitiesClientWithBaseURI(api sdkEnv.Api) (*CheckDnsAvailabilitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "checkdnsavailabilities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CheckDnsAvailabilitiesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/client.go b/resource-manager/network/2023-04-01/client.go index 7a0466e83cf..2665b910615 100644 --- a/resource-manager/network/2023-04-01/client.go +++ b/resource-manager/network/2023-04-01/client.go @@ -114,7 +114,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-04-01/webapplicationfirewallpolicies" "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-04-01/webcategories" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -227,7 +227,7 @@ type Client struct { WebCategories *webcategories.WebCategoriesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { adminRuleCollectionsClient, err := adminrulecollections.NewAdminRuleCollectionsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AdminRuleCollections client: %+v", err) diff --git a/resource-manager/network/2023-04-01/cloudservicepublicipaddresses/client.go b/resource-manager/network/2023-04-01/cloudservicepublicipaddresses/client.go index 621129e8737..04c184c000c 100644 --- a/resource-manager/network/2023-04-01/cloudservicepublicipaddresses/client.go +++ b/resource-manager/network/2023-04-01/cloudservicepublicipaddresses/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CloudServicePublicIPAddressesClient struct { Client *resourcemanager.Client } -func NewCloudServicePublicIPAddressesClientWithBaseURI(api environments.Api) (*CloudServicePublicIPAddressesClient, error) { +func NewCloudServicePublicIPAddressesClientWithBaseURI(api sdkEnv.Api) (*CloudServicePublicIPAddressesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "cloudservicepublicipaddresses", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CloudServicePublicIPAddressesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/connectionmonitors/client.go b/resource-manager/network/2023-04-01/connectionmonitors/client.go index 75b9acef7e8..29a35eb9a26 100644 --- a/resource-manager/network/2023-04-01/connectionmonitors/client.go +++ b/resource-manager/network/2023-04-01/connectionmonitors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConnectionMonitorsClient struct { Client *resourcemanager.Client } -func NewConnectionMonitorsClientWithBaseURI(api environments.Api) (*ConnectionMonitorsClient, error) { +func NewConnectionMonitorsClientWithBaseURI(api sdkEnv.Api) (*ConnectionMonitorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "connectionmonitors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConnectionMonitorsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/connectivityconfigurations/client.go b/resource-manager/network/2023-04-01/connectivityconfigurations/client.go index ff548b06d0f..3d5049ab191 100644 --- a/resource-manager/network/2023-04-01/connectivityconfigurations/client.go +++ b/resource-manager/network/2023-04-01/connectivityconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConnectivityConfigurationsClient struct { Client *resourcemanager.Client } -func NewConnectivityConfigurationsClientWithBaseURI(api environments.Api) (*ConnectivityConfigurationsClient, error) { +func NewConnectivityConfigurationsClientWithBaseURI(api sdkEnv.Api) (*ConnectivityConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "connectivityconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConnectivityConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/customipprefixes/client.go b/resource-manager/network/2023-04-01/customipprefixes/client.go index 31f10177172..5a7199b239a 100644 --- a/resource-manager/network/2023-04-01/customipprefixes/client.go +++ b/resource-manager/network/2023-04-01/customipprefixes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CustomIPPrefixesClient struct { Client *resourcemanager.Client } -func NewCustomIPPrefixesClientWithBaseURI(api environments.Api) (*CustomIPPrefixesClient, error) { +func NewCustomIPPrefixesClientWithBaseURI(api sdkEnv.Api) (*CustomIPPrefixesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "customipprefixes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CustomIPPrefixesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/ddoscustompolicies/client.go b/resource-manager/network/2023-04-01/ddoscustompolicies/client.go index e9d35f8b060..6b6f1542bb7 100644 --- a/resource-manager/network/2023-04-01/ddoscustompolicies/client.go +++ b/resource-manager/network/2023-04-01/ddoscustompolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DdosCustomPoliciesClient struct { Client *resourcemanager.Client } -func NewDdosCustomPoliciesClientWithBaseURI(api environments.Api) (*DdosCustomPoliciesClient, error) { +func NewDdosCustomPoliciesClientWithBaseURI(api sdkEnv.Api) (*DdosCustomPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ddoscustompolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DdosCustomPoliciesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/ddosprotectionplans/client.go b/resource-manager/network/2023-04-01/ddosprotectionplans/client.go index df2917fd5cf..1849f2c3bfa 100644 --- a/resource-manager/network/2023-04-01/ddosprotectionplans/client.go +++ b/resource-manager/network/2023-04-01/ddosprotectionplans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DdosProtectionPlansClient struct { Client *resourcemanager.Client } -func NewDdosProtectionPlansClientWithBaseURI(api environments.Api) (*DdosProtectionPlansClient, error) { +func NewDdosProtectionPlansClientWithBaseURI(api sdkEnv.Api) (*DdosProtectionPlansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ddosprotectionplans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DdosProtectionPlansClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/dscpconfiguration/client.go b/resource-manager/network/2023-04-01/dscpconfiguration/client.go index dd1ba400a66..6d8cc0e19c7 100644 --- a/resource-manager/network/2023-04-01/dscpconfiguration/client.go +++ b/resource-manager/network/2023-04-01/dscpconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DscpConfigurationClient struct { Client *resourcemanager.Client } -func NewDscpConfigurationClientWithBaseURI(api environments.Api) (*DscpConfigurationClient, error) { +func NewDscpConfigurationClientWithBaseURI(api sdkEnv.Api) (*DscpConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dscpconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DscpConfigurationClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/dscpconfigurations/client.go b/resource-manager/network/2023-04-01/dscpconfigurations/client.go index 23c3e89b48f..59faae1af96 100644 --- a/resource-manager/network/2023-04-01/dscpconfigurations/client.go +++ b/resource-manager/network/2023-04-01/dscpconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DscpConfigurationsClient struct { Client *resourcemanager.Client } -func NewDscpConfigurationsClientWithBaseURI(api environments.Api) (*DscpConfigurationsClient, error) { +func NewDscpConfigurationsClientWithBaseURI(api sdkEnv.Api) (*DscpConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dscpconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DscpConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/endpointservices/client.go b/resource-manager/network/2023-04-01/endpointservices/client.go index 2cf01f43cdd..262f10d12ed 100644 --- a/resource-manager/network/2023-04-01/endpointservices/client.go +++ b/resource-manager/network/2023-04-01/endpointservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EndpointServicesClient struct { Client *resourcemanager.Client } -func NewEndpointServicesClientWithBaseURI(api environments.Api) (*EndpointServicesClient, error) { +func NewEndpointServicesClientWithBaseURI(api sdkEnv.Api) (*EndpointServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "endpointservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EndpointServicesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecircuitarptable/client.go b/resource-manager/network/2023-04-01/expressroutecircuitarptable/client.go index daef3b62246..22d680b7411 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitarptable/client.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitarptable/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitArpTableClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitArpTableClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitArpTableClient, error) { +func NewExpressRouteCircuitArpTableClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitArpTableClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitarptable", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitArpTableClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/client.go b/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/client.go index 8ee64242c49..0d7bb179887 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/client.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitAuthorizationsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitAuthorizationsClient, error) { +func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitAuthorizationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitauthorizations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitAuthorizationsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecircuitconnections/client.go b/resource-manager/network/2023-04-01/expressroutecircuitconnections/client.go index 0fc743a7f46..999d2e53637 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitconnections/client.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitConnectionsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitConnectionsClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitConnectionsClient, error) { +func NewExpressRouteCircuitConnectionsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecircuitpeerings/client.go b/resource-manager/network/2023-04-01/expressroutecircuitpeerings/client.go index 3d549f1e88d..6251e002c81 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitpeerings/client.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitpeerings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitPeeringsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitPeeringsClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitPeeringsClient, error) { +func NewExpressRouteCircuitPeeringsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitPeeringsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitpeerings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitPeeringsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecircuitroutestable/client.go b/resource-manager/network/2023-04-01/expressroutecircuitroutestable/client.go index 4122036f496..5350326f6db 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitroutestable/client.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitroutestable/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitRoutesTableClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitRoutesTableClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitRoutesTableClient, error) { +func NewExpressRouteCircuitRoutesTableClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitRoutesTableClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitroutestable", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitRoutesTableClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecircuitroutestablesummary/client.go b/resource-manager/network/2023-04-01/expressroutecircuitroutestablesummary/client.go index 93516365ad8..78565f4e478 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitroutestablesummary/client.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitroutestablesummary/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitRoutesTableSummaryClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitRoutesTableSummaryClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitRoutesTableSummaryClient, error) { +func NewExpressRouteCircuitRoutesTableSummaryClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitRoutesTableSummaryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitroutestablesummary", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitRoutesTableSummaryClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecircuits/client.go b/resource-manager/network/2023-04-01/expressroutecircuits/client.go index 380fde4f56c..2210d04845f 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuits/client.go +++ b/resource-manager/network/2023-04-01/expressroutecircuits/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitsClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitsClient, error) { +func NewExpressRouteCircuitsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuits", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecircuitstats/client.go b/resource-manager/network/2023-04-01/expressroutecircuitstats/client.go index 1ccb263389c..ba8460f5591 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitstats/client.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitstats/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCircuitStatsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCircuitStatsClientWithBaseURI(api environments.Api) (*ExpressRouteCircuitStatsClient, error) { +func NewExpressRouteCircuitStatsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCircuitStatsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecircuitstats", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCircuitStatsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressrouteconnections/client.go b/resource-manager/network/2023-04-01/expressrouteconnections/client.go index 9fb5bde933b..42e9b0b6c07 100644 --- a/resource-manager/network/2023-04-01/expressrouteconnections/client.go +++ b/resource-manager/network/2023-04-01/expressrouteconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteConnectionsClient struct { Client *resourcemanager.Client } -func NewExpressRouteConnectionsClientWithBaseURI(api environments.Api) (*ExpressRouteConnectionsClient, error) { +func NewExpressRouteConnectionsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecrossconnectionarptable/client.go b/resource-manager/network/2023-04-01/expressroutecrossconnectionarptable/client.go index 674582d3ee4..d9ce222e3f1 100644 --- a/resource-manager/network/2023-04-01/expressroutecrossconnectionarptable/client.go +++ b/resource-manager/network/2023-04-01/expressroutecrossconnectionarptable/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCrossConnectionArpTableClient struct { Client *resourcemanager.Client } -func NewExpressRouteCrossConnectionArpTableClientWithBaseURI(api environments.Api) (*ExpressRouteCrossConnectionArpTableClient, error) { +func NewExpressRouteCrossConnectionArpTableClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCrossConnectionArpTableClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecrossconnectionarptable", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCrossConnectionArpTableClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/client.go b/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/client.go index 320a0785b8d..3da491c8f95 100644 --- a/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/client.go +++ b/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCrossConnectionPeeringsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCrossConnectionPeeringsClientWithBaseURI(api environments.Api) (*ExpressRouteCrossConnectionPeeringsClient, error) { +func NewExpressRouteCrossConnectionPeeringsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCrossConnectionPeeringsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecrossconnectionpeerings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCrossConnectionPeeringsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetable/client.go b/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetable/client.go index 4437ac75b0d..993654ed031 100644 --- a/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetable/client.go +++ b/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetable/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCrossConnectionRouteTableClient struct { Client *resourcemanager.Client } -func NewExpressRouteCrossConnectionRouteTableClientWithBaseURI(api environments.Api) (*ExpressRouteCrossConnectionRouteTableClient, error) { +func NewExpressRouteCrossConnectionRouteTableClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCrossConnectionRouteTableClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecrossconnectionroutetable", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCrossConnectionRouteTableClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetablesummary/client.go b/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetablesummary/client.go index d9ffe2f386e..d0fe26bb8e3 100644 --- a/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetablesummary/client.go +++ b/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetablesummary/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCrossConnectionRouteTableSummaryClient struct { Client *resourcemanager.Client } -func NewExpressRouteCrossConnectionRouteTableSummaryClientWithBaseURI(api environments.Api) (*ExpressRouteCrossConnectionRouteTableSummaryClient, error) { +func NewExpressRouteCrossConnectionRouteTableSummaryClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCrossConnectionRouteTableSummaryClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecrossconnectionroutetablesummary", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCrossConnectionRouteTableSummaryClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutecrossconnections/client.go b/resource-manager/network/2023-04-01/expressroutecrossconnections/client.go index 6c02cfc4b39..bbdf9157b55 100644 --- a/resource-manager/network/2023-04-01/expressroutecrossconnections/client.go +++ b/resource-manager/network/2023-04-01/expressroutecrossconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteCrossConnectionsClient struct { Client *resourcemanager.Client } -func NewExpressRouteCrossConnectionsClientWithBaseURI(api environments.Api) (*ExpressRouteCrossConnectionsClient, error) { +func NewExpressRouteCrossConnectionsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteCrossConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutecrossconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteCrossConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutegateways/client.go b/resource-manager/network/2023-04-01/expressroutegateways/client.go index 474f4529b5a..308dc4f777a 100644 --- a/resource-manager/network/2023-04-01/expressroutegateways/client.go +++ b/resource-manager/network/2023-04-01/expressroutegateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteGatewaysClient struct { Client *resourcemanager.Client } -func NewExpressRouteGatewaysClientWithBaseURI(api environments.Api) (*ExpressRouteGatewaysClient, error) { +func NewExpressRouteGatewaysClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutegateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressroutelinks/client.go b/resource-manager/network/2023-04-01/expressroutelinks/client.go index 316b515aeba..7c2242b9273 100644 --- a/resource-manager/network/2023-04-01/expressroutelinks/client.go +++ b/resource-manager/network/2023-04-01/expressroutelinks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteLinksClient struct { Client *resourcemanager.Client } -func NewExpressRouteLinksClientWithBaseURI(api environments.Api) (*ExpressRouteLinksClient, error) { +func NewExpressRouteLinksClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteLinksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressroutelinks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteLinksClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressrouteportauthorizations/client.go b/resource-manager/network/2023-04-01/expressrouteportauthorizations/client.go index 532d877b9fe..35b23f59857 100644 --- a/resource-manager/network/2023-04-01/expressrouteportauthorizations/client.go +++ b/resource-manager/network/2023-04-01/expressrouteportauthorizations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRoutePortAuthorizationsClient struct { Client *resourcemanager.Client } -func NewExpressRoutePortAuthorizationsClientWithBaseURI(api environments.Api) (*ExpressRoutePortAuthorizationsClient, error) { +func NewExpressRoutePortAuthorizationsClientWithBaseURI(api sdkEnv.Api) (*ExpressRoutePortAuthorizationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteportauthorizations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRoutePortAuthorizationsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressrouteports/client.go b/resource-manager/network/2023-04-01/expressrouteports/client.go index e0be48aade5..edd33580fdf 100644 --- a/resource-manager/network/2023-04-01/expressrouteports/client.go +++ b/resource-manager/network/2023-04-01/expressrouteports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRoutePortsClient struct { Client *resourcemanager.Client } -func NewExpressRoutePortsClientWithBaseURI(api environments.Api) (*ExpressRoutePortsClient, error) { +func NewExpressRoutePortsClientWithBaseURI(api sdkEnv.Api) (*ExpressRoutePortsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRoutePortsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressrouteportslocations/client.go b/resource-manager/network/2023-04-01/expressrouteportslocations/client.go index e57bad8052e..6c930f05fa5 100644 --- a/resource-manager/network/2023-04-01/expressrouteportslocations/client.go +++ b/resource-manager/network/2023-04-01/expressrouteportslocations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRoutePortsLocationsClient struct { Client *resourcemanager.Client } -func NewExpressRoutePortsLocationsClientWithBaseURI(api environments.Api) (*ExpressRoutePortsLocationsClient, error) { +func NewExpressRoutePortsLocationsClientWithBaseURI(api sdkEnv.Api) (*ExpressRoutePortsLocationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteportslocations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRoutePortsLocationsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressrouteproviderports/client.go b/resource-manager/network/2023-04-01/expressrouteproviderports/client.go index 276d5877f63..3b9ac2c870c 100644 --- a/resource-manager/network/2023-04-01/expressrouteproviderports/client.go +++ b/resource-manager/network/2023-04-01/expressrouteproviderports/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteProviderPortsClient struct { Client *resourcemanager.Client } -func NewExpressRouteProviderPortsClientWithBaseURI(api environments.Api) (*ExpressRouteProviderPortsClient, error) { +func NewExpressRouteProviderPortsClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteProviderPortsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteproviderports", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteProviderPortsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/expressrouteserviceproviders/client.go b/resource-manager/network/2023-04-01/expressrouteserviceproviders/client.go index 68ed2324e0d..690b45f48fe 100644 --- a/resource-manager/network/2023-04-01/expressrouteserviceproviders/client.go +++ b/resource-manager/network/2023-04-01/expressrouteserviceproviders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ExpressRouteServiceProvidersClient struct { Client *resourcemanager.Client } -func NewExpressRouteServiceProvidersClientWithBaseURI(api environments.Api) (*ExpressRouteServiceProvidersClient, error) { +func NewExpressRouteServiceProvidersClientWithBaseURI(api sdkEnv.Api) (*ExpressRouteServiceProvidersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "expressrouteserviceproviders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ExpressRouteServiceProvidersClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/firewallpolicies/client.go b/resource-manager/network/2023-04-01/firewallpolicies/client.go index 791b0949b8c..6821e085a20 100644 --- a/resource-manager/network/2023-04-01/firewallpolicies/client.go +++ b/resource-manager/network/2023-04-01/firewallpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallPoliciesClient struct { Client *resourcemanager.Client } -func NewFirewallPoliciesClientWithBaseURI(api environments.Api) (*FirewallPoliciesClient, error) { +func NewFirewallPoliciesClientWithBaseURI(api sdkEnv.Api) (*FirewallPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallPoliciesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/client.go b/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/client.go index 1066038440b..3e78f3041c9 100644 --- a/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/client.go +++ b/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallPolicyRuleCollectionGroupsClient struct { Client *resourcemanager.Client } -func NewFirewallPolicyRuleCollectionGroupsClientWithBaseURI(api environments.Api) (*FirewallPolicyRuleCollectionGroupsClient, error) { +func NewFirewallPolicyRuleCollectionGroupsClientWithBaseURI(api sdkEnv.Api) (*FirewallPolicyRuleCollectionGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallpolicyrulecollectiongroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallPolicyRuleCollectionGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/flowlogs/client.go b/resource-manager/network/2023-04-01/flowlogs/client.go index 51ae4558663..34fce459441 100644 --- a/resource-manager/network/2023-04-01/flowlogs/client.go +++ b/resource-manager/network/2023-04-01/flowlogs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FlowLogsClient struct { Client *resourcemanager.Client } -func NewFlowLogsClientWithBaseURI(api environments.Api) (*FlowLogsClient, error) { +func NewFlowLogsClientWithBaseURI(api sdkEnv.Api) (*FlowLogsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "flowlogs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FlowLogsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/ipallocations/client.go b/resource-manager/network/2023-04-01/ipallocations/client.go index a9a2ce87420..e6099d4dd9b 100644 --- a/resource-manager/network/2023-04-01/ipallocations/client.go +++ b/resource-manager/network/2023-04-01/ipallocations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IPAllocationsClient struct { Client *resourcemanager.Client } -func NewIPAllocationsClientWithBaseURI(api environments.Api) (*IPAllocationsClient, error) { +func NewIPAllocationsClientWithBaseURI(api sdkEnv.Api) (*IPAllocationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ipallocations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IPAllocationsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/ipgroups/client.go b/resource-manager/network/2023-04-01/ipgroups/client.go index 74e63c13a67..de34f7ed9cd 100644 --- a/resource-manager/network/2023-04-01/ipgroups/client.go +++ b/resource-manager/network/2023-04-01/ipgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IPGroupsClient struct { Client *resourcemanager.Client } -func NewIPGroupsClientWithBaseURI(api environments.Api) (*IPGroupsClient, error) { +func NewIPGroupsClientWithBaseURI(api sdkEnv.Api) (*IPGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ipgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IPGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/loadbalancers/client.go b/resource-manager/network/2023-04-01/loadbalancers/client.go index c61a342321c..27563667676 100644 --- a/resource-manager/network/2023-04-01/loadbalancers/client.go +++ b/resource-manager/network/2023-04-01/loadbalancers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LoadBalancersClient struct { Client *resourcemanager.Client } -func NewLoadBalancersClientWithBaseURI(api environments.Api) (*LoadBalancersClient, error) { +func NewLoadBalancersClientWithBaseURI(api sdkEnv.Api) (*LoadBalancersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "loadbalancers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LoadBalancersClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/localnetworkgateways/client.go b/resource-manager/network/2023-04-01/localnetworkgateways/client.go index b52d286c069..39a94814e1e 100644 --- a/resource-manager/network/2023-04-01/localnetworkgateways/client.go +++ b/resource-manager/network/2023-04-01/localnetworkgateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocalNetworkGatewaysClient struct { Client *resourcemanager.Client } -func NewLocalNetworkGatewaysClientWithBaseURI(api environments.Api) (*LocalNetworkGatewaysClient, error) { +func NewLocalNetworkGatewaysClientWithBaseURI(api sdkEnv.Api) (*LocalNetworkGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "localnetworkgateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocalNetworkGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/natgateways/client.go b/resource-manager/network/2023-04-01/natgateways/client.go index 043b69b83b7..baab856035a 100644 --- a/resource-manager/network/2023-04-01/natgateways/client.go +++ b/resource-manager/network/2023-04-01/natgateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NatGatewaysClient struct { Client *resourcemanager.Client } -func NewNatGatewaysClientWithBaseURI(api environments.Api) (*NatGatewaysClient, error) { +func NewNatGatewaysClientWithBaseURI(api sdkEnv.Api) (*NatGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "natgateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NatGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networkgroups/client.go b/resource-manager/network/2023-04-01/networkgroups/client.go index 7c9fe140203..9588e4e2e7a 100644 --- a/resource-manager/network/2023-04-01/networkgroups/client.go +++ b/resource-manager/network/2023-04-01/networkgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkGroupsClient struct { Client *resourcemanager.Client } -func NewNetworkGroupsClientWithBaseURI(api environments.Api) (*NetworkGroupsClient, error) { +func NewNetworkGroupsClientWithBaseURI(api sdkEnv.Api) (*NetworkGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networkinterfaces/client.go b/resource-manager/network/2023-04-01/networkinterfaces/client.go index c0faee67c81..82096d5749b 100644 --- a/resource-manager/network/2023-04-01/networkinterfaces/client.go +++ b/resource-manager/network/2023-04-01/networkinterfaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkInterfacesClient struct { Client *resourcemanager.Client } -func NewNetworkInterfacesClientWithBaseURI(api environments.Api) (*NetworkInterfacesClient, error) { +func NewNetworkInterfacesClientWithBaseURI(api sdkEnv.Api) (*NetworkInterfacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkinterfaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkInterfacesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networkmanageractiveconfigurations/client.go b/resource-manager/network/2023-04-01/networkmanageractiveconfigurations/client.go index 221c88c6510..8ba7b7fb4c2 100644 --- a/resource-manager/network/2023-04-01/networkmanageractiveconfigurations/client.go +++ b/resource-manager/network/2023-04-01/networkmanageractiveconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagerActiveConfigurationsClient struct { Client *resourcemanager.Client } -func NewNetworkManagerActiveConfigurationsClientWithBaseURI(api environments.Api) (*NetworkManagerActiveConfigurationsClient, error) { +func NewNetworkManagerActiveConfigurationsClientWithBaseURI(api sdkEnv.Api) (*NetworkManagerActiveConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanageractiveconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagerActiveConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networkmanageractiveconnectivityconfigurations/client.go b/resource-manager/network/2023-04-01/networkmanageractiveconnectivityconfigurations/client.go index 23ed55c7d15..95b5115b546 100644 --- a/resource-manager/network/2023-04-01/networkmanageractiveconnectivityconfigurations/client.go +++ b/resource-manager/network/2023-04-01/networkmanageractiveconnectivityconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagerActiveConnectivityConfigurationsClient struct { Client *resourcemanager.Client } -func NewNetworkManagerActiveConnectivityConfigurationsClientWithBaseURI(api environments.Api) (*NetworkManagerActiveConnectivityConfigurationsClient, error) { +func NewNetworkManagerActiveConnectivityConfigurationsClientWithBaseURI(api sdkEnv.Api) (*NetworkManagerActiveConnectivityConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanageractiveconnectivityconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagerActiveConnectivityConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networkmanagerconnections/client.go b/resource-manager/network/2023-04-01/networkmanagerconnections/client.go index 6e918e232b8..e056f14d41b 100644 --- a/resource-manager/network/2023-04-01/networkmanagerconnections/client.go +++ b/resource-manager/network/2023-04-01/networkmanagerconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagerConnectionsClient struct { Client *resourcemanager.Client } -func NewNetworkManagerConnectionsClientWithBaseURI(api environments.Api) (*NetworkManagerConnectionsClient, error) { +func NewNetworkManagerConnectionsClientWithBaseURI(api sdkEnv.Api) (*NetworkManagerConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanagerconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagerConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networkmanagereffectiveconnectivityconfiguration/client.go b/resource-manager/network/2023-04-01/networkmanagereffectiveconnectivityconfiguration/client.go index e1cc279732c..4fc00377fb4 100644 --- a/resource-manager/network/2023-04-01/networkmanagereffectiveconnectivityconfiguration/client.go +++ b/resource-manager/network/2023-04-01/networkmanagereffectiveconnectivityconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagerEffectiveConnectivityConfigurationClient struct { Client *resourcemanager.Client } -func NewNetworkManagerEffectiveConnectivityConfigurationClientWithBaseURI(api environments.Api) (*NetworkManagerEffectiveConnectivityConfigurationClient, error) { +func NewNetworkManagerEffectiveConnectivityConfigurationClientWithBaseURI(api sdkEnv.Api) (*NetworkManagerEffectiveConnectivityConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanagereffectiveconnectivityconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagerEffectiveConnectivityConfigurationClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networkmanagereffectivesecurityadminrules/client.go b/resource-manager/network/2023-04-01/networkmanagereffectivesecurityadminrules/client.go index ea0d80cd16d..fa0f9b6242b 100644 --- a/resource-manager/network/2023-04-01/networkmanagereffectivesecurityadminrules/client.go +++ b/resource-manager/network/2023-04-01/networkmanagereffectivesecurityadminrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagerEffectiveSecurityAdminRulesClient struct { Client *resourcemanager.Client } -func NewNetworkManagerEffectiveSecurityAdminRulesClientWithBaseURI(api environments.Api) (*NetworkManagerEffectiveSecurityAdminRulesClient, error) { +func NewNetworkManagerEffectiveSecurityAdminRulesClientWithBaseURI(api sdkEnv.Api) (*NetworkManagerEffectiveSecurityAdminRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanagereffectivesecurityadminrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagerEffectiveSecurityAdminRulesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networkmanagers/client.go b/resource-manager/network/2023-04-01/networkmanagers/client.go index d3cd73d8b1c..fbce4ce936f 100644 --- a/resource-manager/network/2023-04-01/networkmanagers/client.go +++ b/resource-manager/network/2023-04-01/networkmanagers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkManagersClient struct { Client *resourcemanager.Client } -func NewNetworkManagersClientWithBaseURI(api environments.Api) (*NetworkManagersClient, error) { +func NewNetworkManagersClientWithBaseURI(api sdkEnv.Api) (*NetworkManagersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkmanagers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkManagersClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networkprofiles/client.go b/resource-manager/network/2023-04-01/networkprofiles/client.go index c0d65005107..ad7a4890693 100644 --- a/resource-manager/network/2023-04-01/networkprofiles/client.go +++ b/resource-manager/network/2023-04-01/networkprofiles/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkProfilesClient struct { Client *resourcemanager.Client } -func NewNetworkProfilesClientWithBaseURI(api environments.Api) (*NetworkProfilesClient, error) { +func NewNetworkProfilesClientWithBaseURI(api sdkEnv.Api) (*NetworkProfilesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkprofiles", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkProfilesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networksecuritygroups/client.go b/resource-manager/network/2023-04-01/networksecuritygroups/client.go index a297cbae4a7..34116bb47e7 100644 --- a/resource-manager/network/2023-04-01/networksecuritygroups/client.go +++ b/resource-manager/network/2023-04-01/networksecuritygroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkSecurityGroupsClient struct { Client *resourcemanager.Client } -func NewNetworkSecurityGroupsClientWithBaseURI(api environments.Api) (*NetworkSecurityGroupsClient, error) { +func NewNetworkSecurityGroupsClientWithBaseURI(api sdkEnv.Api) (*NetworkSecurityGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networksecuritygroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkSecurityGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networkvirtualappliances/client.go b/resource-manager/network/2023-04-01/networkvirtualappliances/client.go index 78dbf8c120b..e9f7ca45687 100644 --- a/resource-manager/network/2023-04-01/networkvirtualappliances/client.go +++ b/resource-manager/network/2023-04-01/networkvirtualappliances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkVirtualAppliancesClient struct { Client *resourcemanager.Client } -func NewNetworkVirtualAppliancesClientWithBaseURI(api environments.Api) (*NetworkVirtualAppliancesClient, error) { +func NewNetworkVirtualAppliancesClientWithBaseURI(api sdkEnv.Api) (*NetworkVirtualAppliancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkvirtualappliances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkVirtualAppliancesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/networkwatchers/client.go b/resource-manager/network/2023-04-01/networkwatchers/client.go index d0f44155ba5..331d904fb90 100644 --- a/resource-manager/network/2023-04-01/networkwatchers/client.go +++ b/resource-manager/network/2023-04-01/networkwatchers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkWatchersClient struct { Client *resourcemanager.Client } -func NewNetworkWatchersClientWithBaseURI(api environments.Api) (*NetworkWatchersClient, error) { +func NewNetworkWatchersClientWithBaseURI(api sdkEnv.Api) (*NetworkWatchersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networkwatchers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkWatchersClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/p2svpngateways/client.go b/resource-manager/network/2023-04-01/p2svpngateways/client.go index 893958568c2..d669d17929a 100644 --- a/resource-manager/network/2023-04-01/p2svpngateways/client.go +++ b/resource-manager/network/2023-04-01/p2svpngateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type P2sVpnGatewaysClient struct { Client *resourcemanager.Client } -func NewP2sVpnGatewaysClientWithBaseURI(api environments.Api) (*P2sVpnGatewaysClient, error) { +func NewP2sVpnGatewaysClientWithBaseURI(api sdkEnv.Api) (*P2sVpnGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "p2svpngateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating P2sVpnGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/packetcaptures/client.go b/resource-manager/network/2023-04-01/packetcaptures/client.go index 0a4a3398869..5367931aba6 100644 --- a/resource-manager/network/2023-04-01/packetcaptures/client.go +++ b/resource-manager/network/2023-04-01/packetcaptures/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PacketCapturesClient struct { Client *resourcemanager.Client } -func NewPacketCapturesClientWithBaseURI(api environments.Api) (*PacketCapturesClient, error) { +func NewPacketCapturesClientWithBaseURI(api sdkEnv.Api) (*PacketCapturesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "packetcaptures", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PacketCapturesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/peerexpressroutecircuitconnections/client.go b/resource-manager/network/2023-04-01/peerexpressroutecircuitconnections/client.go index c153e5d3b4a..a204a19106c 100644 --- a/resource-manager/network/2023-04-01/peerexpressroutecircuitconnections/client.go +++ b/resource-manager/network/2023-04-01/peerexpressroutecircuitconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PeerExpressRouteCircuitConnectionsClient struct { Client *resourcemanager.Client } -func NewPeerExpressRouteCircuitConnectionsClientWithBaseURI(api environments.Api) (*PeerExpressRouteCircuitConnectionsClient, error) { +func NewPeerExpressRouteCircuitConnectionsClientWithBaseURI(api sdkEnv.Api) (*PeerExpressRouteCircuitConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "peerexpressroutecircuitconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PeerExpressRouteCircuitConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/privatednszonegroups/client.go b/resource-manager/network/2023-04-01/privatednszonegroups/client.go index 872a0ea57cd..b5fe0d3134a 100644 --- a/resource-manager/network/2023-04-01/privatednszonegroups/client.go +++ b/resource-manager/network/2023-04-01/privatednszonegroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateDnsZoneGroupsClient struct { Client *resourcemanager.Client } -func NewPrivateDnsZoneGroupsClientWithBaseURI(api environments.Api) (*PrivateDnsZoneGroupsClient, error) { +func NewPrivateDnsZoneGroupsClientWithBaseURI(api sdkEnv.Api) (*PrivateDnsZoneGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatednszonegroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateDnsZoneGroupsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/privateendpoints/client.go b/resource-manager/network/2023-04-01/privateendpoints/client.go index 8ef83ec0060..8300f305f02 100644 --- a/resource-manager/network/2023-04-01/privateendpoints/client.go +++ b/resource-manager/network/2023-04-01/privateendpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointsClientWithBaseURI(api environments.Api) (*PrivateEndpointsClient, error) { +func NewPrivateEndpointsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/privatelinkservice/client.go b/resource-manager/network/2023-04-01/privatelinkservice/client.go index b2b1cce0fce..427397e995d 100644 --- a/resource-manager/network/2023-04-01/privatelinkservice/client.go +++ b/resource-manager/network/2023-04-01/privatelinkservice/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkServiceClient struct { Client *resourcemanager.Client } -func NewPrivateLinkServiceClientWithBaseURI(api environments.Api) (*PrivateLinkServiceClient, error) { +func NewPrivateLinkServiceClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkServiceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkservice", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkServiceClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/privatelinkservices/client.go b/resource-manager/network/2023-04-01/privatelinkservices/client.go index ef379b0edb5..3707d0cc162 100644 --- a/resource-manager/network/2023-04-01/privatelinkservices/client.go +++ b/resource-manager/network/2023-04-01/privatelinkservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkServicesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkServicesClientWithBaseURI(api environments.Api) (*PrivateLinkServicesClient, error) { +func NewPrivateLinkServicesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkServicesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/publicipaddresses/client.go b/resource-manager/network/2023-04-01/publicipaddresses/client.go index 58a629943e3..e1bc3d5e86e 100644 --- a/resource-manager/network/2023-04-01/publicipaddresses/client.go +++ b/resource-manager/network/2023-04-01/publicipaddresses/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PublicIPAddressesClient struct { Client *resourcemanager.Client } -func NewPublicIPAddressesClientWithBaseURI(api environments.Api) (*PublicIPAddressesClient, error) { +func NewPublicIPAddressesClientWithBaseURI(api sdkEnv.Api) (*PublicIPAddressesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "publicipaddresses", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PublicIPAddressesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/publicipprefixes/client.go b/resource-manager/network/2023-04-01/publicipprefixes/client.go index 9a1637fc3ce..8f8c8241331 100644 --- a/resource-manager/network/2023-04-01/publicipprefixes/client.go +++ b/resource-manager/network/2023-04-01/publicipprefixes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PublicIPPrefixesClient struct { Client *resourcemanager.Client } -func NewPublicIPPrefixesClientWithBaseURI(api environments.Api) (*PublicIPPrefixesClient, error) { +func NewPublicIPPrefixesClientWithBaseURI(api sdkEnv.Api) (*PublicIPPrefixesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "publicipprefixes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PublicIPPrefixesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/routefilterrules/client.go b/resource-manager/network/2023-04-01/routefilterrules/client.go index 44483c23138..26f9695593a 100644 --- a/resource-manager/network/2023-04-01/routefilterrules/client.go +++ b/resource-manager/network/2023-04-01/routefilterrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RouteFilterRulesClient struct { Client *resourcemanager.Client } -func NewRouteFilterRulesClientWithBaseURI(api environments.Api) (*RouteFilterRulesClient, error) { +func NewRouteFilterRulesClientWithBaseURI(api sdkEnv.Api) (*RouteFilterRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "routefilterrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RouteFilterRulesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/routefilters/client.go b/resource-manager/network/2023-04-01/routefilters/client.go index e233141d003..45bd1d7d099 100644 --- a/resource-manager/network/2023-04-01/routefilters/client.go +++ b/resource-manager/network/2023-04-01/routefilters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RouteFiltersClient struct { Client *resourcemanager.Client } -func NewRouteFiltersClientWithBaseURI(api environments.Api) (*RouteFiltersClient, error) { +func NewRouteFiltersClientWithBaseURI(api sdkEnv.Api) (*RouteFiltersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "routefilters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RouteFiltersClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/routes/client.go b/resource-manager/network/2023-04-01/routes/client.go index d82a569dd0e..357e0d15dac 100644 --- a/resource-manager/network/2023-04-01/routes/client.go +++ b/resource-manager/network/2023-04-01/routes/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RoutesClient struct { Client *resourcemanager.Client } -func NewRoutesClientWithBaseURI(api environments.Api) (*RoutesClient, error) { +func NewRoutesClientWithBaseURI(api sdkEnv.Api) (*RoutesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "routes", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RoutesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/routetables/client.go b/resource-manager/network/2023-04-01/routetables/client.go index 98894d48e67..4b013bcb471 100644 --- a/resource-manager/network/2023-04-01/routetables/client.go +++ b/resource-manager/network/2023-04-01/routetables/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RouteTablesClient struct { Client *resourcemanager.Client } -func NewRouteTablesClientWithBaseURI(api environments.Api) (*RouteTablesClient, error) { +func NewRouteTablesClientWithBaseURI(api sdkEnv.Api) (*RouteTablesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "routetables", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RouteTablesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/scopeconnections/client.go b/resource-manager/network/2023-04-01/scopeconnections/client.go index 65a0f58dd04..89ced27c443 100644 --- a/resource-manager/network/2023-04-01/scopeconnections/client.go +++ b/resource-manager/network/2023-04-01/scopeconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScopeConnectionsClient struct { Client *resourcemanager.Client } -func NewScopeConnectionsClientWithBaseURI(api environments.Api) (*ScopeConnectionsClient, error) { +func NewScopeConnectionsClientWithBaseURI(api sdkEnv.Api) (*ScopeConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scopeconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScopeConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/securityadminconfigurations/client.go b/resource-manager/network/2023-04-01/securityadminconfigurations/client.go index 4462d9db2c9..6e5471ef2ec 100644 --- a/resource-manager/network/2023-04-01/securityadminconfigurations/client.go +++ b/resource-manager/network/2023-04-01/securityadminconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SecurityAdminConfigurationsClient struct { Client *resourcemanager.Client } -func NewSecurityAdminConfigurationsClientWithBaseURI(api environments.Api) (*SecurityAdminConfigurationsClient, error) { +func NewSecurityAdminConfigurationsClientWithBaseURI(api sdkEnv.Api) (*SecurityAdminConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "securityadminconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SecurityAdminConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/securitypartnerproviders/client.go b/resource-manager/network/2023-04-01/securitypartnerproviders/client.go index 8e43fdacd61..99c5c85cab5 100644 --- a/resource-manager/network/2023-04-01/securitypartnerproviders/client.go +++ b/resource-manager/network/2023-04-01/securitypartnerproviders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SecurityPartnerProvidersClient struct { Client *resourcemanager.Client } -func NewSecurityPartnerProvidersClientWithBaseURI(api environments.Api) (*SecurityPartnerProvidersClient, error) { +func NewSecurityPartnerProvidersClientWithBaseURI(api sdkEnv.Api) (*SecurityPartnerProvidersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "securitypartnerproviders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SecurityPartnerProvidersClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/securityrules/client.go b/resource-manager/network/2023-04-01/securityrules/client.go index a386b6c0dec..569786c9a6d 100644 --- a/resource-manager/network/2023-04-01/securityrules/client.go +++ b/resource-manager/network/2023-04-01/securityrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SecurityRulesClient struct { Client *resourcemanager.Client } -func NewSecurityRulesClientWithBaseURI(api environments.Api) (*SecurityRulesClient, error) { +func NewSecurityRulesClientWithBaseURI(api sdkEnv.Api) (*SecurityRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "securityrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SecurityRulesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/serviceendpointpolicies/client.go b/resource-manager/network/2023-04-01/serviceendpointpolicies/client.go index aa0cce53c77..0443b85f684 100644 --- a/resource-manager/network/2023-04-01/serviceendpointpolicies/client.go +++ b/resource-manager/network/2023-04-01/serviceendpointpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServiceEndpointPoliciesClient struct { Client *resourcemanager.Client } -func NewServiceEndpointPoliciesClientWithBaseURI(api environments.Api) (*ServiceEndpointPoliciesClient, error) { +func NewServiceEndpointPoliciesClientWithBaseURI(api sdkEnv.Api) (*ServiceEndpointPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serviceendpointpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServiceEndpointPoliciesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/client.go b/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/client.go index 255a599b606..3bd79658a66 100644 --- a/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/client.go +++ b/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServiceEndpointPolicyDefinitionsClient struct { Client *resourcemanager.Client } -func NewServiceEndpointPolicyDefinitionsClientWithBaseURI(api environments.Api) (*ServiceEndpointPolicyDefinitionsClient, error) { +func NewServiceEndpointPolicyDefinitionsClientWithBaseURI(api sdkEnv.Api) (*ServiceEndpointPolicyDefinitionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serviceendpointpolicydefinitions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServiceEndpointPolicyDefinitionsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/servicetags/client.go b/resource-manager/network/2023-04-01/servicetags/client.go index 6ce184db9bc..a225a424ac3 100644 --- a/resource-manager/network/2023-04-01/servicetags/client.go +++ b/resource-manager/network/2023-04-01/servicetags/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServiceTagsClient struct { Client *resourcemanager.Client } -func NewServiceTagsClientWithBaseURI(api environments.Api) (*ServiceTagsClient, error) { +func NewServiceTagsClientWithBaseURI(api sdkEnv.Api) (*ServiceTagsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servicetags", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServiceTagsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/staticmembers/client.go b/resource-manager/network/2023-04-01/staticmembers/client.go index bc0383f9c3c..4b864eb3ccb 100644 --- a/resource-manager/network/2023-04-01/staticmembers/client.go +++ b/resource-manager/network/2023-04-01/staticmembers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StaticMembersClient struct { Client *resourcemanager.Client } -func NewStaticMembersClientWithBaseURI(api environments.Api) (*StaticMembersClient, error) { +func NewStaticMembersClientWithBaseURI(api sdkEnv.Api) (*StaticMembersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "staticmembers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StaticMembersClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/subnets/client.go b/resource-manager/network/2023-04-01/subnets/client.go index 3efe55fa485..32af290d090 100644 --- a/resource-manager/network/2023-04-01/subnets/client.go +++ b/resource-manager/network/2023-04-01/subnets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SubnetsClient struct { Client *resourcemanager.Client } -func NewSubnetsClientWithBaseURI(api environments.Api) (*SubnetsClient, error) { +func NewSubnetsClientWithBaseURI(api sdkEnv.Api) (*SubnetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "subnets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SubnetsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/trafficanalytics/client.go b/resource-manager/network/2023-04-01/trafficanalytics/client.go index 3dd5fd4cf96..a316e21d1fc 100644 --- a/resource-manager/network/2023-04-01/trafficanalytics/client.go +++ b/resource-manager/network/2023-04-01/trafficanalytics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TrafficAnalyticsClient struct { Client *resourcemanager.Client } -func NewTrafficAnalyticsClientWithBaseURI(api environments.Api) (*TrafficAnalyticsClient, error) { +func NewTrafficAnalyticsClientWithBaseURI(api sdkEnv.Api) (*TrafficAnalyticsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "trafficanalytics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TrafficAnalyticsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/usages/client.go b/resource-manager/network/2023-04-01/usages/client.go index 99b2625224d..9319b1a1f51 100644 --- a/resource-manager/network/2023-04-01/usages/client.go +++ b/resource-manager/network/2023-04-01/usages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsagesClient struct { Client *resourcemanager.Client } -func NewUsagesClientWithBaseURI(api environments.Api) (*UsagesClient, error) { +func NewUsagesClientWithBaseURI(api sdkEnv.Api) (*UsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsagesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/vipswap/client.go b/resource-manager/network/2023-04-01/vipswap/client.go index 1f634dd13c3..3d9df26fde2 100644 --- a/resource-manager/network/2023-04-01/vipswap/client.go +++ b/resource-manager/network/2023-04-01/vipswap/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VipSwapClient struct { Client *resourcemanager.Client } -func NewVipSwapClientWithBaseURI(api environments.Api) (*VipSwapClient, error) { +func NewVipSwapClientWithBaseURI(api sdkEnv.Api) (*VipSwapClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vipswap", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VipSwapClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/virtualappliancesites/client.go b/resource-manager/network/2023-04-01/virtualappliancesites/client.go index 32de5368a81..ffac4b46d23 100644 --- a/resource-manager/network/2023-04-01/virtualappliancesites/client.go +++ b/resource-manager/network/2023-04-01/virtualappliancesites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualApplianceSitesClient struct { Client *resourcemanager.Client } -func NewVirtualApplianceSitesClientWithBaseURI(api environments.Api) (*VirtualApplianceSitesClient, error) { +func NewVirtualApplianceSitesClientWithBaseURI(api sdkEnv.Api) (*VirtualApplianceSitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualappliancesites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualApplianceSitesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/virtualapplianceskus/client.go b/resource-manager/network/2023-04-01/virtualapplianceskus/client.go index 63ec1eff1ea..b7e8336339e 100644 --- a/resource-manager/network/2023-04-01/virtualapplianceskus/client.go +++ b/resource-manager/network/2023-04-01/virtualapplianceskus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualApplianceSkusClient struct { Client *resourcemanager.Client } -func NewVirtualApplianceSkusClientWithBaseURI(api environments.Api) (*VirtualApplianceSkusClient, error) { +func NewVirtualApplianceSkusClientWithBaseURI(api sdkEnv.Api) (*VirtualApplianceSkusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualapplianceskus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualApplianceSkusClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/virtualnetworkgatewayconnections/client.go b/resource-manager/network/2023-04-01/virtualnetworkgatewayconnections/client.go index a2b5610883b..9c308e2a95d 100644 --- a/resource-manager/network/2023-04-01/virtualnetworkgatewayconnections/client.go +++ b/resource-manager/network/2023-04-01/virtualnetworkgatewayconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkGatewayConnectionsClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(api environments.Api) (*VirtualNetworkGatewayConnectionsClient, error) { +func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkGatewayConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworkgatewayconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkGatewayConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/virtualnetworkgateways/client.go b/resource-manager/network/2023-04-01/virtualnetworkgateways/client.go index c99ea430c0a..b63032cff60 100644 --- a/resource-manager/network/2023-04-01/virtualnetworkgateways/client.go +++ b/resource-manager/network/2023-04-01/virtualnetworkgateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkGatewaysClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkGatewaysClientWithBaseURI(api environments.Api) (*VirtualNetworkGatewaysClient, error) { +func NewVirtualNetworkGatewaysClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworkgateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/virtualnetworkpeerings/client.go b/resource-manager/network/2023-04-01/virtualnetworkpeerings/client.go index becd896b345..87afc671995 100644 --- a/resource-manager/network/2023-04-01/virtualnetworkpeerings/client.go +++ b/resource-manager/network/2023-04-01/virtualnetworkpeerings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkPeeringsClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkPeeringsClientWithBaseURI(api environments.Api) (*VirtualNetworkPeeringsClient, error) { +func NewVirtualNetworkPeeringsClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkPeeringsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworkpeerings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkPeeringsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/virtualnetworks/client.go b/resource-manager/network/2023-04-01/virtualnetworks/client.go index c274c9c87de..5c9e7698630 100644 --- a/resource-manager/network/2023-04-01/virtualnetworks/client.go +++ b/resource-manager/network/2023-04-01/virtualnetworks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworksClient struct { Client *resourcemanager.Client } -func NewVirtualNetworksClientWithBaseURI(api environments.Api) (*VirtualNetworksClient, error) { +func NewVirtualNetworksClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworksClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/virtualnetworktap/client.go b/resource-manager/network/2023-04-01/virtualnetworktap/client.go index ed44f57de37..124497a5075 100644 --- a/resource-manager/network/2023-04-01/virtualnetworktap/client.go +++ b/resource-manager/network/2023-04-01/virtualnetworktap/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkTapClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkTapClientWithBaseURI(api environments.Api) (*VirtualNetworkTapClient, error) { +func NewVirtualNetworkTapClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkTapClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworktap", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkTapClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/virtualnetworktaps/client.go b/resource-manager/network/2023-04-01/virtualnetworktaps/client.go index ef1af892cdc..674f3e8401f 100644 --- a/resource-manager/network/2023-04-01/virtualnetworktaps/client.go +++ b/resource-manager/network/2023-04-01/virtualnetworktaps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkTapsClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkTapsClientWithBaseURI(api environments.Api) (*VirtualNetworkTapsClient, error) { +func NewVirtualNetworkTapsClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkTapsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworktaps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkTapsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/virtualrouterpeerings/client.go b/resource-manager/network/2023-04-01/virtualrouterpeerings/client.go index 06dbd163078..3ffff04a284 100644 --- a/resource-manager/network/2023-04-01/virtualrouterpeerings/client.go +++ b/resource-manager/network/2023-04-01/virtualrouterpeerings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualRouterPeeringsClient struct { Client *resourcemanager.Client } -func NewVirtualRouterPeeringsClientWithBaseURI(api environments.Api) (*VirtualRouterPeeringsClient, error) { +func NewVirtualRouterPeeringsClientWithBaseURI(api sdkEnv.Api) (*VirtualRouterPeeringsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualrouterpeerings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualRouterPeeringsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/virtualrouters/client.go b/resource-manager/network/2023-04-01/virtualrouters/client.go index 0c0a8fa4887..c7474c28200 100644 --- a/resource-manager/network/2023-04-01/virtualrouters/client.go +++ b/resource-manager/network/2023-04-01/virtualrouters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualRoutersClient struct { Client *resourcemanager.Client } -func NewVirtualRoutersClientWithBaseURI(api environments.Api) (*VirtualRoutersClient, error) { +func NewVirtualRoutersClientWithBaseURI(api sdkEnv.Api) (*VirtualRoutersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualrouters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualRoutersClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/virtualwans/client.go b/resource-manager/network/2023-04-01/virtualwans/client.go index ae4ecc81d13..b91e1d00910 100644 --- a/resource-manager/network/2023-04-01/virtualwans/client.go +++ b/resource-manager/network/2023-04-01/virtualwans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualWANsClient struct { Client *resourcemanager.Client } -func NewVirtualWANsClientWithBaseURI(api environments.Api) (*VirtualWANsClient, error) { +func NewVirtualWANsClientWithBaseURI(api sdkEnv.Api) (*VirtualWANsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualwans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualWANsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/vmsspublicipaddresses/client.go b/resource-manager/network/2023-04-01/vmsspublicipaddresses/client.go index f563b8df586..8030bbc3083 100644 --- a/resource-manager/network/2023-04-01/vmsspublicipaddresses/client.go +++ b/resource-manager/network/2023-04-01/vmsspublicipaddresses/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VMSSPublicIPAddressesClient struct { Client *resourcemanager.Client } -func NewVMSSPublicIPAddressesClientWithBaseURI(api environments.Api) (*VMSSPublicIPAddressesClient, error) { +func NewVMSSPublicIPAddressesClientWithBaseURI(api sdkEnv.Api) (*VMSSPublicIPAddressesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vmsspublicipaddresses", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VMSSPublicIPAddressesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/vpngateways/client.go b/resource-manager/network/2023-04-01/vpngateways/client.go index 08ab0ce47db..21565c92be3 100644 --- a/resource-manager/network/2023-04-01/vpngateways/client.go +++ b/resource-manager/network/2023-04-01/vpngateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VpnGatewaysClient struct { Client *resourcemanager.Client } -func NewVpnGatewaysClientWithBaseURI(api environments.Api) (*VpnGatewaysClient, error) { +func NewVpnGatewaysClientWithBaseURI(api sdkEnv.Api) (*VpnGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vpngateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VpnGatewaysClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/vpnlinkconnections/client.go b/resource-manager/network/2023-04-01/vpnlinkconnections/client.go index d5db633fa84..63cc8936312 100644 --- a/resource-manager/network/2023-04-01/vpnlinkconnections/client.go +++ b/resource-manager/network/2023-04-01/vpnlinkconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VpnLinkConnectionsClient struct { Client *resourcemanager.Client } -func NewVpnLinkConnectionsClientWithBaseURI(api environments.Api) (*VpnLinkConnectionsClient, error) { +func NewVpnLinkConnectionsClientWithBaseURI(api sdkEnv.Api) (*VpnLinkConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vpnlinkconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VpnLinkConnectionsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/vpnserverconfigurations/client.go b/resource-manager/network/2023-04-01/vpnserverconfigurations/client.go index 722cdb26573..eecdd36d98c 100644 --- a/resource-manager/network/2023-04-01/vpnserverconfigurations/client.go +++ b/resource-manager/network/2023-04-01/vpnserverconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VpnServerConfigurationsClient struct { Client *resourcemanager.Client } -func NewVpnServerConfigurationsClientWithBaseURI(api environments.Api) (*VpnServerConfigurationsClient, error) { +func NewVpnServerConfigurationsClientWithBaseURI(api sdkEnv.Api) (*VpnServerConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vpnserverconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VpnServerConfigurationsClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/vpnsites/client.go b/resource-manager/network/2023-04-01/vpnsites/client.go index d5f3209b45d..377e00d651b 100644 --- a/resource-manager/network/2023-04-01/vpnsites/client.go +++ b/resource-manager/network/2023-04-01/vpnsites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VpnSitesClient struct { Client *resourcemanager.Client } -func NewVpnSitesClientWithBaseURI(api environments.Api) (*VpnSitesClient, error) { +func NewVpnSitesClientWithBaseURI(api sdkEnv.Api) (*VpnSitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "vpnsites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VpnSitesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/webapplicationfirewallpolicies/client.go b/resource-manager/network/2023-04-01/webapplicationfirewallpolicies/client.go index 10b02bcdf85..7bf4ccb52fa 100644 --- a/resource-manager/network/2023-04-01/webapplicationfirewallpolicies/client.go +++ b/resource-manager/network/2023-04-01/webapplicationfirewallpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WebApplicationFirewallPoliciesClient struct { Client *resourcemanager.Client } -func NewWebApplicationFirewallPoliciesClientWithBaseURI(api environments.Api) (*WebApplicationFirewallPoliciesClient, error) { +func NewWebApplicationFirewallPoliciesClientWithBaseURI(api sdkEnv.Api) (*WebApplicationFirewallPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "webapplicationfirewallpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WebApplicationFirewallPoliciesClient: %+v", err) diff --git a/resource-manager/network/2023-04-01/webcategories/client.go b/resource-manager/network/2023-04-01/webcategories/client.go index 7d213fbca46..69ffe2d802c 100644 --- a/resource-manager/network/2023-04-01/webcategories/client.go +++ b/resource-manager/network/2023-04-01/webcategories/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WebCategoriesClient struct { Client *resourcemanager.Client } -func NewWebCategoriesClientWithBaseURI(api environments.Api) (*WebCategoriesClient, error) { +func NewWebCategoriesClientWithBaseURI(api sdkEnv.Api) (*WebCategoriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "webcategories", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WebCategoriesClient: %+v", err) diff --git a/resource-manager/networkfunction/2022-08-01/azuretrafficcollectors/client.go b/resource-manager/networkfunction/2022-08-01/azuretrafficcollectors/client.go index 2d2ddd610b9..e7a64161fd8 100644 --- a/resource-manager/networkfunction/2022-08-01/azuretrafficcollectors/client.go +++ b/resource-manager/networkfunction/2022-08-01/azuretrafficcollectors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureTrafficCollectorsClient struct { Client *resourcemanager.Client } -func NewAzureTrafficCollectorsClientWithBaseURI(api environments.Api) (*AzureTrafficCollectorsClient, error) { +func NewAzureTrafficCollectorsClientWithBaseURI(api sdkEnv.Api) (*AzureTrafficCollectorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azuretrafficcollectors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureTrafficCollectorsClient: %+v", err) diff --git a/resource-manager/networkfunction/2022-08-01/client.go b/resource-manager/networkfunction/2022-08-01/client.go index da3ed32a4e1..6c3680e80b7 100644 --- a/resource-manager/networkfunction/2022-08-01/client.go +++ b/resource-manager/networkfunction/2022-08-01/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/networkfunction/2022-08-01/azuretrafficcollectors" "github.com/hashicorp/go-azure-sdk/resource-manager/networkfunction/2022-08-01/collectorpolicies" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { CollectorPolicies *collectorpolicies.CollectorPoliciesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { azureTrafficCollectorsClient, err := azuretrafficcollectors.NewAzureTrafficCollectorsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AzureTrafficCollectors client: %+v", err) diff --git a/resource-manager/networkfunction/2022-08-01/collectorpolicies/client.go b/resource-manager/networkfunction/2022-08-01/collectorpolicies/client.go index e1ef7a324ad..ce52eba32bf 100644 --- a/resource-manager/networkfunction/2022-08-01/collectorpolicies/client.go +++ b/resource-manager/networkfunction/2022-08-01/collectorpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CollectorPoliciesClient struct { Client *resourcemanager.Client } -func NewCollectorPoliciesClientWithBaseURI(api environments.Api) (*CollectorPoliciesClient, error) { +func NewCollectorPoliciesClientWithBaseURI(api sdkEnv.Api) (*CollectorPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "collectorpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CollectorPoliciesClient: %+v", err) diff --git a/resource-manager/networkfunction/2022-11-01/azuretrafficcollectors/client.go b/resource-manager/networkfunction/2022-11-01/azuretrafficcollectors/client.go index 2d2ddd610b9..e7a64161fd8 100644 --- a/resource-manager/networkfunction/2022-11-01/azuretrafficcollectors/client.go +++ b/resource-manager/networkfunction/2022-11-01/azuretrafficcollectors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AzureTrafficCollectorsClient struct { Client *resourcemanager.Client } -func NewAzureTrafficCollectorsClientWithBaseURI(api environments.Api) (*AzureTrafficCollectorsClient, error) { +func NewAzureTrafficCollectorsClientWithBaseURI(api sdkEnv.Api) (*AzureTrafficCollectorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "azuretrafficcollectors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AzureTrafficCollectorsClient: %+v", err) diff --git a/resource-manager/networkfunction/2022-11-01/client.go b/resource-manager/networkfunction/2022-11-01/client.go index ef734936c9e..d3c3bbc9222 100644 --- a/resource-manager/networkfunction/2022-11-01/client.go +++ b/resource-manager/networkfunction/2022-11-01/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/networkfunction/2022-11-01/azuretrafficcollectors" "github.com/hashicorp/go-azure-sdk/resource-manager/networkfunction/2022-11-01/collectorpolicies" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { CollectorPolicies *collectorpolicies.CollectorPoliciesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { azureTrafficCollectorsClient, err := azuretrafficcollectors.NewAzureTrafficCollectorsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AzureTrafficCollectors client: %+v", err) diff --git a/resource-manager/networkfunction/2022-11-01/collectorpolicies/client.go b/resource-manager/networkfunction/2022-11-01/collectorpolicies/client.go index e1ef7a324ad..ce52eba32bf 100644 --- a/resource-manager/networkfunction/2022-11-01/collectorpolicies/client.go +++ b/resource-manager/networkfunction/2022-11-01/collectorpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CollectorPoliciesClient struct { Client *resourcemanager.Client } -func NewCollectorPoliciesClientWithBaseURI(api environments.Api) (*CollectorPoliciesClient, error) { +func NewCollectorPoliciesClientWithBaseURI(api sdkEnv.Api) (*CollectorPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "collectorpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CollectorPoliciesClient: %+v", err) diff --git a/resource-manager/newrelic/2022-07-01/accounts/client.go b/resource-manager/newrelic/2022-07-01/accounts/client.go index c227130d6c6..443dca551fe 100644 --- a/resource-manager/newrelic/2022-07-01/accounts/client.go +++ b/resource-manager/newrelic/2022-07-01/accounts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccountsClient struct { Client *resourcemanager.Client } -func NewAccountsClientWithBaseURI(api environments.Api) (*AccountsClient, error) { +func NewAccountsClientWithBaseURI(api sdkEnv.Api) (*AccountsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "accounts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccountsClient: %+v", err) diff --git a/resource-manager/newrelic/2022-07-01/client.go b/resource-manager/newrelic/2022-07-01/client.go index 1395a53da6e..baa1f434f0e 100644 --- a/resource-manager/newrelic/2022-07-01/client.go +++ b/resource-manager/newrelic/2022-07-01/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/newrelic/2022-07-01/plan" "github.com/hashicorp/go-azure-sdk/resource-manager/newrelic/2022-07-01/tagrules" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { TagRules *tagrules.TagRulesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { accountsClient, err := accounts.NewAccountsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Accounts client: %+v", err) diff --git a/resource-manager/newrelic/2022-07-01/monitors/client.go b/resource-manager/newrelic/2022-07-01/monitors/client.go index 43af4ffbb85..f7c2a7b5509 100644 --- a/resource-manager/newrelic/2022-07-01/monitors/client.go +++ b/resource-manager/newrelic/2022-07-01/monitors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitorsClient struct { Client *resourcemanager.Client } -func NewMonitorsClientWithBaseURI(api environments.Api) (*MonitorsClient, error) { +func NewMonitorsClientWithBaseURI(api sdkEnv.Api) (*MonitorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitorsClient: %+v", err) diff --git a/resource-manager/newrelic/2022-07-01/organizations/client.go b/resource-manager/newrelic/2022-07-01/organizations/client.go index 2854bb6e257..1c11cad5d5e 100644 --- a/resource-manager/newrelic/2022-07-01/organizations/client.go +++ b/resource-manager/newrelic/2022-07-01/organizations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OrganizationsClient struct { Client *resourcemanager.Client } -func NewOrganizationsClientWithBaseURI(api environments.Api) (*OrganizationsClient, error) { +func NewOrganizationsClientWithBaseURI(api sdkEnv.Api) (*OrganizationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "organizations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OrganizationsClient: %+v", err) diff --git a/resource-manager/newrelic/2022-07-01/plan/client.go b/resource-manager/newrelic/2022-07-01/plan/client.go index 6b661853f7d..2538109e6ee 100644 --- a/resource-manager/newrelic/2022-07-01/plan/client.go +++ b/resource-manager/newrelic/2022-07-01/plan/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PlanClient struct { Client *resourcemanager.Client } -func NewPlanClientWithBaseURI(api environments.Api) (*PlanClient, error) { +func NewPlanClientWithBaseURI(api sdkEnv.Api) (*PlanClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "plan", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PlanClient: %+v", err) diff --git a/resource-manager/newrelic/2022-07-01/tagrules/client.go b/resource-manager/newrelic/2022-07-01/tagrules/client.go index 6269a50dd72..ea7b43d3df4 100644 --- a/resource-manager/newrelic/2022-07-01/tagrules/client.go +++ b/resource-manager/newrelic/2022-07-01/tagrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TagRulesClient struct { Client *resourcemanager.Client } -func NewTagRulesClientWithBaseURI(api environments.Api) (*TagRulesClient, error) { +func NewTagRulesClientWithBaseURI(api sdkEnv.Api) (*TagRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tagrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TagRulesClient: %+v", err) diff --git a/resource-manager/nginx/2022-08-01/client.go b/resource-manager/nginx/2022-08-01/client.go index 8b4f95dfc4c..652a17f7c25 100644 --- a/resource-manager/nginx/2022-08-01/client.go +++ b/resource-manager/nginx/2022-08-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration" "github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxdeployment" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { NginxDeployment *nginxdeployment.NginxDeploymentClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { nginxCertificateClient, err := nginxcertificate.NewNginxCertificateClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building NginxCertificate client: %+v", err) diff --git a/resource-manager/nginx/2022-08-01/nginxcertificate/client.go b/resource-manager/nginx/2022-08-01/nginxcertificate/client.go index 1b4c0beb1ff..5563479f9e7 100644 --- a/resource-manager/nginx/2022-08-01/nginxcertificate/client.go +++ b/resource-manager/nginx/2022-08-01/nginxcertificate/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NginxCertificateClient struct { Client *resourcemanager.Client } -func NewNginxCertificateClientWithBaseURI(api environments.Api) (*NginxCertificateClient, error) { +func NewNginxCertificateClientWithBaseURI(api sdkEnv.Api) (*NginxCertificateClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "nginxcertificate", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NginxCertificateClient: %+v", err) diff --git a/resource-manager/nginx/2022-08-01/nginxconfiguration/client.go b/resource-manager/nginx/2022-08-01/nginxconfiguration/client.go index 987b4efbb67..d5b589b9990 100644 --- a/resource-manager/nginx/2022-08-01/nginxconfiguration/client.go +++ b/resource-manager/nginx/2022-08-01/nginxconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NginxConfigurationClient struct { Client *resourcemanager.Client } -func NewNginxConfigurationClientWithBaseURI(api environments.Api) (*NginxConfigurationClient, error) { +func NewNginxConfigurationClientWithBaseURI(api sdkEnv.Api) (*NginxConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "nginxconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NginxConfigurationClient: %+v", err) diff --git a/resource-manager/nginx/2022-08-01/nginxdeployment/client.go b/resource-manager/nginx/2022-08-01/nginxdeployment/client.go index 0f9226e7cc5..28c09449f89 100644 --- a/resource-manager/nginx/2022-08-01/nginxdeployment/client.go +++ b/resource-manager/nginx/2022-08-01/nginxdeployment/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NginxDeploymentClient struct { Client *resourcemanager.Client } -func NewNginxDeploymentClientWithBaseURI(api environments.Api) (*NginxDeploymentClient, error) { +func NewNginxDeploymentClientWithBaseURI(api sdkEnv.Api) (*NginxDeploymentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "nginxdeployment", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NginxDeploymentClient: %+v", err) diff --git a/resource-manager/notificationhubs/2017-04-01/client.go b/resource-manager/notificationhubs/2017-04-01/client.go index 71f3e5dd04d..6613b2744c7 100644 --- a/resource-manager/notificationhubs/2017-04-01/client.go +++ b/resource-manager/notificationhubs/2017-04-01/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces" "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { NotificationHubs *notificationhubs.NotificationHubsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { namespacesClient, err := namespaces.NewNamespacesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Namespaces client: %+v", err) diff --git a/resource-manager/notificationhubs/2017-04-01/namespaces/client.go b/resource-manager/notificationhubs/2017-04-01/namespaces/client.go index 6b0ae358115..a991037b3a6 100644 --- a/resource-manager/notificationhubs/2017-04-01/namespaces/client.go +++ b/resource-manager/notificationhubs/2017-04-01/namespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesClient struct { Client *resourcemanager.Client } -func NewNamespacesClientWithBaseURI(api environments.Api) (*NamespacesClient, error) { +func NewNamespacesClientWithBaseURI(api sdkEnv.Api) (*NamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesClient: %+v", err) diff --git a/resource-manager/notificationhubs/2017-04-01/notificationhubs/client.go b/resource-manager/notificationhubs/2017-04-01/notificationhubs/client.go index da71dec9f39..aeecae9a466 100644 --- a/resource-manager/notificationhubs/2017-04-01/notificationhubs/client.go +++ b/resource-manager/notificationhubs/2017-04-01/notificationhubs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NotificationHubsClient struct { Client *resourcemanager.Client } -func NewNotificationHubsClientWithBaseURI(api environments.Api) (*NotificationHubsClient, error) { +func NewNotificationHubsClientWithBaseURI(api sdkEnv.Api) (*NotificationHubsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "notificationhubs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NotificationHubsClient: %+v", err) diff --git a/resource-manager/orbital/2022-11-01/client.go b/resource-manager/orbital/2022-11-01/client.go index 96c203b4eef..08164474bbd 100644 --- a/resource-manager/orbital/2022-11-01/client.go +++ b/resource-manager/orbital/2022-11-01/client.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/groundstation" "github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/spacecraft" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -21,7 +21,7 @@ type Client struct { Spacecraft *spacecraft.SpacecraftClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { contactClient, err := contact.NewContactClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Contact client: %+v", err) diff --git a/resource-manager/orbital/2022-11-01/contact/client.go b/resource-manager/orbital/2022-11-01/contact/client.go index 1330f436ede..d5a65c213f9 100644 --- a/resource-manager/orbital/2022-11-01/contact/client.go +++ b/resource-manager/orbital/2022-11-01/contact/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ContactClient struct { Client *resourcemanager.Client } -func NewContactClientWithBaseURI(api environments.Api) (*ContactClient, error) { +func NewContactClientWithBaseURI(api sdkEnv.Api) (*ContactClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "contact", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ContactClient: %+v", err) diff --git a/resource-manager/orbital/2022-11-01/contactprofile/client.go b/resource-manager/orbital/2022-11-01/contactprofile/client.go index 08576043ed3..134dedd642e 100644 --- a/resource-manager/orbital/2022-11-01/contactprofile/client.go +++ b/resource-manager/orbital/2022-11-01/contactprofile/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ContactProfileClient struct { Client *resourcemanager.Client } -func NewContactProfileClientWithBaseURI(api environments.Api) (*ContactProfileClient, error) { +func NewContactProfileClientWithBaseURI(api sdkEnv.Api) (*ContactProfileClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "contactprofile", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ContactProfileClient: %+v", err) diff --git a/resource-manager/orbital/2022-11-01/groundstation/client.go b/resource-manager/orbital/2022-11-01/groundstation/client.go index d025dd7c309..f2cc0affc90 100644 --- a/resource-manager/orbital/2022-11-01/groundstation/client.go +++ b/resource-manager/orbital/2022-11-01/groundstation/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GroundStationClient struct { Client *resourcemanager.Client } -func NewGroundStationClientWithBaseURI(api environments.Api) (*GroundStationClient, error) { +func NewGroundStationClientWithBaseURI(api sdkEnv.Api) (*GroundStationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "groundstation", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GroundStationClient: %+v", err) diff --git a/resource-manager/orbital/2022-11-01/spacecraft/client.go b/resource-manager/orbital/2022-11-01/spacecraft/client.go index 555471a9a8b..560e69dc637 100644 --- a/resource-manager/orbital/2022-11-01/spacecraft/client.go +++ b/resource-manager/orbital/2022-11-01/spacecraft/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SpacecraftClient struct { Client *resourcemanager.Client } -func NewSpacecraftClientWithBaseURI(api environments.Api) (*SpacecraftClient, error) { +func NewSpacecraftClientWithBaseURI(api sdkEnv.Api) (*SpacecraftClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "spacecraft", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SpacecraftClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/client.go b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/client.go index 8ab7c073c36..105adfce69e 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CertificateObjectGlobalRulestackClient struct { Client *resourcemanager.Client } -func NewCertificateObjectGlobalRulestackClientWithBaseURI(api environments.Api) (*CertificateObjectGlobalRulestackClient, error) { +func NewCertificateObjectGlobalRulestackClientWithBaseURI(api sdkEnv.Api) (*CertificateObjectGlobalRulestackClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "certificateobjectglobalrulestack", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CertificateObjectGlobalRulestackClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/client.go b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/client.go index 38616d3cdf5..43e9cea70ff 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CertificateObjectLocalRulestackClient struct { Client *resourcemanager.Client } -func NewCertificateObjectLocalRulestackClientWithBaseURI(api environments.Api) (*CertificateObjectLocalRulestackClient, error) { +func NewCertificateObjectLocalRulestackClientWithBaseURI(api sdkEnv.Api) (*CertificateObjectLocalRulestackClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "certificateobjectlocalrulestack", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CertificateObjectLocalRulestackClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/client.go b/resource-manager/paloaltonetworks/2022-08-29/client.go index 52d2a9c2b82..5cb647d561b 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/client.go @@ -20,7 +20,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack" "github.com/hashicorp/go-azure-sdk/resource-manager/paloaltonetworks/2022-08-29/prerules" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -39,7 +39,7 @@ type Client struct { PrefixListLocalRulestack *prefixlistlocalrulestack.PrefixListLocalRulestackClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { certificateObjectGlobalRulestackClient, err := certificateobjectglobalrulestack.NewCertificateObjectGlobalRulestackClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CertificateObjectGlobalRulestack client: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/firewalls/client.go b/resource-manager/paloaltonetworks/2022-08-29/firewalls/client.go index 61b171b0ac0..e7958ec8909 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/firewalls/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/firewalls/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallsClient struct { Client *resourcemanager.Client } -func NewFirewallsClientWithBaseURI(api environments.Api) (*FirewallsClient, error) { +func NewFirewallsClientWithBaseURI(api sdkEnv.Api) (*FirewallsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewalls", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallsClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/firewallstatus/client.go b/resource-manager/paloaltonetworks/2022-08-29/firewallstatus/client.go index 65f5955e8dc..151abe8e5e3 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/firewallstatus/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/firewallstatus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallStatusClient struct { Client *resourcemanager.Client } -func NewFirewallStatusClientWithBaseURI(api environments.Api) (*FirewallStatusClient, error) { +func NewFirewallStatusClientWithBaseURI(api sdkEnv.Api) (*FirewallStatusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallstatus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallStatusClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/client.go b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/client.go index 1327f3aad39..c749068fb17 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FqdnListGlobalRulestackClient struct { Client *resourcemanager.Client } -func NewFqdnListGlobalRulestackClientWithBaseURI(api environments.Api) (*FqdnListGlobalRulestackClient, error) { +func NewFqdnListGlobalRulestackClientWithBaseURI(api sdkEnv.Api) (*FqdnListGlobalRulestackClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fqdnlistglobalrulestack", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FqdnListGlobalRulestackClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/client.go b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/client.go index d0eddd311d7..7e7dcb2a099 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FqdnListLocalRulestackClient struct { Client *resourcemanager.Client } -func NewFqdnListLocalRulestackClientWithBaseURI(api environments.Api) (*FqdnListLocalRulestackClient, error) { +func NewFqdnListLocalRulestackClientWithBaseURI(api sdkEnv.Api) (*FqdnListLocalRulestackClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "fqdnlistlocalrulestack", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FqdnListLocalRulestackClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/globalrulestack/client.go b/resource-manager/paloaltonetworks/2022-08-29/globalrulestack/client.go index 14f62e648f8..e9f742148a8 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/globalrulestack/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/globalrulestack/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GlobalRulestackClient struct { Client *resourcemanager.Client } -func NewGlobalRulestackClientWithBaseURI(api environments.Api) (*GlobalRulestackClient, error) { +func NewGlobalRulestackClientWithBaseURI(api sdkEnv.Api) (*GlobalRulestackClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "globalrulestack", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GlobalRulestackClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/localrules/client.go b/resource-manager/paloaltonetworks/2022-08-29/localrules/client.go index 6852640c5fe..bd75e877b6a 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/localrules/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/localrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocalRulesClient struct { Client *resourcemanager.Client } -func NewLocalRulesClientWithBaseURI(api environments.Api) (*LocalRulesClient, error) { +func NewLocalRulesClientWithBaseURI(api sdkEnv.Api) (*LocalRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "localrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocalRulesClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/localrulestacks/client.go b/resource-manager/paloaltonetworks/2022-08-29/localrulestacks/client.go index 33e8e61afde..46687b70628 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/localrulestacks/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/localrulestacks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocalRulestacksClient struct { Client *resourcemanager.Client } -func NewLocalRulestacksClientWithBaseURI(api environments.Api) (*LocalRulestacksClient, error) { +func NewLocalRulestacksClientWithBaseURI(api sdkEnv.Api) (*LocalRulestacksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "localrulestacks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocalRulestacksClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/postrules/client.go b/resource-manager/paloaltonetworks/2022-08-29/postrules/client.go index a75ccccd24d..fdb7364a88c 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/postrules/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/postrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PostRulesClient struct { Client *resourcemanager.Client } -func NewPostRulesClientWithBaseURI(api environments.Api) (*PostRulesClient, error) { +func NewPostRulesClientWithBaseURI(api sdkEnv.Api) (*PostRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "postrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PostRulesClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/client.go b/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/client.go index 979010c37d3..abc1a5f7dee 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrefixListGlobalRulestackClient struct { Client *resourcemanager.Client } -func NewPrefixListGlobalRulestackClientWithBaseURI(api environments.Api) (*PrefixListGlobalRulestackClient, error) { +func NewPrefixListGlobalRulestackClientWithBaseURI(api sdkEnv.Api) (*PrefixListGlobalRulestackClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "prefixlistglobalrulestack", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrefixListGlobalRulestackClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/client.go b/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/client.go index 27fa5c82e6d..79bf271ea7e 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrefixListLocalRulestackClient struct { Client *resourcemanager.Client } -func NewPrefixListLocalRulestackClientWithBaseURI(api environments.Api) (*PrefixListLocalRulestackClient, error) { +func NewPrefixListLocalRulestackClientWithBaseURI(api sdkEnv.Api) (*PrefixListLocalRulestackClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "prefixlistlocalrulestack", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrefixListLocalRulestackClient: %+v", err) diff --git a/resource-manager/paloaltonetworks/2022-08-29/prerules/client.go b/resource-manager/paloaltonetworks/2022-08-29/prerules/client.go index 153397f94bb..11d5a5c7247 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/prerules/client.go +++ b/resource-manager/paloaltonetworks/2022-08-29/prerules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PreRulesClient struct { Client *resourcemanager.Client } -func NewPreRulesClientWithBaseURI(api environments.Api) (*PreRulesClient, error) { +func NewPreRulesClientWithBaseURI(api sdkEnv.Api) (*PreRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "prerules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PreRulesClient: %+v", err) diff --git a/resource-manager/portal/2019-01-01-preview/client.go b/resource-manager/portal/2019-01-01-preview/client.go index e820f11e492..ccf7e4aec8d 100644 --- a/resource-manager/portal/2019-01-01-preview/client.go +++ b/resource-manager/portal/2019-01-01-preview/client.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard" "github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -17,7 +17,7 @@ type Client struct { TenantConfiguration *tenantconfiguration.TenantConfigurationClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { dashboardClient, err := dashboard.NewDashboardClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Dashboard client: %+v", err) diff --git a/resource-manager/portal/2019-01-01-preview/dashboard/client.go b/resource-manager/portal/2019-01-01-preview/dashboard/client.go index 604308d6cbb..89e1659fa31 100644 --- a/resource-manager/portal/2019-01-01-preview/dashboard/client.go +++ b/resource-manager/portal/2019-01-01-preview/dashboard/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DashboardClient struct { Client *resourcemanager.Client } -func NewDashboardClientWithBaseURI(api environments.Api) (*DashboardClient, error) { +func NewDashboardClientWithBaseURI(api sdkEnv.Api) (*DashboardClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "dashboard", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DashboardClient: %+v", err) diff --git a/resource-manager/portal/2019-01-01-preview/tenantconfiguration/client.go b/resource-manager/portal/2019-01-01-preview/tenantconfiguration/client.go index 30299aa4773..1c9a2f1304b 100644 --- a/resource-manager/portal/2019-01-01-preview/tenantconfiguration/client.go +++ b/resource-manager/portal/2019-01-01-preview/tenantconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TenantConfigurationClient struct { Client *resourcemanager.Client } -func NewTenantConfigurationClientWithBaseURI(api environments.Api) (*TenantConfigurationClient, error) { +func NewTenantConfigurationClientWithBaseURI(api sdkEnv.Api) (*TenantConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tenantconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TenantConfigurationClient: %+v", err) diff --git a/resource-manager/powerbidedicated/2021-01-01/autoscalevcores/client.go b/resource-manager/powerbidedicated/2021-01-01/autoscalevcores/client.go index 295f4a2ad2e..286994f8177 100644 --- a/resource-manager/powerbidedicated/2021-01-01/autoscalevcores/client.go +++ b/resource-manager/powerbidedicated/2021-01-01/autoscalevcores/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AutoScaleVCoresClient struct { Client *resourcemanager.Client } -func NewAutoScaleVCoresClientWithBaseURI(api environments.Api) (*AutoScaleVCoresClient, error) { +func NewAutoScaleVCoresClientWithBaseURI(api sdkEnv.Api) (*AutoScaleVCoresClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "autoscalevcores", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AutoScaleVCoresClient: %+v", err) diff --git a/resource-manager/powerbidedicated/2021-01-01/capacities/client.go b/resource-manager/powerbidedicated/2021-01-01/capacities/client.go index c78d8757822..447d3316605 100644 --- a/resource-manager/powerbidedicated/2021-01-01/capacities/client.go +++ b/resource-manager/powerbidedicated/2021-01-01/capacities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CapacitiesClient struct { Client *resourcemanager.Client } -func NewCapacitiesClientWithBaseURI(api environments.Api) (*CapacitiesClient, error) { +func NewCapacitiesClientWithBaseURI(api sdkEnv.Api) (*CapacitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "capacities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CapacitiesClient: %+v", err) diff --git a/resource-manager/powerbidedicated/2021-01-01/client.go b/resource-manager/powerbidedicated/2021-01-01/client.go index 97f0925513e..192405ee23f 100644 --- a/resource-manager/powerbidedicated/2021-01-01/client.go +++ b/resource-manager/powerbidedicated/2021-01-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities" "github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/powerbidedicated" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { PowerBIDedicated *powerbidedicated.PowerBIDedicatedClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { autoScaleVCoresClient, err := autoscalevcores.NewAutoScaleVCoresClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AutoScaleVCores client: %+v", err) diff --git a/resource-manager/powerbidedicated/2021-01-01/powerbidedicated/client.go b/resource-manager/powerbidedicated/2021-01-01/powerbidedicated/client.go index b49577e57a6..414930f57a2 100644 --- a/resource-manager/powerbidedicated/2021-01-01/powerbidedicated/client.go +++ b/resource-manager/powerbidedicated/2021-01-01/powerbidedicated/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PowerBIDedicatedClient struct { Client *resourcemanager.Client } -func NewPowerBIDedicatedClientWithBaseURI(api environments.Api) (*PowerBIDedicatedClient, error) { +func NewPowerBIDedicatedClientWithBaseURI(api sdkEnv.Api) (*PowerBIDedicatedClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "powerbidedicated", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PowerBIDedicatedClient: %+v", err) diff --git a/resource-manager/privatedns/2020-06-01/client.go b/resource-manager/privatedns/2020-06-01/client.go index 392ac0c7b11..c11a1dfb772 100644 --- a/resource-manager/privatedns/2020-06-01/client.go +++ b/resource-manager/privatedns/2020-06-01/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2020-06-01/recordsets" "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2020-06-01/virtualnetworklinks" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { VirtualNetworkLinks *virtualnetworklinks.VirtualNetworkLinksClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { privateZonesClient, err := privatezones.NewPrivateZonesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building PrivateZones client: %+v", err) diff --git a/resource-manager/privatedns/2020-06-01/privatezones/client.go b/resource-manager/privatedns/2020-06-01/privatezones/client.go index bd67016d31b..54a91f45f05 100644 --- a/resource-manager/privatedns/2020-06-01/privatezones/client.go +++ b/resource-manager/privatedns/2020-06-01/privatezones/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateZonesClient struct { Client *resourcemanager.Client } -func NewPrivateZonesClientWithBaseURI(api environments.Api) (*PrivateZonesClient, error) { +func NewPrivateZonesClientWithBaseURI(api sdkEnv.Api) (*PrivateZonesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatezones", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateZonesClient: %+v", err) diff --git a/resource-manager/privatedns/2020-06-01/recordsets/client.go b/resource-manager/privatedns/2020-06-01/recordsets/client.go index 8b876af8dd1..c8523090534 100644 --- a/resource-manager/privatedns/2020-06-01/recordsets/client.go +++ b/resource-manager/privatedns/2020-06-01/recordsets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecordSetsClient struct { Client *resourcemanager.Client } -func NewRecordSetsClientWithBaseURI(api environments.Api) (*RecordSetsClient, error) { +func NewRecordSetsClientWithBaseURI(api sdkEnv.Api) (*RecordSetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recordsets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecordSetsClient: %+v", err) diff --git a/resource-manager/privatedns/2020-06-01/virtualnetworklinks/client.go b/resource-manager/privatedns/2020-06-01/virtualnetworklinks/client.go index c8954f679ae..4d56e5e3d42 100644 --- a/resource-manager/privatedns/2020-06-01/virtualnetworklinks/client.go +++ b/resource-manager/privatedns/2020-06-01/virtualnetworklinks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkLinksClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkLinksClientWithBaseURI(api environments.Api) (*VirtualNetworkLinksClient, error) { +func NewVirtualNetworkLinksClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkLinksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworklinks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkLinksClient: %+v", err) diff --git a/resource-manager/purview/2021-07-01/account/client.go b/resource-manager/purview/2021-07-01/account/client.go index 46dbdb7538b..b8941ccf64c 100644 --- a/resource-manager/purview/2021-07-01/account/client.go +++ b/resource-manager/purview/2021-07-01/account/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccountClient struct { Client *resourcemanager.Client } -func NewAccountClientWithBaseURI(api environments.Api) (*AccountClient, error) { +func NewAccountClientWithBaseURI(api sdkEnv.Api) (*AccountClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "account", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccountClient: %+v", err) diff --git a/resource-manager/purview/2021-07-01/client.go b/resource-manager/purview/2021-07-01/client.go index 79ed0a09ce9..b2de86677d6 100644 --- a/resource-manager/purview/2021-07-01/client.go +++ b/resource-manager/purview/2021-07-01/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privatelinkresource" "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/provider" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { Provider *provider.ProviderClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { accountClient, err := account.NewAccountClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Account client: %+v", err) diff --git a/resource-manager/purview/2021-07-01/defaultaccount/client.go b/resource-manager/purview/2021-07-01/defaultaccount/client.go index 300c0482164..f72a40d4294 100644 --- a/resource-manager/purview/2021-07-01/defaultaccount/client.go +++ b/resource-manager/purview/2021-07-01/defaultaccount/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DefaultAccountClient struct { Client *resourcemanager.Client } -func NewDefaultAccountClientWithBaseURI(api environments.Api) (*DefaultAccountClient, error) { +func NewDefaultAccountClientWithBaseURI(api sdkEnv.Api) (*DefaultAccountClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "defaultaccount", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DefaultAccountClient: %+v", err) diff --git a/resource-manager/purview/2021-07-01/privateendpointconnection/client.go b/resource-manager/purview/2021-07-01/privateendpointconnection/client.go index 35dcdf8567e..81fa9bc3329 100644 --- a/resource-manager/purview/2021-07-01/privateendpointconnection/client.go +++ b/resource-manager/purview/2021-07-01/privateendpointconnection/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionClient, error) { +func NewPrivateEndpointConnectionClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnection", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionClient: %+v", err) diff --git a/resource-manager/purview/2021-07-01/privatelinkresource/client.go b/resource-manager/purview/2021-07-01/privatelinkresource/client.go index 1caf7195e24..fc25864a1a8 100644 --- a/resource-manager/purview/2021-07-01/privatelinkresource/client.go +++ b/resource-manager/purview/2021-07-01/privatelinkresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourceClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourceClientWithBaseURI(api environments.Api) (*PrivateLinkResourceClient, error) { +func NewPrivateLinkResourceClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourceClient: %+v", err) diff --git a/resource-manager/purview/2021-07-01/provider/client.go b/resource-manager/purview/2021-07-01/provider/client.go index d4c5b5c24aa..1a2acfd5b12 100644 --- a/resource-manager/purview/2021-07-01/provider/client.go +++ b/resource-manager/purview/2021-07-01/provider/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProviderClient struct { Client *resourcemanager.Client } -func NewProviderClientWithBaseURI(api environments.Api) (*ProviderClient, error) { +func NewProviderClientWithBaseURI(api sdkEnv.Api) (*ProviderClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "provider", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProviderClient: %+v", err) diff --git a/resource-manager/purview/2021-12-01/account/client.go b/resource-manager/purview/2021-12-01/account/client.go index 46dbdb7538b..b8941ccf64c 100644 --- a/resource-manager/purview/2021-12-01/account/client.go +++ b/resource-manager/purview/2021-12-01/account/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AccountClient struct { Client *resourcemanager.Client } -func NewAccountClientWithBaseURI(api environments.Api) (*AccountClient, error) { +func NewAccountClientWithBaseURI(api sdkEnv.Api) (*AccountClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "account", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AccountClient: %+v", err) diff --git a/resource-manager/purview/2021-12-01/client.go b/resource-manager/purview/2021-12-01/client.go index 0319844a9b5..c38eaa13113 100644 --- a/resource-manager/purview/2021-12-01/client.go +++ b/resource-manager/purview/2021-12-01/client.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-12-01/provider" "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-12-01/usages" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -29,7 +29,7 @@ type Client struct { Usages *usages.UsagesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { accountClient, err := account.NewAccountClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Account client: %+v", err) diff --git a/resource-manager/purview/2021-12-01/defaultaccount/client.go b/resource-manager/purview/2021-12-01/defaultaccount/client.go index 300c0482164..f72a40d4294 100644 --- a/resource-manager/purview/2021-12-01/defaultaccount/client.go +++ b/resource-manager/purview/2021-12-01/defaultaccount/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DefaultAccountClient struct { Client *resourcemanager.Client } -func NewDefaultAccountClientWithBaseURI(api environments.Api) (*DefaultAccountClient, error) { +func NewDefaultAccountClientWithBaseURI(api sdkEnv.Api) (*DefaultAccountClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "defaultaccount", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DefaultAccountClient: %+v", err) diff --git a/resource-manager/purview/2021-12-01/feature/client.go b/resource-manager/purview/2021-12-01/feature/client.go index 7626a9f7d85..bb71259294f 100644 --- a/resource-manager/purview/2021-12-01/feature/client.go +++ b/resource-manager/purview/2021-12-01/feature/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FeatureClient struct { Client *resourcemanager.Client } -func NewFeatureClientWithBaseURI(api environments.Api) (*FeatureClient, error) { +func NewFeatureClientWithBaseURI(api sdkEnv.Api) (*FeatureClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "feature", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FeatureClient: %+v", err) diff --git a/resource-manager/purview/2021-12-01/kafkaconfiguration/client.go b/resource-manager/purview/2021-12-01/kafkaconfiguration/client.go index 40d1b958a90..58100dcbe0b 100644 --- a/resource-manager/purview/2021-12-01/kafkaconfiguration/client.go +++ b/resource-manager/purview/2021-12-01/kafkaconfiguration/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type KafkaConfigurationClient struct { Client *resourcemanager.Client } -func NewKafkaConfigurationClientWithBaseURI(api environments.Api) (*KafkaConfigurationClient, error) { +func NewKafkaConfigurationClientWithBaseURI(api sdkEnv.Api) (*KafkaConfigurationClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "kafkaconfiguration", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating KafkaConfigurationClient: %+v", err) diff --git a/resource-manager/purview/2021-12-01/privateendpointconnection/client.go b/resource-manager/purview/2021-12-01/privateendpointconnection/client.go index 35dcdf8567e..81fa9bc3329 100644 --- a/resource-manager/purview/2021-12-01/privateendpointconnection/client.go +++ b/resource-manager/purview/2021-12-01/privateendpointconnection/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionClient, error) { +func NewPrivateEndpointConnectionClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnection", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionClient: %+v", err) diff --git a/resource-manager/purview/2021-12-01/privatelinkresource/client.go b/resource-manager/purview/2021-12-01/privatelinkresource/client.go index 1caf7195e24..fc25864a1a8 100644 --- a/resource-manager/purview/2021-12-01/privatelinkresource/client.go +++ b/resource-manager/purview/2021-12-01/privatelinkresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourceClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourceClientWithBaseURI(api environments.Api) (*PrivateLinkResourceClient, error) { +func NewPrivateLinkResourceClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourceClient: %+v", err) diff --git a/resource-manager/purview/2021-12-01/provider/client.go b/resource-manager/purview/2021-12-01/provider/client.go index d4c5b5c24aa..1a2acfd5b12 100644 --- a/resource-manager/purview/2021-12-01/provider/client.go +++ b/resource-manager/purview/2021-12-01/provider/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProviderClient struct { Client *resourcemanager.Client } -func NewProviderClientWithBaseURI(api environments.Api) (*ProviderClient, error) { +func NewProviderClientWithBaseURI(api sdkEnv.Api) (*ProviderClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "provider", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProviderClient: %+v", err) diff --git a/resource-manager/purview/2021-12-01/usages/client.go b/resource-manager/purview/2021-12-01/usages/client.go index 99b2625224d..9319b1a1f51 100644 --- a/resource-manager/purview/2021-12-01/usages/client.go +++ b/resource-manager/purview/2021-12-01/usages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsagesClient struct { Client *resourcemanager.Client } -func NewUsagesClientWithBaseURI(api environments.Api) (*UsagesClient, error) { +func NewUsagesClientWithBaseURI(api sdkEnv.Api) (*UsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsagesClient: %+v", err) diff --git a/resource-manager/qumulostorage/2022-10-12/client.go b/resource-manager/qumulostorage/2022-10-12/client.go index e5d9e597eae..d41aac55cc4 100644 --- a/resource-manager/qumulostorage/2022-10-12/client.go +++ b/resource-manager/qumulostorage/2022-10-12/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/qumulostorage/2022-10-12/filesystems" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { FileSystems *filesystems.FileSystemsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { fileSystemsClient, err := filesystems.NewFileSystemsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building FileSystems client: %+v", err) diff --git a/resource-manager/qumulostorage/2022-10-12/filesystems/client.go b/resource-manager/qumulostorage/2022-10-12/filesystems/client.go index 720b40a983d..b282d129a00 100644 --- a/resource-manager/qumulostorage/2022-10-12/filesystems/client.go +++ b/resource-manager/qumulostorage/2022-10-12/filesystems/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FileSystemsClient struct { Client *resourcemanager.Client } -func NewFileSystemsClientWithBaseURI(api environments.Api) (*FileSystemsClient, error) { +func NewFileSystemsClientWithBaseURI(api sdkEnv.Api) (*FileSystemsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "filesystems", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FileSystemsClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2022-04-01/client.go b/resource-manager/redhatopenshift/2022-04-01/client.go index b8ae58509c7..bd5c5985f3c 100644 --- a/resource-manager/redhatopenshift/2022-04-01/client.go +++ b/resource-manager/redhatopenshift/2022-04-01/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2022-04-01/openshiftclusters" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { OpenShiftClusters *openshiftclusters.OpenShiftClustersClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { openShiftClustersClient, err := openshiftclusters.NewOpenShiftClustersClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building OpenShiftClusters client: %+v", err) diff --git a/resource-manager/redhatopenshift/2022-04-01/openshiftclusters/client.go b/resource-manager/redhatopenshift/2022-04-01/openshiftclusters/client.go index a85c2b2030c..411af7cdda0 100644 --- a/resource-manager/redhatopenshift/2022-04-01/openshiftclusters/client.go +++ b/resource-manager/redhatopenshift/2022-04-01/openshiftclusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OpenShiftClustersClient struct { Client *resourcemanager.Client } -func NewOpenShiftClustersClientWithBaseURI(api environments.Api) (*OpenShiftClustersClient, error) { +func NewOpenShiftClustersClientWithBaseURI(api sdkEnv.Api) (*OpenShiftClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "openshiftclusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OpenShiftClustersClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2022-09-04/client.go b/resource-manager/redhatopenshift/2022-09-04/client.go index 6e302719592..98f92aa79ea 100644 --- a/resource-manager/redhatopenshift/2022-09-04/client.go +++ b/resource-manager/redhatopenshift/2022-09-04/client.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders" "github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2022-09-04/syncsets" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -25,7 +25,7 @@ type Client struct { SyncSets *syncsets.SyncSetsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { machinePoolsClient, err := machinepools.NewMachinePoolsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building MachinePools client: %+v", err) diff --git a/resource-manager/redhatopenshift/2022-09-04/machinepools/client.go b/resource-manager/redhatopenshift/2022-09-04/machinepools/client.go index 1a465d93c1e..fa188e31b60 100644 --- a/resource-manager/redhatopenshift/2022-09-04/machinepools/client.go +++ b/resource-manager/redhatopenshift/2022-09-04/machinepools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MachinePoolsClient struct { Client *resourcemanager.Client } -func NewMachinePoolsClientWithBaseURI(api environments.Api) (*MachinePoolsClient, error) { +func NewMachinePoolsClientWithBaseURI(api sdkEnv.Api) (*MachinePoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "machinepools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MachinePoolsClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2022-09-04/openshiftclusters/client.go b/resource-manager/redhatopenshift/2022-09-04/openshiftclusters/client.go index a85c2b2030c..411af7cdda0 100644 --- a/resource-manager/redhatopenshift/2022-09-04/openshiftclusters/client.go +++ b/resource-manager/redhatopenshift/2022-09-04/openshiftclusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OpenShiftClustersClient struct { Client *resourcemanager.Client } -func NewOpenShiftClustersClientWithBaseURI(api environments.Api) (*OpenShiftClustersClient, error) { +func NewOpenShiftClustersClientWithBaseURI(api sdkEnv.Api) (*OpenShiftClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "openshiftclusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OpenShiftClustersClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2022-09-04/openshiftversions/client.go b/resource-manager/redhatopenshift/2022-09-04/openshiftversions/client.go index 50c97f89891..3627daf38e6 100644 --- a/resource-manager/redhatopenshift/2022-09-04/openshiftversions/client.go +++ b/resource-manager/redhatopenshift/2022-09-04/openshiftversions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OpenShiftVersionsClient struct { Client *resourcemanager.Client } -func NewOpenShiftVersionsClientWithBaseURI(api environments.Api) (*OpenShiftVersionsClient, error) { +func NewOpenShiftVersionsClientWithBaseURI(api sdkEnv.Api) (*OpenShiftVersionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "openshiftversions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OpenShiftVersionsClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2022-09-04/secrets/client.go b/resource-manager/redhatopenshift/2022-09-04/secrets/client.go index 01a81c4a28c..12fc8f55136 100644 --- a/resource-manager/redhatopenshift/2022-09-04/secrets/client.go +++ b/resource-manager/redhatopenshift/2022-09-04/secrets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SecretsClient struct { Client *resourcemanager.Client } -func NewSecretsClientWithBaseURI(api environments.Api) (*SecretsClient, error) { +func NewSecretsClientWithBaseURI(api sdkEnv.Api) (*SecretsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "secrets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SecretsClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/client.go b/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/client.go index 9f2c72392c8..fb050589a77 100644 --- a/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/client.go +++ b/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SyncIdentityProvidersClient struct { Client *resourcemanager.Client } -func NewSyncIdentityProvidersClientWithBaseURI(api environments.Api) (*SyncIdentityProvidersClient, error) { +func NewSyncIdentityProvidersClientWithBaseURI(api sdkEnv.Api) (*SyncIdentityProvidersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "syncidentityproviders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SyncIdentityProvidersClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2022-09-04/syncsets/client.go b/resource-manager/redhatopenshift/2022-09-04/syncsets/client.go index 64f7a2d0366..f6d6af4f003 100644 --- a/resource-manager/redhatopenshift/2022-09-04/syncsets/client.go +++ b/resource-manager/redhatopenshift/2022-09-04/syncsets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SyncSetsClient struct { Client *resourcemanager.Client } -func NewSyncSetsClientWithBaseURI(api environments.Api) (*SyncSetsClient, error) { +func NewSyncSetsClientWithBaseURI(api sdkEnv.Api) (*SyncSetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "syncsets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SyncSetsClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2023-04-01/client.go b/resource-manager/redhatopenshift/2023-04-01/client.go index 81087ed0c8b..bb68eaa8039 100644 --- a/resource-manager/redhatopenshift/2023-04-01/client.go +++ b/resource-manager/redhatopenshift/2023-04-01/client.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders" "github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2023-04-01/syncsets" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -25,7 +25,7 @@ type Client struct { SyncSets *syncsets.SyncSetsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { machinePoolsClient, err := machinepools.NewMachinePoolsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building MachinePools client: %+v", err) diff --git a/resource-manager/redhatopenshift/2023-04-01/machinepools/client.go b/resource-manager/redhatopenshift/2023-04-01/machinepools/client.go index 1a465d93c1e..fa188e31b60 100644 --- a/resource-manager/redhatopenshift/2023-04-01/machinepools/client.go +++ b/resource-manager/redhatopenshift/2023-04-01/machinepools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MachinePoolsClient struct { Client *resourcemanager.Client } -func NewMachinePoolsClientWithBaseURI(api environments.Api) (*MachinePoolsClient, error) { +func NewMachinePoolsClientWithBaseURI(api sdkEnv.Api) (*MachinePoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "machinepools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MachinePoolsClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2023-04-01/openshiftclusters/client.go b/resource-manager/redhatopenshift/2023-04-01/openshiftclusters/client.go index a85c2b2030c..411af7cdda0 100644 --- a/resource-manager/redhatopenshift/2023-04-01/openshiftclusters/client.go +++ b/resource-manager/redhatopenshift/2023-04-01/openshiftclusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OpenShiftClustersClient struct { Client *resourcemanager.Client } -func NewOpenShiftClustersClientWithBaseURI(api environments.Api) (*OpenShiftClustersClient, error) { +func NewOpenShiftClustersClientWithBaseURI(api sdkEnv.Api) (*OpenShiftClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "openshiftclusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OpenShiftClustersClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2023-04-01/openshiftversions/client.go b/resource-manager/redhatopenshift/2023-04-01/openshiftversions/client.go index 50c97f89891..3627daf38e6 100644 --- a/resource-manager/redhatopenshift/2023-04-01/openshiftversions/client.go +++ b/resource-manager/redhatopenshift/2023-04-01/openshiftversions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OpenShiftVersionsClient struct { Client *resourcemanager.Client } -func NewOpenShiftVersionsClientWithBaseURI(api environments.Api) (*OpenShiftVersionsClient, error) { +func NewOpenShiftVersionsClientWithBaseURI(api sdkEnv.Api) (*OpenShiftVersionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "openshiftversions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OpenShiftVersionsClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2023-04-01/secrets/client.go b/resource-manager/redhatopenshift/2023-04-01/secrets/client.go index 01a81c4a28c..12fc8f55136 100644 --- a/resource-manager/redhatopenshift/2023-04-01/secrets/client.go +++ b/resource-manager/redhatopenshift/2023-04-01/secrets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SecretsClient struct { Client *resourcemanager.Client } -func NewSecretsClientWithBaseURI(api environments.Api) (*SecretsClient, error) { +func NewSecretsClientWithBaseURI(api sdkEnv.Api) (*SecretsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "secrets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SecretsClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/client.go b/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/client.go index 9f2c72392c8..fb050589a77 100644 --- a/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/client.go +++ b/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SyncIdentityProvidersClient struct { Client *resourcemanager.Client } -func NewSyncIdentityProvidersClientWithBaseURI(api environments.Api) (*SyncIdentityProvidersClient, error) { +func NewSyncIdentityProvidersClientWithBaseURI(api sdkEnv.Api) (*SyncIdentityProvidersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "syncidentityproviders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SyncIdentityProvidersClient: %+v", err) diff --git a/resource-manager/redhatopenshift/2023-04-01/syncsets/client.go b/resource-manager/redhatopenshift/2023-04-01/syncsets/client.go index 64f7a2d0366..f6d6af4f003 100644 --- a/resource-manager/redhatopenshift/2023-04-01/syncsets/client.go +++ b/resource-manager/redhatopenshift/2023-04-01/syncsets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SyncSetsClient struct { Client *resourcemanager.Client } -func NewSyncSetsClientWithBaseURI(api environments.Api) (*SyncSetsClient, error) { +func NewSyncSetsClientWithBaseURI(api sdkEnv.Api) (*SyncSetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "syncsets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SyncSetsClient: %+v", err) diff --git a/resource-manager/redis/2022-06-01/client.go b/resource-manager/redis/2022-06-01/client.go index 0647d6e373b..81bf37d50a3 100644 --- a/resource-manager/redis/2022-06-01/client.go +++ b/resource-manager/redis/2022-06-01/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2022-06-01/privatelinkresources" "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2022-06-01/redis" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { Redis *redis.RedisClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { firewallRulesClient, err := firewallrules.NewFirewallRulesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building FirewallRules client: %+v", err) diff --git a/resource-manager/redis/2022-06-01/firewallrules/client.go b/resource-manager/redis/2022-06-01/firewallrules/client.go index 6493e429eb1..86eebdae36a 100644 --- a/resource-manager/redis/2022-06-01/firewallrules/client.go +++ b/resource-manager/redis/2022-06-01/firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallRulesClient struct { Client *resourcemanager.Client } -func NewFirewallRulesClientWithBaseURI(api environments.Api) (*FirewallRulesClient, error) { +func NewFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) diff --git a/resource-manager/redis/2022-06-01/patchschedules/client.go b/resource-manager/redis/2022-06-01/patchschedules/client.go index 7b2a65dd4ac..3a39b263bd2 100644 --- a/resource-manager/redis/2022-06-01/patchschedules/client.go +++ b/resource-manager/redis/2022-06-01/patchschedules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PatchSchedulesClient struct { Client *resourcemanager.Client } -func NewPatchSchedulesClientWithBaseURI(api environments.Api) (*PatchSchedulesClient, error) { +func NewPatchSchedulesClientWithBaseURI(api sdkEnv.Api) (*PatchSchedulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "patchschedules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PatchSchedulesClient: %+v", err) diff --git a/resource-manager/redis/2022-06-01/privateendpointconnections/client.go b/resource-manager/redis/2022-06-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/redis/2022-06-01/privateendpointconnections/client.go +++ b/resource-manager/redis/2022-06-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/redis/2022-06-01/privatelinkresources/client.go b/resource-manager/redis/2022-06-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/redis/2022-06-01/privatelinkresources/client.go +++ b/resource-manager/redis/2022-06-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/redis/2022-06-01/redis/client.go b/resource-manager/redis/2022-06-01/redis/client.go index e0e7ee56ff3..d0fab3dc8e4 100644 --- a/resource-manager/redis/2022-06-01/redis/client.go +++ b/resource-manager/redis/2022-06-01/redis/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RedisClient struct { Client *resourcemanager.Client } -func NewRedisClientWithBaseURI(api environments.Api) (*RedisClient, error) { +func NewRedisClientWithBaseURI(api sdkEnv.Api) (*RedisClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "redis", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RedisClient: %+v", err) diff --git a/resource-manager/redis/2023-04-01/client.go b/resource-manager/redis/2023-04-01/client.go index 23ccffa560f..fe40ef5c2a9 100644 --- a/resource-manager/redis/2023-04-01/client.go +++ b/resource-manager/redis/2023-04-01/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2023-04-01/privatelinkresources" "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2023-04-01/redis" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { Redis *redis.RedisClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { firewallRulesClient, err := firewallrules.NewFirewallRulesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building FirewallRules client: %+v", err) diff --git a/resource-manager/redis/2023-04-01/firewallrules/client.go b/resource-manager/redis/2023-04-01/firewallrules/client.go index 6493e429eb1..86eebdae36a 100644 --- a/resource-manager/redis/2023-04-01/firewallrules/client.go +++ b/resource-manager/redis/2023-04-01/firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallRulesClient struct { Client *resourcemanager.Client } -func NewFirewallRulesClientWithBaseURI(api environments.Api) (*FirewallRulesClient, error) { +func NewFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) diff --git a/resource-manager/redis/2023-04-01/patchschedules/client.go b/resource-manager/redis/2023-04-01/patchschedules/client.go index 7b2a65dd4ac..3a39b263bd2 100644 --- a/resource-manager/redis/2023-04-01/patchschedules/client.go +++ b/resource-manager/redis/2023-04-01/patchschedules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PatchSchedulesClient struct { Client *resourcemanager.Client } -func NewPatchSchedulesClientWithBaseURI(api environments.Api) (*PatchSchedulesClient, error) { +func NewPatchSchedulesClientWithBaseURI(api sdkEnv.Api) (*PatchSchedulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "patchschedules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PatchSchedulesClient: %+v", err) diff --git a/resource-manager/redis/2023-04-01/privateendpointconnections/client.go b/resource-manager/redis/2023-04-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/redis/2023-04-01/privateendpointconnections/client.go +++ b/resource-manager/redis/2023-04-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/redis/2023-04-01/privatelinkresources/client.go b/resource-manager/redis/2023-04-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/redis/2023-04-01/privatelinkresources/client.go +++ b/resource-manager/redis/2023-04-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/redis/2023-04-01/redis/client.go b/resource-manager/redis/2023-04-01/redis/client.go index e0e7ee56ff3..d0fab3dc8e4 100644 --- a/resource-manager/redis/2023-04-01/redis/client.go +++ b/resource-manager/redis/2023-04-01/redis/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RedisClient struct { Client *resourcemanager.Client } -func NewRedisClientWithBaseURI(api environments.Api) (*RedisClient, error) { +func NewRedisClientWithBaseURI(api sdkEnv.Api) (*RedisClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "redis", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RedisClient: %+v", err) diff --git a/resource-manager/redisenterprise/2022-01-01/client.go b/resource-manager/redisenterprise/2022-01-01/client.go index f33df59fb96..9f078323bed 100644 --- a/resource-manager/redisenterprise/2022-01-01/client.go +++ b/resource-manager/redisenterprise/2022-01-01/client.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/privatelinkresources" "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -21,7 +21,7 @@ type Client struct { RedisEnterprise *redisenterprise.RedisEnterpriseClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { databasesClient, err := databases.NewDatabasesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Databases client: %+v", err) diff --git a/resource-manager/redisenterprise/2022-01-01/databases/client.go b/resource-manager/redisenterprise/2022-01-01/databases/client.go index bb94a331f78..6f48891ebd3 100644 --- a/resource-manager/redisenterprise/2022-01-01/databases/client.go +++ b/resource-manager/redisenterprise/2022-01-01/databases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabasesClient struct { Client *resourcemanager.Client } -func NewDatabasesClientWithBaseURI(api environments.Api) (*DatabasesClient, error) { +func NewDatabasesClientWithBaseURI(api sdkEnv.Api) (*DatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) diff --git a/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/client.go b/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/client.go +++ b/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/redisenterprise/2022-01-01/privatelinkresources/client.go b/resource-manager/redisenterprise/2022-01-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/redisenterprise/2022-01-01/privatelinkresources/client.go +++ b/resource-manager/redisenterprise/2022-01-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/redisenterprise/2022-01-01/redisenterprise/client.go b/resource-manager/redisenterprise/2022-01-01/redisenterprise/client.go index 79dee8cf0f9..18f9cd94f3b 100644 --- a/resource-manager/redisenterprise/2022-01-01/redisenterprise/client.go +++ b/resource-manager/redisenterprise/2022-01-01/redisenterprise/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RedisEnterpriseClient struct { Client *resourcemanager.Client } -func NewRedisEnterpriseClientWithBaseURI(api environments.Api) (*RedisEnterpriseClient, error) { +func NewRedisEnterpriseClientWithBaseURI(api sdkEnv.Api) (*RedisEnterpriseClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "redisenterprise", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RedisEnterpriseClient: %+v", err) diff --git a/resource-manager/relay/2021-11-01/client.go b/resource-manager/relay/2021-11-01/client.go index adc57214449..e3a0dc99367 100644 --- a/resource-manager/relay/2021-11-01/client.go +++ b/resource-manager/relay/2021-11-01/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2021-11-01/namespacesprivatelinkresources" "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2021-11-01/wcfrelays" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { WCFRelays *wcfrelays.WCFRelaysClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { hybridConnectionsClient, err := hybridconnections.NewHybridConnectionsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building HybridConnections client: %+v", err) diff --git a/resource-manager/relay/2021-11-01/hybridconnections/client.go b/resource-manager/relay/2021-11-01/hybridconnections/client.go index 03aa13b066b..755f35ee409 100644 --- a/resource-manager/relay/2021-11-01/hybridconnections/client.go +++ b/resource-manager/relay/2021-11-01/hybridconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HybridConnectionsClient struct { Client *resourcemanager.Client } -func NewHybridConnectionsClientWithBaseURI(api environments.Api) (*HybridConnectionsClient, error) { +func NewHybridConnectionsClientWithBaseURI(api sdkEnv.Api) (*HybridConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hybridconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HybridConnectionsClient: %+v", err) diff --git a/resource-manager/relay/2021-11-01/namespaces/client.go b/resource-manager/relay/2021-11-01/namespaces/client.go index 6b0ae358115..a991037b3a6 100644 --- a/resource-manager/relay/2021-11-01/namespaces/client.go +++ b/resource-manager/relay/2021-11-01/namespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesClient struct { Client *resourcemanager.Client } -func NewNamespacesClientWithBaseURI(api environments.Api) (*NamespacesClient, error) { +func NewNamespacesClientWithBaseURI(api sdkEnv.Api) (*NamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesClient: %+v", err) diff --git a/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/client.go b/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/client.go index b6799829ed0..e29cce4a732 100644 --- a/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/client.go +++ b/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { +func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/client.go b/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/client.go index 91bf1934f90..04bc3afdfd7 100644 --- a/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/client.go +++ b/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*NamespacesPrivateLinkResourcesClient, error) { +func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/relay/2021-11-01/wcfrelays/client.go b/resource-manager/relay/2021-11-01/wcfrelays/client.go index 9e151c39a16..d5d937d8257 100644 --- a/resource-manager/relay/2021-11-01/wcfrelays/client.go +++ b/resource-manager/relay/2021-11-01/wcfrelays/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WCFRelaysClient struct { Client *resourcemanager.Client } -func NewWCFRelaysClientWithBaseURI(api environments.Api) (*WCFRelaysClient, error) { +func NewWCFRelaysClientWithBaseURI(api sdkEnv.Api) (*WCFRelaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "wcfrelays", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WCFRelaysClient: %+v", err) diff --git a/resource-manager/search/2022-09-01/adminkeys/client.go b/resource-manager/search/2022-09-01/adminkeys/client.go index eac4883b088..c95a2f0bf57 100644 --- a/resource-manager/search/2022-09-01/adminkeys/client.go +++ b/resource-manager/search/2022-09-01/adminkeys/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AdminKeysClient struct { Client *resourcemanager.Client } -func NewAdminKeysClientWithBaseURI(api environments.Api) (*AdminKeysClient, error) { +func NewAdminKeysClientWithBaseURI(api sdkEnv.Api) (*AdminKeysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "adminkeys", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AdminKeysClient: %+v", err) diff --git a/resource-manager/search/2022-09-01/client.go b/resource-manager/search/2022-09-01/client.go index f37f9b33e58..826c848c602 100644 --- a/resource-manager/search/2022-09-01/client.go +++ b/resource-manager/search/2022-09-01/client.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/search/2022-09-01/services" "github.com/hashicorp/go-azure-sdk/resource-manager/search/2022-09-01/sharedprivatelinkresources" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -25,7 +25,7 @@ type Client struct { SharedPrivateLinkResources *sharedprivatelinkresources.SharedPrivateLinkResourcesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { adminKeysClient, err := adminkeys.NewAdminKeysClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AdminKeys client: %+v", err) diff --git a/resource-manager/search/2022-09-01/privateendpointconnections/client.go b/resource-manager/search/2022-09-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/search/2022-09-01/privateendpointconnections/client.go +++ b/resource-manager/search/2022-09-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/search/2022-09-01/privatelinkresources/client.go b/resource-manager/search/2022-09-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/search/2022-09-01/privatelinkresources/client.go +++ b/resource-manager/search/2022-09-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/search/2022-09-01/querykeys/client.go b/resource-manager/search/2022-09-01/querykeys/client.go index fabd432d925..3530bc732dd 100644 --- a/resource-manager/search/2022-09-01/querykeys/client.go +++ b/resource-manager/search/2022-09-01/querykeys/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QueryKeysClient struct { Client *resourcemanager.Client } -func NewQueryKeysClientWithBaseURI(api environments.Api) (*QueryKeysClient, error) { +func NewQueryKeysClientWithBaseURI(api sdkEnv.Api) (*QueryKeysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "querykeys", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QueryKeysClient: %+v", err) diff --git a/resource-manager/search/2022-09-01/services/client.go b/resource-manager/search/2022-09-01/services/client.go index 22ee3392d99..3b7b97f191e 100644 --- a/resource-manager/search/2022-09-01/services/client.go +++ b/resource-manager/search/2022-09-01/services/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServicesClient struct { Client *resourcemanager.Client } -func NewServicesClientWithBaseURI(api environments.Api) (*ServicesClient, error) { +func NewServicesClientWithBaseURI(api sdkEnv.Api) (*ServicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "services", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServicesClient: %+v", err) diff --git a/resource-manager/search/2022-09-01/sharedprivatelinkresources/client.go b/resource-manager/search/2022-09-01/sharedprivatelinkresources/client.go index be3ba580371..79eb3cddbbc 100644 --- a/resource-manager/search/2022-09-01/sharedprivatelinkresources/client.go +++ b/resource-manager/search/2022-09-01/sharedprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SharedPrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewSharedPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*SharedPrivateLinkResourcesClient, error) { +func NewSharedPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*SharedPrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sharedprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SharedPrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/client.go b/resource-manager/servicebus/2021-06-01-preview/client.go index 580558e5768..0909bf35b07 100644 --- a/resource-manager/servicebus/2021-06-01-preview/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/client.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics" "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -37,7 +37,7 @@ type Client struct { TopicsAuthorizationRule *topicsauthorizationrule.TopicsAuthorizationRuleClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { disasterRecoveryConfigsClient, err := disasterrecoveryconfigs.NewDisasterRecoveryConfigsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DisasterRecoveryConfigs client: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/client.go b/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/client.go index 3faf5be9484..b6f5e0db9ba 100644 --- a/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DisasterRecoveryConfigsClient struct { Client *resourcemanager.Client } -func NewDisasterRecoveryConfigsClientWithBaseURI(api environments.Api) (*DisasterRecoveryConfigsClient, error) { +func NewDisasterRecoveryConfigsClientWithBaseURI(api sdkEnv.Api) (*DisasterRecoveryConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "disasterrecoveryconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DisasterRecoveryConfigsClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/migrationconfigs/client.go b/resource-manager/servicebus/2021-06-01-preview/migrationconfigs/client.go index 6ad0b8fc706..2d091e832fa 100644 --- a/resource-manager/servicebus/2021-06-01-preview/migrationconfigs/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/migrationconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MigrationConfigsClient struct { Client *resourcemanager.Client } -func NewMigrationConfigsClientWithBaseURI(api environments.Api) (*MigrationConfigsClient, error) { +func NewMigrationConfigsClientWithBaseURI(api sdkEnv.Api) (*MigrationConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "migrationconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MigrationConfigsClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/namespaces/client.go b/resource-manager/servicebus/2021-06-01-preview/namespaces/client.go index 6b0ae358115..a991037b3a6 100644 --- a/resource-manager/servicebus/2021-06-01-preview/namespaces/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/namespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesClient struct { Client *resourcemanager.Client } -func NewNamespacesClientWithBaseURI(api environments.Api) (*NamespacesClient, error) { +func NewNamespacesClientWithBaseURI(api sdkEnv.Api) (*NamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/client.go b/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/client.go index 626c278811c..a4785ce93e4 100644 --- a/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesAuthorizationRuleClient struct { Client *resourcemanager.Client } -func NewNamespacesAuthorizationRuleClientWithBaseURI(api environments.Api) (*NamespacesAuthorizationRuleClient, error) { +func NewNamespacesAuthorizationRuleClientWithBaseURI(api sdkEnv.Api) (*NamespacesAuthorizationRuleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesauthorizationrule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesAuthorizationRuleClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/client.go b/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/client.go index b6799829ed0..e29cce4a732 100644 --- a/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { +func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/namespacesprivatelinkresources/client.go b/resource-manager/servicebus/2021-06-01-preview/namespacesprivatelinkresources/client.go index 91bf1934f90..04bc3afdfd7 100644 --- a/resource-manager/servicebus/2021-06-01-preview/namespacesprivatelinkresources/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/namespacesprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*NamespacesPrivateLinkResourcesClient, error) { +func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/queues/client.go b/resource-manager/servicebus/2021-06-01-preview/queues/client.go index 09e4110ebdb..a590f5bb71a 100644 --- a/resource-manager/servicebus/2021-06-01-preview/queues/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/queues/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QueuesClient struct { Client *resourcemanager.Client } -func NewQueuesClientWithBaseURI(api environments.Api) (*QueuesClient, error) { +func NewQueuesClientWithBaseURI(api sdkEnv.Api) (*QueuesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "queues", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QueuesClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/client.go b/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/client.go index 04934233fff..c262b4abb0f 100644 --- a/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QueuesAuthorizationRuleClient struct { Client *resourcemanager.Client } -func NewQueuesAuthorizationRuleClientWithBaseURI(api environments.Api) (*QueuesAuthorizationRuleClient, error) { +func NewQueuesAuthorizationRuleClientWithBaseURI(api sdkEnv.Api) (*QueuesAuthorizationRuleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "queuesauthorizationrule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QueuesAuthorizationRuleClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/rules/client.go b/resource-manager/servicebus/2021-06-01-preview/rules/client.go index 1897d15f86a..1fce7789d65 100644 --- a/resource-manager/servicebus/2021-06-01-preview/rules/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/rules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RulesClient struct { Client *resourcemanager.Client } -func NewRulesClientWithBaseURI(api environments.Api) (*RulesClient, error) { +func NewRulesClientWithBaseURI(api sdkEnv.Api) (*RulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "rules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RulesClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/subscriptions/client.go b/resource-manager/servicebus/2021-06-01-preview/subscriptions/client.go index b44affbb641..2172c243f0f 100644 --- a/resource-manager/servicebus/2021-06-01-preview/subscriptions/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/subscriptions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SubscriptionsClient struct { Client *resourcemanager.Client } -func NewSubscriptionsClientWithBaseURI(api environments.Api) (*SubscriptionsClient, error) { +func NewSubscriptionsClientWithBaseURI(api sdkEnv.Api) (*SubscriptionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "subscriptions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SubscriptionsClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/topics/client.go b/resource-manager/servicebus/2021-06-01-preview/topics/client.go index ab4d8b6b5f9..8bc788102fd 100644 --- a/resource-manager/servicebus/2021-06-01-preview/topics/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/topics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TopicsClient struct { Client *resourcemanager.Client } -func NewTopicsClientWithBaseURI(api environments.Api) (*TopicsClient, error) { +func NewTopicsClientWithBaseURI(api sdkEnv.Api) (*TopicsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "topics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TopicsClient: %+v", err) diff --git a/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/client.go b/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/client.go index ba45494bb08..bdb2664511d 100644 --- a/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/client.go +++ b/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TopicsAuthorizationRuleClient struct { Client *resourcemanager.Client } -func NewTopicsAuthorizationRuleClientWithBaseURI(api environments.Api) (*TopicsAuthorizationRuleClient, error) { +func NewTopicsAuthorizationRuleClientWithBaseURI(api sdkEnv.Api) (*TopicsAuthorizationRuleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "topicsauthorizationrule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TopicsAuthorizationRuleClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/client.go b/resource-manager/servicebus/2021-11-01/client.go index 5747db995d6..06d20bcafdc 100644 --- a/resource-manager/servicebus/2021-11-01/client.go +++ b/resource-manager/servicebus/2021-11-01/client.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-11-01/topics" "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-11-01/topicsauthorizationrule" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -37,7 +37,7 @@ type Client struct { TopicsAuthorizationRule *topicsauthorizationrule.TopicsAuthorizationRuleClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { disasterRecoveryConfigsClient, err := disasterrecoveryconfigs.NewDisasterRecoveryConfigsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DisasterRecoveryConfigs client: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/client.go b/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/client.go index 3faf5be9484..b6f5e0db9ba 100644 --- a/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/client.go +++ b/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DisasterRecoveryConfigsClient struct { Client *resourcemanager.Client } -func NewDisasterRecoveryConfigsClientWithBaseURI(api environments.Api) (*DisasterRecoveryConfigsClient, error) { +func NewDisasterRecoveryConfigsClientWithBaseURI(api sdkEnv.Api) (*DisasterRecoveryConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "disasterrecoveryconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DisasterRecoveryConfigsClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/migrationconfigs/client.go b/resource-manager/servicebus/2021-11-01/migrationconfigs/client.go index 6ad0b8fc706..2d091e832fa 100644 --- a/resource-manager/servicebus/2021-11-01/migrationconfigs/client.go +++ b/resource-manager/servicebus/2021-11-01/migrationconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MigrationConfigsClient struct { Client *resourcemanager.Client } -func NewMigrationConfigsClientWithBaseURI(api environments.Api) (*MigrationConfigsClient, error) { +func NewMigrationConfigsClientWithBaseURI(api sdkEnv.Api) (*MigrationConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "migrationconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MigrationConfigsClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/namespaces/client.go b/resource-manager/servicebus/2021-11-01/namespaces/client.go index 6b0ae358115..a991037b3a6 100644 --- a/resource-manager/servicebus/2021-11-01/namespaces/client.go +++ b/resource-manager/servicebus/2021-11-01/namespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesClient struct { Client *resourcemanager.Client } -func NewNamespacesClientWithBaseURI(api environments.Api) (*NamespacesClient, error) { +func NewNamespacesClientWithBaseURI(api sdkEnv.Api) (*NamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/client.go b/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/client.go index 626c278811c..a4785ce93e4 100644 --- a/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/client.go +++ b/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesAuthorizationRuleClient struct { Client *resourcemanager.Client } -func NewNamespacesAuthorizationRuleClientWithBaseURI(api environments.Api) (*NamespacesAuthorizationRuleClient, error) { +func NewNamespacesAuthorizationRuleClientWithBaseURI(api sdkEnv.Api) (*NamespacesAuthorizationRuleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesauthorizationrule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesAuthorizationRuleClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/client.go b/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/client.go index b6799829ed0..e29cce4a732 100644 --- a/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/client.go +++ b/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { +func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/namespacesprivatelinkresources/client.go b/resource-manager/servicebus/2021-11-01/namespacesprivatelinkresources/client.go index 91bf1934f90..04bc3afdfd7 100644 --- a/resource-manager/servicebus/2021-11-01/namespacesprivatelinkresources/client.go +++ b/resource-manager/servicebus/2021-11-01/namespacesprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*NamespacesPrivateLinkResourcesClient, error) { +func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/queues/client.go b/resource-manager/servicebus/2021-11-01/queues/client.go index 09e4110ebdb..a590f5bb71a 100644 --- a/resource-manager/servicebus/2021-11-01/queues/client.go +++ b/resource-manager/servicebus/2021-11-01/queues/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QueuesClient struct { Client *resourcemanager.Client } -func NewQueuesClientWithBaseURI(api environments.Api) (*QueuesClient, error) { +func NewQueuesClientWithBaseURI(api sdkEnv.Api) (*QueuesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "queues", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QueuesClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/client.go b/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/client.go index 04934233fff..c262b4abb0f 100644 --- a/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/client.go +++ b/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QueuesAuthorizationRuleClient struct { Client *resourcemanager.Client } -func NewQueuesAuthorizationRuleClientWithBaseURI(api environments.Api) (*QueuesAuthorizationRuleClient, error) { +func NewQueuesAuthorizationRuleClientWithBaseURI(api sdkEnv.Api) (*QueuesAuthorizationRuleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "queuesauthorizationrule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QueuesAuthorizationRuleClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/rules/client.go b/resource-manager/servicebus/2021-11-01/rules/client.go index 1897d15f86a..1fce7789d65 100644 --- a/resource-manager/servicebus/2021-11-01/rules/client.go +++ b/resource-manager/servicebus/2021-11-01/rules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RulesClient struct { Client *resourcemanager.Client } -func NewRulesClientWithBaseURI(api environments.Api) (*RulesClient, error) { +func NewRulesClientWithBaseURI(api sdkEnv.Api) (*RulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "rules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RulesClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/subscriptions/client.go b/resource-manager/servicebus/2021-11-01/subscriptions/client.go index b44affbb641..2172c243f0f 100644 --- a/resource-manager/servicebus/2021-11-01/subscriptions/client.go +++ b/resource-manager/servicebus/2021-11-01/subscriptions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SubscriptionsClient struct { Client *resourcemanager.Client } -func NewSubscriptionsClientWithBaseURI(api environments.Api) (*SubscriptionsClient, error) { +func NewSubscriptionsClientWithBaseURI(api sdkEnv.Api) (*SubscriptionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "subscriptions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SubscriptionsClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/topics/client.go b/resource-manager/servicebus/2021-11-01/topics/client.go index ab4d8b6b5f9..8bc788102fd 100644 --- a/resource-manager/servicebus/2021-11-01/topics/client.go +++ b/resource-manager/servicebus/2021-11-01/topics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TopicsClient struct { Client *resourcemanager.Client } -func NewTopicsClientWithBaseURI(api environments.Api) (*TopicsClient, error) { +func NewTopicsClientWithBaseURI(api sdkEnv.Api) (*TopicsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "topics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TopicsClient: %+v", err) diff --git a/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/client.go b/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/client.go index ba45494bb08..bdb2664511d 100644 --- a/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/client.go +++ b/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TopicsAuthorizationRuleClient struct { Client *resourcemanager.Client } -func NewTopicsAuthorizationRuleClientWithBaseURI(api environments.Api) (*TopicsAuthorizationRuleClient, error) { +func NewTopicsAuthorizationRuleClientWithBaseURI(api sdkEnv.Api) (*TopicsAuthorizationRuleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "topicsauthorizationrule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TopicsAuthorizationRuleClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/client.go b/resource-manager/servicebus/2022-01-01-preview/client.go index bb6db34cfab..1397dab5b42 100644 --- a/resource-manager/servicebus/2022-01-01-preview/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/client.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2022-01-01-preview/topics" "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -37,7 +37,7 @@ type Client struct { TopicsAuthorizationRule *topicsauthorizationrule.TopicsAuthorizationRuleClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { disasterRecoveryConfigsClient, err := disasterrecoveryconfigs.NewDisasterRecoveryConfigsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DisasterRecoveryConfigs client: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/client.go b/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/client.go index 3faf5be9484..b6f5e0db9ba 100644 --- a/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DisasterRecoveryConfigsClient struct { Client *resourcemanager.Client } -func NewDisasterRecoveryConfigsClientWithBaseURI(api environments.Api) (*DisasterRecoveryConfigsClient, error) { +func NewDisasterRecoveryConfigsClientWithBaseURI(api sdkEnv.Api) (*DisasterRecoveryConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "disasterrecoveryconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DisasterRecoveryConfigsClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/migrationconfigs/client.go b/resource-manager/servicebus/2022-01-01-preview/migrationconfigs/client.go index 6ad0b8fc706..2d091e832fa 100644 --- a/resource-manager/servicebus/2022-01-01-preview/migrationconfigs/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/migrationconfigs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MigrationConfigsClient struct { Client *resourcemanager.Client } -func NewMigrationConfigsClientWithBaseURI(api environments.Api) (*MigrationConfigsClient, error) { +func NewMigrationConfigsClientWithBaseURI(api sdkEnv.Api) (*MigrationConfigsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "migrationconfigs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MigrationConfigsClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/namespaces/client.go b/resource-manager/servicebus/2022-01-01-preview/namespaces/client.go index 6b0ae358115..a991037b3a6 100644 --- a/resource-manager/servicebus/2022-01-01-preview/namespaces/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/namespaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesClient struct { Client *resourcemanager.Client } -func NewNamespacesClientWithBaseURI(api environments.Api) (*NamespacesClient, error) { +func NewNamespacesClientWithBaseURI(api sdkEnv.Api) (*NamespacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/client.go b/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/client.go index 626c278811c..a4785ce93e4 100644 --- a/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesAuthorizationRuleClient struct { Client *resourcemanager.Client } -func NewNamespacesAuthorizationRuleClientWithBaseURI(api environments.Api) (*NamespacesAuthorizationRuleClient, error) { +func NewNamespacesAuthorizationRuleClientWithBaseURI(api sdkEnv.Api) (*NamespacesAuthorizationRuleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesauthorizationrule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesAuthorizationRuleClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/client.go b/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/client.go index b6799829ed0..e29cce4a732 100644 --- a/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { +func NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/namespacesprivatelinkresources/client.go b/resource-manager/servicebus/2022-01-01-preview/namespacesprivatelinkresources/client.go index 91bf1934f90..04bc3afdfd7 100644 --- a/resource-manager/servicebus/2022-01-01-preview/namespacesprivatelinkresources/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/namespacesprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NamespacesPrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*NamespacesPrivateLinkResourcesClient, error) { +func NewNamespacesPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*NamespacesPrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "namespacesprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NamespacesPrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/queues/client.go b/resource-manager/servicebus/2022-01-01-preview/queues/client.go index 09e4110ebdb..a590f5bb71a 100644 --- a/resource-manager/servicebus/2022-01-01-preview/queues/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/queues/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QueuesClient struct { Client *resourcemanager.Client } -func NewQueuesClientWithBaseURI(api environments.Api) (*QueuesClient, error) { +func NewQueuesClientWithBaseURI(api sdkEnv.Api) (*QueuesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "queues", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QueuesClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/client.go b/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/client.go index 04934233fff..c262b4abb0f 100644 --- a/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type QueuesAuthorizationRuleClient struct { Client *resourcemanager.Client } -func NewQueuesAuthorizationRuleClientWithBaseURI(api environments.Api) (*QueuesAuthorizationRuleClient, error) { +func NewQueuesAuthorizationRuleClientWithBaseURI(api sdkEnv.Api) (*QueuesAuthorizationRuleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "queuesauthorizationrule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating QueuesAuthorizationRuleClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/rules/client.go b/resource-manager/servicebus/2022-01-01-preview/rules/client.go index 1897d15f86a..1fce7789d65 100644 --- a/resource-manager/servicebus/2022-01-01-preview/rules/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/rules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RulesClient struct { Client *resourcemanager.Client } -func NewRulesClientWithBaseURI(api environments.Api) (*RulesClient, error) { +func NewRulesClientWithBaseURI(api sdkEnv.Api) (*RulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "rules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RulesClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/subscriptions/client.go b/resource-manager/servicebus/2022-01-01-preview/subscriptions/client.go index b44affbb641..2172c243f0f 100644 --- a/resource-manager/servicebus/2022-01-01-preview/subscriptions/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/subscriptions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SubscriptionsClient struct { Client *resourcemanager.Client } -func NewSubscriptionsClientWithBaseURI(api environments.Api) (*SubscriptionsClient, error) { +func NewSubscriptionsClientWithBaseURI(api sdkEnv.Api) (*SubscriptionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "subscriptions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SubscriptionsClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/topics/client.go b/resource-manager/servicebus/2022-01-01-preview/topics/client.go index ab4d8b6b5f9..8bc788102fd 100644 --- a/resource-manager/servicebus/2022-01-01-preview/topics/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/topics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TopicsClient struct { Client *resourcemanager.Client } -func NewTopicsClientWithBaseURI(api environments.Api) (*TopicsClient, error) { +func NewTopicsClientWithBaseURI(api sdkEnv.Api) (*TopicsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "topics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TopicsClient: %+v", err) diff --git a/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/client.go b/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/client.go index ba45494bb08..bdb2664511d 100644 --- a/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/client.go +++ b/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TopicsAuthorizationRuleClient struct { Client *resourcemanager.Client } -func NewTopicsAuthorizationRuleClientWithBaseURI(api environments.Api) (*TopicsAuthorizationRuleClient, error) { +func NewTopicsAuthorizationRuleClientWithBaseURI(api sdkEnv.Api) (*TopicsAuthorizationRuleClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "topicsauthorizationrule", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TopicsAuthorizationRuleClient: %+v", err) diff --git a/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/client.go b/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/client.go index e425c175827..c50187af554 100644 --- a/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/client.go +++ b/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AssociationsInterfaceClient struct { Client *resourcemanager.Client } -func NewAssociationsInterfaceClientWithBaseURI(api environments.Api) (*AssociationsInterfaceClient, error) { +func NewAssociationsInterfaceClientWithBaseURI(api sdkEnv.Api) (*AssociationsInterfaceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "associationsinterface", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AssociationsInterfaceClient: %+v", err) diff --git a/resource-manager/servicenetworking/2023-05-01-preview/client.go b/resource-manager/servicenetworking/2023-05-01-preview/client.go index 13aa426ab03..ccb90ea86f6 100644 --- a/resource-manager/servicenetworking/2023-05-01-preview/client.go +++ b/resource-manager/servicenetworking/2023-05-01-preview/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface" "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { TrafficControllerInterface *trafficcontrollerinterface.TrafficControllerInterfaceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { associationsInterfaceClient, err := associationsinterface.NewAssociationsInterfaceClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AssociationsInterface client: %+v", err) diff --git a/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/client.go b/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/client.go index a1602b3a552..aa19917d811 100644 --- a/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/client.go +++ b/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FrontendsInterfaceClient struct { Client *resourcemanager.Client } -func NewFrontendsInterfaceClientWithBaseURI(api environments.Api) (*FrontendsInterfaceClient, error) { +func NewFrontendsInterfaceClientWithBaseURI(api sdkEnv.Api) (*FrontendsInterfaceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "frontendsinterface", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FrontendsInterfaceClient: %+v", err) diff --git a/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/client.go b/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/client.go index 52e521214db..508096b4ea4 100644 --- a/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/client.go +++ b/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TrafficControllerInterfaceClient struct { Client *resourcemanager.Client } -func NewTrafficControllerInterfaceClientWithBaseURI(api environments.Api) (*TrafficControllerInterfaceClient, error) { +func NewTrafficControllerInterfaceClientWithBaseURI(api sdkEnv.Api) (*TrafficControllerInterfaceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "trafficcontrollerinterface", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TrafficControllerInterfaceClient: %+v", err) diff --git a/resource-manager/signalr/2023-02-01/client.go b/resource-manager/signalr/2023-02-01/client.go index 1c9f79fc434..0d82a506650 100644 --- a/resource-manager/signalr/2023-02-01/client.go +++ b/resource-manager/signalr/2023-02-01/client.go @@ -8,14 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2023-02-01/signalr" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { SignalR *signalr.SignalRClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { signalRClient, err := signalr.NewSignalRClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building SignalR client: %+v", err) diff --git a/resource-manager/signalr/2023-02-01/signalr/client.go b/resource-manager/signalr/2023-02-01/signalr/client.go index 509f41249f3..d83cc77cfb4 100644 --- a/resource-manager/signalr/2023-02-01/signalr/client.go +++ b/resource-manager/signalr/2023-02-01/signalr/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SignalRClient struct { Client *resourcemanager.Client } -func NewSignalRClientWithBaseURI(api environments.Api) (*SignalRClient, error) { +func NewSignalRClientWithBaseURI(api sdkEnv.Api) (*SignalRClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "signalr", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SignalRClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/backuplongtermretentionpolicies/client.go b/resource-manager/sql/2017-03-01-preview/backuplongtermretentionpolicies/client.go index 6c6592bcfb8..accfb9b9fbd 100644 --- a/resource-manager/sql/2017-03-01-preview/backuplongtermretentionpolicies/client.go +++ b/resource-manager/sql/2017-03-01-preview/backuplongtermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupLongTermRetentionPoliciesClient struct { Client *resourcemanager.Client } -func NewBackupLongTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*BackupLongTermRetentionPoliciesClient, error) { +func NewBackupLongTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*BackupLongTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backuplongtermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupLongTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/blobauditing/client.go b/resource-manager/sql/2017-03-01-preview/blobauditing/client.go index 827a9af09ae..51286580a86 100644 --- a/resource-manager/sql/2017-03-01-preview/blobauditing/client.go +++ b/resource-manager/sql/2017-03-01-preview/blobauditing/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BlobAuditingClient struct { Client *resourcemanager.Client } -func NewBlobAuditingClientWithBaseURI(api environments.Api) (*BlobAuditingClient, error) { +func NewBlobAuditingClientWithBaseURI(api sdkEnv.Api) (*BlobAuditingClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "blobauditing", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BlobAuditingClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/client.go b/resource-manager/sql/2017-03-01-preview/client.go index eeb7a953757..6e958fe7049 100644 --- a/resource-manager/sql/2017-03-01-preview/client.go +++ b/resource-manager/sql/2017-03-01-preview/client.go @@ -35,7 +35,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2017-03-01-preview/serverdnsaliases" "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2017-03-01-preview/serversecurityalertpolicies" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -69,7 +69,7 @@ type Client struct { ServerSecurityAlertPolicies *serversecurityalertpolicies.ServerSecurityAlertPoliciesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { backupLongTermRetentionPoliciesClient, err := backuplongtermretentionpolicies.NewBackupLongTermRetentionPoliciesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building BackupLongTermRetentionPolicies client: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/databases/client.go b/resource-manager/sql/2017-03-01-preview/databases/client.go index bb94a331f78..6f48891ebd3 100644 --- a/resource-manager/sql/2017-03-01-preview/databases/client.go +++ b/resource-manager/sql/2017-03-01-preview/databases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabasesClient struct { Client *resourcemanager.Client } -func NewDatabasesClientWithBaseURI(api environments.Api) (*DatabasesClient, error) { +func NewDatabasesClientWithBaseURI(api sdkEnv.Api) (*DatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/databasevulnerabilityassesmentrulebaselines/client.go b/resource-manager/sql/2017-03-01-preview/databasevulnerabilityassesmentrulebaselines/client.go index 8a4ba0ec538..e946f31bc29 100644 --- a/resource-manager/sql/2017-03-01-preview/databasevulnerabilityassesmentrulebaselines/client.go +++ b/resource-manager/sql/2017-03-01-preview/databasevulnerabilityassesmentrulebaselines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseVulnerabilityAssesmentRuleBaselinesClient struct { Client *resourcemanager.Client } -func NewDatabaseVulnerabilityAssesmentRuleBaselinesClientWithBaseURI(api environments.Api) (*DatabaseVulnerabilityAssesmentRuleBaselinesClient, error) { +func NewDatabaseVulnerabilityAssesmentRuleBaselinesClientWithBaseURI(api sdkEnv.Api) (*DatabaseVulnerabilityAssesmentRuleBaselinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasevulnerabilityassesmentrulebaselines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseVulnerabilityAssesmentRuleBaselinesClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/databasevulnerabilityassessments/client.go b/resource-manager/sql/2017-03-01-preview/databasevulnerabilityassessments/client.go index 2a9ec654f8a..47d094dc471 100644 --- a/resource-manager/sql/2017-03-01-preview/databasevulnerabilityassessments/client.go +++ b/resource-manager/sql/2017-03-01-preview/databasevulnerabilityassessments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseVulnerabilityAssessmentsClient struct { Client *resourcemanager.Client } -func NewDatabaseVulnerabilityAssessmentsClientWithBaseURI(api environments.Api) (*DatabaseVulnerabilityAssessmentsClient, error) { +func NewDatabaseVulnerabilityAssessmentsClientWithBaseURI(api sdkEnv.Api) (*DatabaseVulnerabilityAssessmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasevulnerabilityassessments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseVulnerabilityAssessmentsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/datawarehouseuseractivities/client.go b/resource-manager/sql/2017-03-01-preview/datawarehouseuseractivities/client.go index cd30b370888..a7ce6c8c236 100644 --- a/resource-manager/sql/2017-03-01-preview/datawarehouseuseractivities/client.go +++ b/resource-manager/sql/2017-03-01-preview/datawarehouseuseractivities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataWarehouseUserActivitiesClient struct { Client *resourcemanager.Client } -func NewDataWarehouseUserActivitiesClientWithBaseURI(api environments.Api) (*DataWarehouseUserActivitiesClient, error) { +func NewDataWarehouseUserActivitiesClientWithBaseURI(api sdkEnv.Api) (*DataWarehouseUserActivitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datawarehouseuseractivities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataWarehouseUserActivitiesClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/jobagents/client.go b/resource-manager/sql/2017-03-01-preview/jobagents/client.go index 98054c033a0..5699e8adc22 100644 --- a/resource-manager/sql/2017-03-01-preview/jobagents/client.go +++ b/resource-manager/sql/2017-03-01-preview/jobagents/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobAgentsClient struct { Client *resourcemanager.Client } -func NewJobAgentsClientWithBaseURI(api environments.Api) (*JobAgentsClient, error) { +func NewJobAgentsClientWithBaseURI(api sdkEnv.Api) (*JobAgentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobagents", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobAgentsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/jobcredentials/client.go b/resource-manager/sql/2017-03-01-preview/jobcredentials/client.go index 50266bc8457..9c23c45f48a 100644 --- a/resource-manager/sql/2017-03-01-preview/jobcredentials/client.go +++ b/resource-manager/sql/2017-03-01-preview/jobcredentials/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobCredentialsClient struct { Client *resourcemanager.Client } -func NewJobCredentialsClientWithBaseURI(api environments.Api) (*JobCredentialsClient, error) { +func NewJobCredentialsClientWithBaseURI(api sdkEnv.Api) (*JobCredentialsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobcredentials", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobCredentialsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/jobexecutions/client.go b/resource-manager/sql/2017-03-01-preview/jobexecutions/client.go index a747e2f4d38..77afc026dc1 100644 --- a/resource-manager/sql/2017-03-01-preview/jobexecutions/client.go +++ b/resource-manager/sql/2017-03-01-preview/jobexecutions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobExecutionsClient struct { Client *resourcemanager.Client } -func NewJobExecutionsClientWithBaseURI(api environments.Api) (*JobExecutionsClient, error) { +func NewJobExecutionsClientWithBaseURI(api sdkEnv.Api) (*JobExecutionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobexecutions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobExecutionsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/jobs/client.go b/resource-manager/sql/2017-03-01-preview/jobs/client.go index e2cca931b31..a7c521817f9 100644 --- a/resource-manager/sql/2017-03-01-preview/jobs/client.go +++ b/resource-manager/sql/2017-03-01-preview/jobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobsClient struct { Client *resourcemanager.Client } -func NewJobsClientWithBaseURI(api environments.Api) (*JobsClient, error) { +func NewJobsClientWithBaseURI(api sdkEnv.Api) (*JobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/jobstepexecutions/client.go b/resource-manager/sql/2017-03-01-preview/jobstepexecutions/client.go index 747214e6542..04727a0768c 100644 --- a/resource-manager/sql/2017-03-01-preview/jobstepexecutions/client.go +++ b/resource-manager/sql/2017-03-01-preview/jobstepexecutions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobStepExecutionsClient struct { Client *resourcemanager.Client } -func NewJobStepExecutionsClientWithBaseURI(api environments.Api) (*JobStepExecutionsClient, error) { +func NewJobStepExecutionsClientWithBaseURI(api sdkEnv.Api) (*JobStepExecutionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobstepexecutions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobStepExecutionsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/jobsteps/client.go b/resource-manager/sql/2017-03-01-preview/jobsteps/client.go index 288fc5a5c7a..c0fd7cb974a 100644 --- a/resource-manager/sql/2017-03-01-preview/jobsteps/client.go +++ b/resource-manager/sql/2017-03-01-preview/jobsteps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobStepsClient struct { Client *resourcemanager.Client } -func NewJobStepsClientWithBaseURI(api environments.Api) (*JobStepsClient, error) { +func NewJobStepsClientWithBaseURI(api sdkEnv.Api) (*JobStepsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobsteps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobStepsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/jobtargetexecutions/client.go b/resource-manager/sql/2017-03-01-preview/jobtargetexecutions/client.go index 44b20159aa4..acc70a2987e 100644 --- a/resource-manager/sql/2017-03-01-preview/jobtargetexecutions/client.go +++ b/resource-manager/sql/2017-03-01-preview/jobtargetexecutions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobTargetExecutionsClient struct { Client *resourcemanager.Client } -func NewJobTargetExecutionsClientWithBaseURI(api environments.Api) (*JobTargetExecutionsClient, error) { +func NewJobTargetExecutionsClientWithBaseURI(api sdkEnv.Api) (*JobTargetExecutionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobtargetexecutions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobTargetExecutionsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/jobtargetgroups/client.go b/resource-manager/sql/2017-03-01-preview/jobtargetgroups/client.go index b66f9c2418b..2179339ea93 100644 --- a/resource-manager/sql/2017-03-01-preview/jobtargetgroups/client.go +++ b/resource-manager/sql/2017-03-01-preview/jobtargetgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobTargetGroupsClient struct { Client *resourcemanager.Client } -func NewJobTargetGroupsClientWithBaseURI(api environments.Api) (*JobTargetGroupsClient, error) { +func NewJobTargetGroupsClientWithBaseURI(api sdkEnv.Api) (*JobTargetGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobtargetgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobTargetGroupsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/jobversions/client.go b/resource-manager/sql/2017-03-01-preview/jobversions/client.go index eba7cc6e229..fe50e278589 100644 --- a/resource-manager/sql/2017-03-01-preview/jobversions/client.go +++ b/resource-manager/sql/2017-03-01-preview/jobversions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobVersionsClient struct { Client *resourcemanager.Client } -func NewJobVersionsClientWithBaseURI(api environments.Api) (*JobVersionsClient, error) { +func NewJobVersionsClientWithBaseURI(api sdkEnv.Api) (*JobVersionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobversions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobVersionsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/longtermretentionbackups/client.go b/resource-manager/sql/2017-03-01-preview/longtermretentionbackups/client.go index 1c4a9a73a65..8ab1793d043 100644 --- a/resource-manager/sql/2017-03-01-preview/longtermretentionbackups/client.go +++ b/resource-manager/sql/2017-03-01-preview/longtermretentionbackups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LongTermRetentionBackupsClient struct { Client *resourcemanager.Client } -func NewLongTermRetentionBackupsClientWithBaseURI(api environments.Api) (*LongTermRetentionBackupsClient, error) { +func NewLongTermRetentionBackupsClientWithBaseURI(api sdkEnv.Api) (*LongTermRetentionBackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "longtermretentionbackups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LongTermRetentionBackupsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/managedbackupshorttermretentionpolicies/client.go b/resource-manager/sql/2017-03-01-preview/managedbackupshorttermretentionpolicies/client.go index 0f914d6c4fe..aef1b895d74 100644 --- a/resource-manager/sql/2017-03-01-preview/managedbackupshorttermretentionpolicies/client.go +++ b/resource-manager/sql/2017-03-01-preview/managedbackupshorttermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedBackupShortTermRetentionPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedBackupShortTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*ManagedBackupShortTermRetentionPoliciesClient, error) { +func NewManagedBackupShortTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedBackupShortTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedbackupshorttermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedBackupShortTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/manageddatabases/client.go b/resource-manager/sql/2017-03-01-preview/manageddatabases/client.go index 09fd490cf51..0881fcb5f69 100644 --- a/resource-manager/sql/2017-03-01-preview/manageddatabases/client.go +++ b/resource-manager/sql/2017-03-01-preview/manageddatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabasesClient struct { Client *resourcemanager.Client } -func NewManagedDatabasesClientWithBaseURI(api environments.Api) (*ManagedDatabasesClient, error) { +func NewManagedDatabasesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/manageddatabasesecurityalertpolicies/client.go b/resource-manager/sql/2017-03-01-preview/manageddatabasesecurityalertpolicies/client.go index 62a2219ec3f..3709e4e4bfd 100644 --- a/resource-manager/sql/2017-03-01-preview/manageddatabasesecurityalertpolicies/client.go +++ b/resource-manager/sql/2017-03-01-preview/manageddatabasesecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*ManagedDatabaseSecurityAlertPoliciesClient, error) { +func NewManagedDatabaseSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasesecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/managedinstanceadministrators/client.go b/resource-manager/sql/2017-03-01-preview/managedinstanceadministrators/client.go index 3f36bed3138..e168d22b382 100644 --- a/resource-manager/sql/2017-03-01-preview/managedinstanceadministrators/client.go +++ b/resource-manager/sql/2017-03-01-preview/managedinstanceadministrators/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceAdministratorsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceAdministratorsClientWithBaseURI(api environments.Api) (*ManagedInstanceAdministratorsClient, error) { +func NewManagedInstanceAdministratorsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceAdministratorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceadministrators", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceAdministratorsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go b/resource-manager/sql/2017-03-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go index 4c4d6fc96ab..670015f9777 100644 --- a/resource-manager/sql/2017-03-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go +++ b/resource-manager/sql/2017-03-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient stru Client *resourcemanager.Client } -func NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient, error) { +func NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedrestorabledroppeddatabasebackupshorttermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/managedserversecurityalertpolicies/client.go b/resource-manager/sql/2017-03-01-preview/managedserversecurityalertpolicies/client.go index 682f5dca4f1..05b3b5ac499 100644 --- a/resource-manager/sql/2017-03-01-preview/managedserversecurityalertpolicies/client.go +++ b/resource-manager/sql/2017-03-01-preview/managedserversecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedServerSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedServerSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*ManagedServerSecurityAlertPoliciesClient, error) { +func NewManagedServerSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedServerSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedserversecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedServerSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/restorabledroppedmanageddatabases/client.go b/resource-manager/sql/2017-03-01-preview/restorabledroppedmanageddatabases/client.go index efe2c49c9e7..dfba7b21805 100644 --- a/resource-manager/sql/2017-03-01-preview/restorabledroppedmanageddatabases/client.go +++ b/resource-manager/sql/2017-03-01-preview/restorabledroppedmanageddatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RestorableDroppedManagedDatabasesClient struct { Client *resourcemanager.Client } -func NewRestorableDroppedManagedDatabasesClientWithBaseURI(api environments.Api) (*RestorableDroppedManagedDatabasesClient, error) { +func NewRestorableDroppedManagedDatabasesClientWithBaseURI(api sdkEnv.Api) (*RestorableDroppedManagedDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "restorabledroppedmanageddatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RestorableDroppedManagedDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/restorepoints/client.go b/resource-manager/sql/2017-03-01-preview/restorepoints/client.go index 48f2cb36b23..c9547779bf4 100644 --- a/resource-manager/sql/2017-03-01-preview/restorepoints/client.go +++ b/resource-manager/sql/2017-03-01-preview/restorepoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RestorePointsClient struct { Client *resourcemanager.Client } -func NewRestorePointsClientWithBaseURI(api environments.Api) (*RestorePointsClient, error) { +func NewRestorePointsClientWithBaseURI(api sdkEnv.Api) (*RestorePointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "restorepoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RestorePointsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/sensitivitylabels/client.go b/resource-manager/sql/2017-03-01-preview/sensitivitylabels/client.go index 53b1fe6d1ae..62811ab7985 100644 --- a/resource-manager/sql/2017-03-01-preview/sensitivitylabels/client.go +++ b/resource-manager/sql/2017-03-01-preview/sensitivitylabels/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SensitivityLabelsClient struct { Client *resourcemanager.Client } -func NewSensitivityLabelsClientWithBaseURI(api environments.Api) (*SensitivityLabelsClient, error) { +func NewSensitivityLabelsClientWithBaseURI(api sdkEnv.Api) (*SensitivityLabelsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sensitivitylabels", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SensitivityLabelsClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/serverautomatictuning/client.go b/resource-manager/sql/2017-03-01-preview/serverautomatictuning/client.go index 521f5b2122c..e9b57bc0a61 100644 --- a/resource-manager/sql/2017-03-01-preview/serverautomatictuning/client.go +++ b/resource-manager/sql/2017-03-01-preview/serverautomatictuning/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerAutomaticTuningClient struct { Client *resourcemanager.Client } -func NewServerAutomaticTuningClientWithBaseURI(api environments.Api) (*ServerAutomaticTuningClient, error) { +func NewServerAutomaticTuningClientWithBaseURI(api sdkEnv.Api) (*ServerAutomaticTuningClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverautomatictuning", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerAutomaticTuningClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/serverdnsaliases/client.go b/resource-manager/sql/2017-03-01-preview/serverdnsaliases/client.go index 08d964c99ca..466e1c505ff 100644 --- a/resource-manager/sql/2017-03-01-preview/serverdnsaliases/client.go +++ b/resource-manager/sql/2017-03-01-preview/serverdnsaliases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerDnsAliasesClient struct { Client *resourcemanager.Client } -func NewServerDnsAliasesClientWithBaseURI(api environments.Api) (*ServerDnsAliasesClient, error) { +func NewServerDnsAliasesClientWithBaseURI(api sdkEnv.Api) (*ServerDnsAliasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverdnsaliases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerDnsAliasesClient: %+v", err) diff --git a/resource-manager/sql/2017-03-01-preview/serversecurityalertpolicies/client.go b/resource-manager/sql/2017-03-01-preview/serversecurityalertpolicies/client.go index 39566058ad5..14a7b7cdb0b 100644 --- a/resource-manager/sql/2017-03-01-preview/serversecurityalertpolicies/client.go +++ b/resource-manager/sql/2017-03-01-preview/serversecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewServerSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*ServerSecurityAlertPoliciesClient, error) { +func NewServerSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*ServerSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serversecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/client.go b/resource-manager/sql/2018-06-01-preview/client.go index 7887dcdf828..a4ddda87d56 100644 --- a/resource-manager/sql/2018-06-01-preview/client.go +++ b/resource-manager/sql/2018-06-01-preview/client.go @@ -31,7 +31,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2018-06-01-preview/servervulnerabilityassessments" "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2018-06-01-preview/usages" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -61,7 +61,7 @@ type Client struct { Usages *usages.UsagesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { databaseColumnsClient, err := databasecolumns.NewDatabaseColumnsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DatabaseColumns client: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/databasecolumns/client.go b/resource-manager/sql/2018-06-01-preview/databasecolumns/client.go index 30fd3899647..97bbbf3702c 100644 --- a/resource-manager/sql/2018-06-01-preview/databasecolumns/client.go +++ b/resource-manager/sql/2018-06-01-preview/databasecolumns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseColumnsClient struct { Client *resourcemanager.Client } -func NewDatabaseColumnsClientWithBaseURI(api environments.Api) (*DatabaseColumnsClient, error) { +func NewDatabaseColumnsClientWithBaseURI(api sdkEnv.Api) (*DatabaseColumnsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasecolumns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseColumnsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/databaseschemas/client.go b/resource-manager/sql/2018-06-01-preview/databaseschemas/client.go index 7ab29b07f75..50dd05342f2 100644 --- a/resource-manager/sql/2018-06-01-preview/databaseschemas/client.go +++ b/resource-manager/sql/2018-06-01-preview/databaseschemas/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSchemasClient struct { Client *resourcemanager.Client } -func NewDatabaseSchemasClientWithBaseURI(api environments.Api) (*DatabaseSchemasClient, error) { +func NewDatabaseSchemasClientWithBaseURI(api sdkEnv.Api) (*DatabaseSchemasClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseschemas", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSchemasClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/databasesecurityalertpolicies/client.go b/resource-manager/sql/2018-06-01-preview/databasesecurityalertpolicies/client.go index 725816aac0a..5760ab45ff7 100644 --- a/resource-manager/sql/2018-06-01-preview/databasesecurityalertpolicies/client.go +++ b/resource-manager/sql/2018-06-01-preview/databasesecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewDatabaseSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*DatabaseSecurityAlertPoliciesClient, error) { +func NewDatabaseSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*DatabaseSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasesecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/databasetables/client.go b/resource-manager/sql/2018-06-01-preview/databasetables/client.go index 4f5f9c46fa1..f91a2c5f51a 100644 --- a/resource-manager/sql/2018-06-01-preview/databasetables/client.go +++ b/resource-manager/sql/2018-06-01-preview/databasetables/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseTablesClient struct { Client *resourcemanager.Client } -func NewDatabaseTablesClientWithBaseURI(api environments.Api) (*DatabaseTablesClient, error) { +func NewDatabaseTablesClientWithBaseURI(api sdkEnv.Api) (*DatabaseTablesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasetables", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseTablesClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/failoverdatabases/client.go b/resource-manager/sql/2018-06-01-preview/failoverdatabases/client.go index 016042916b1..c3c4612851e 100644 --- a/resource-manager/sql/2018-06-01-preview/failoverdatabases/client.go +++ b/resource-manager/sql/2018-06-01-preview/failoverdatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FailoverDatabasesClient struct { Client *resourcemanager.Client } -func NewFailoverDatabasesClientWithBaseURI(api environments.Api) (*FailoverDatabasesClient, error) { +func NewFailoverDatabasesClientWithBaseURI(api sdkEnv.Api) (*FailoverDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "failoverdatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FailoverDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/failoverelasticpools/client.go b/resource-manager/sql/2018-06-01-preview/failoverelasticpools/client.go index 8ead48e84e0..6100458e2e5 100644 --- a/resource-manager/sql/2018-06-01-preview/failoverelasticpools/client.go +++ b/resource-manager/sql/2018-06-01-preview/failoverelasticpools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FailoverElasticPoolsClient struct { Client *resourcemanager.Client } -func NewFailoverElasticPoolsClientWithBaseURI(api environments.Api) (*FailoverElasticPoolsClient, error) { +func NewFailoverElasticPoolsClientWithBaseURI(api sdkEnv.Api) (*FailoverElasticPoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "failoverelasticpools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FailoverElasticPoolsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/instancepools/client.go b/resource-manager/sql/2018-06-01-preview/instancepools/client.go index 5d154feeb14..de3377d037d 100644 --- a/resource-manager/sql/2018-06-01-preview/instancepools/client.go +++ b/resource-manager/sql/2018-06-01-preview/instancepools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type InstancePoolsClient struct { Client *resourcemanager.Client } -func NewInstancePoolsClientWithBaseURI(api environments.Api) (*InstancePoolsClient, error) { +func NewInstancePoolsClientWithBaseURI(api sdkEnv.Api) (*InstancePoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "instancepools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating InstancePoolsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/locationcapabilities/client.go b/resource-manager/sql/2018-06-01-preview/locationcapabilities/client.go index 7cd99f7aac2..c15d86af0d3 100644 --- a/resource-manager/sql/2018-06-01-preview/locationcapabilities/client.go +++ b/resource-manager/sql/2018-06-01-preview/locationcapabilities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationCapabilitiesClient struct { Client *resourcemanager.Client } -func NewLocationCapabilitiesClientWithBaseURI(api environments.Api) (*LocationCapabilitiesClient, error) { +func NewLocationCapabilitiesClientWithBaseURI(api sdkEnv.Api) (*LocationCapabilitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locationcapabilities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationCapabilitiesClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/longtermretentionmanagedinstancebackups/client.go b/resource-manager/sql/2018-06-01-preview/longtermretentionmanagedinstancebackups/client.go index 30ae6a1a604..b4c84ba3d9e 100644 --- a/resource-manager/sql/2018-06-01-preview/longtermretentionmanagedinstancebackups/client.go +++ b/resource-manager/sql/2018-06-01-preview/longtermretentionmanagedinstancebackups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LongTermRetentionManagedInstanceBackupsClient struct { Client *resourcemanager.Client } -func NewLongTermRetentionManagedInstanceBackupsClientWithBaseURI(api environments.Api) (*LongTermRetentionManagedInstanceBackupsClient, error) { +func NewLongTermRetentionManagedInstanceBackupsClientWithBaseURI(api sdkEnv.Api) (*LongTermRetentionManagedInstanceBackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "longtermretentionmanagedinstancebackups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LongTermRetentionManagedInstanceBackupsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/manageddatabasecolumns/client.go b/resource-manager/sql/2018-06-01-preview/manageddatabasecolumns/client.go index 4864ec5542b..538bf11dddd 100644 --- a/resource-manager/sql/2018-06-01-preview/manageddatabasecolumns/client.go +++ b/resource-manager/sql/2018-06-01-preview/manageddatabasecolumns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseColumnsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseColumnsClientWithBaseURI(api environments.Api) (*ManagedDatabaseColumnsClient, error) { +func NewManagedDatabaseColumnsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseColumnsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasecolumns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseColumnsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/manageddatabaserestoredetails/client.go b/resource-manager/sql/2018-06-01-preview/manageddatabaserestoredetails/client.go index ddf71605817..d81d7cf5c19 100644 --- a/resource-manager/sql/2018-06-01-preview/manageddatabaserestoredetails/client.go +++ b/resource-manager/sql/2018-06-01-preview/manageddatabaserestoredetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseRestoreDetailsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseRestoreDetailsClientWithBaseURI(api environments.Api) (*ManagedDatabaseRestoreDetailsClient, error) { +func NewManagedDatabaseRestoreDetailsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseRestoreDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabaserestoredetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseRestoreDetailsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/manageddatabases/client.go b/resource-manager/sql/2018-06-01-preview/manageddatabases/client.go index 09fd490cf51..0881fcb5f69 100644 --- a/resource-manager/sql/2018-06-01-preview/manageddatabases/client.go +++ b/resource-manager/sql/2018-06-01-preview/manageddatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabasesClient struct { Client *resourcemanager.Client } -func NewManagedDatabasesClientWithBaseURI(api environments.Api) (*ManagedDatabasesClient, error) { +func NewManagedDatabasesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/manageddatabaseschemas/client.go b/resource-manager/sql/2018-06-01-preview/manageddatabaseschemas/client.go index 80428f02fe3..9eeef1def07 100644 --- a/resource-manager/sql/2018-06-01-preview/manageddatabaseschemas/client.go +++ b/resource-manager/sql/2018-06-01-preview/manageddatabaseschemas/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseSchemasClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseSchemasClientWithBaseURI(api environments.Api) (*ManagedDatabaseSchemasClient, error) { +func NewManagedDatabaseSchemasClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseSchemasClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabaseschemas", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseSchemasClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/manageddatabasesensitivitylabels/client.go b/resource-manager/sql/2018-06-01-preview/manageddatabasesensitivitylabels/client.go index 78458860b4a..8874421491f 100644 --- a/resource-manager/sql/2018-06-01-preview/manageddatabasesensitivitylabels/client.go +++ b/resource-manager/sql/2018-06-01-preview/manageddatabasesensitivitylabels/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseSensitivityLabelsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseSensitivityLabelsClientWithBaseURI(api environments.Api) (*ManagedDatabaseSensitivityLabelsClient, error) { +func NewManagedDatabaseSensitivityLabelsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseSensitivityLabelsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasesensitivitylabels", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseSensitivityLabelsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/manageddatabasetables/client.go b/resource-manager/sql/2018-06-01-preview/manageddatabasetables/client.go index 1d9380f7cf1..1db4d4f81b0 100644 --- a/resource-manager/sql/2018-06-01-preview/manageddatabasetables/client.go +++ b/resource-manager/sql/2018-06-01-preview/manageddatabasetables/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseTablesClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseTablesClientWithBaseURI(api environments.Api) (*ManagedDatabaseTablesClient, error) { +func NewManagedDatabaseTablesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseTablesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasetables", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseTablesClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/managedinstancelongtermretentionpolicies/client.go b/resource-manager/sql/2018-06-01-preview/managedinstancelongtermretentionpolicies/client.go index 3158e1f6865..9903b619463 100644 --- a/resource-manager/sql/2018-06-01-preview/managedinstancelongtermretentionpolicies/client.go +++ b/resource-manager/sql/2018-06-01-preview/managedinstancelongtermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceLongTermRetentionPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedInstanceLongTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*ManagedInstanceLongTermRetentionPoliciesClient, error) { +func NewManagedInstanceLongTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceLongTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstancelongtermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceLongTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/managedinstanceoperations/client.go b/resource-manager/sql/2018-06-01-preview/managedinstanceoperations/client.go index 0472d9b9de6..29c7670fb92 100644 --- a/resource-manager/sql/2018-06-01-preview/managedinstanceoperations/client.go +++ b/resource-manager/sql/2018-06-01-preview/managedinstanceoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceOperationsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceOperationsClientWithBaseURI(api environments.Api) (*ManagedInstanceOperationsClient, error) { +func NewManagedInstanceOperationsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceOperationsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/managedinstances/client.go b/resource-manager/sql/2018-06-01-preview/managedinstances/client.go index f70c188e883..e3235f1761f 100644 --- a/resource-manager/sql/2018-06-01-preview/managedinstances/client.go +++ b/resource-manager/sql/2018-06-01-preview/managedinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstancesClient struct { Client *resourcemanager.Client } -func NewManagedInstancesClientWithBaseURI(api environments.Api) (*ManagedInstancesClient, error) { +func NewManagedInstancesClientWithBaseURI(api sdkEnv.Api) (*ManagedInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstancesClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/managedinstancevulnerabilityassessments/client.go b/resource-manager/sql/2018-06-01-preview/managedinstancevulnerabilityassessments/client.go index dba1801866f..2ed4e36149a 100644 --- a/resource-manager/sql/2018-06-01-preview/managedinstancevulnerabilityassessments/client.go +++ b/resource-manager/sql/2018-06-01-preview/managedinstancevulnerabilityassessments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceVulnerabilityAssessmentsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceVulnerabilityAssessmentsClientWithBaseURI(api environments.Api) (*ManagedInstanceVulnerabilityAssessmentsClient, error) { +func NewManagedInstanceVulnerabilityAssessmentsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceVulnerabilityAssessmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstancevulnerabilityassessments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceVulnerabilityAssessmentsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/privateendpointconnections/client.go b/resource-manager/sql/2018-06-01-preview/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/sql/2018-06-01-preview/privateendpointconnections/client.go +++ b/resource-manager/sql/2018-06-01-preview/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/privatelinkresources/client.go b/resource-manager/sql/2018-06-01-preview/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/sql/2018-06-01-preview/privatelinkresources/client.go +++ b/resource-manager/sql/2018-06-01-preview/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/serverazureadadministrators/client.go b/resource-manager/sql/2018-06-01-preview/serverazureadadministrators/client.go index fe5a9d1e7a9..2573ae2ca5b 100644 --- a/resource-manager/sql/2018-06-01-preview/serverazureadadministrators/client.go +++ b/resource-manager/sql/2018-06-01-preview/serverazureadadministrators/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerAzureADAdministratorsClient struct { Client *resourcemanager.Client } -func NewServerAzureADAdministratorsClientWithBaseURI(api environments.Api) (*ServerAzureADAdministratorsClient, error) { +func NewServerAzureADAdministratorsClientWithBaseURI(api sdkEnv.Api) (*ServerAzureADAdministratorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverazureadadministrators", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerAzureADAdministratorsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/servervulnerabilityassessments/client.go b/resource-manager/sql/2018-06-01-preview/servervulnerabilityassessments/client.go index d6add06fcde..e608a74baf3 100644 --- a/resource-manager/sql/2018-06-01-preview/servervulnerabilityassessments/client.go +++ b/resource-manager/sql/2018-06-01-preview/servervulnerabilityassessments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerVulnerabilityAssessmentsClient struct { Client *resourcemanager.Client } -func NewServerVulnerabilityAssessmentsClientWithBaseURI(api environments.Api) (*ServerVulnerabilityAssessmentsClient, error) { +func NewServerVulnerabilityAssessmentsClientWithBaseURI(api sdkEnv.Api) (*ServerVulnerabilityAssessmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servervulnerabilityassessments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerVulnerabilityAssessmentsClient: %+v", err) diff --git a/resource-manager/sql/2018-06-01-preview/usages/client.go b/resource-manager/sql/2018-06-01-preview/usages/client.go index 99b2625224d..9319b1a1f51 100644 --- a/resource-manager/sql/2018-06-01-preview/usages/client.go +++ b/resource-manager/sql/2018-06-01-preview/usages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsagesClient struct { Client *resourcemanager.Client } -func NewUsagesClientWithBaseURI(api environments.Api) (*UsagesClient, error) { +func NewUsagesClientWithBaseURI(api sdkEnv.Api) (*UsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsagesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/backupshorttermretentionpolicies/client.go b/resource-manager/sql/2021-02-01-preview/backupshorttermretentionpolicies/client.go index 1618e4eba1c..cac3154780e 100644 --- a/resource-manager/sql/2021-02-01-preview/backupshorttermretentionpolicies/client.go +++ b/resource-manager/sql/2021-02-01-preview/backupshorttermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupShortTermRetentionPoliciesClient struct { Client *resourcemanager.Client } -func NewBackupShortTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*BackupShortTermRetentionPoliciesClient, error) { +func NewBackupShortTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*BackupShortTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backupshorttermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupShortTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/blobauditing/client.go b/resource-manager/sql/2021-02-01-preview/blobauditing/client.go index 827a9af09ae..51286580a86 100644 --- a/resource-manager/sql/2021-02-01-preview/blobauditing/client.go +++ b/resource-manager/sql/2021-02-01-preview/blobauditing/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BlobAuditingClient struct { Client *resourcemanager.Client } -func NewBlobAuditingClientWithBaseURI(api environments.Api) (*BlobAuditingClient, error) { +func NewBlobAuditingClientWithBaseURI(api sdkEnv.Api) (*BlobAuditingClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "blobauditing", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BlobAuditingClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/client.go b/resource-manager/sql/2021-02-01-preview/client.go index 84b802d895c..0310fa53e1c 100644 --- a/resource-manager/sql/2021-02-01-preview/client.go +++ b/resource-manager/sql/2021-02-01-preview/client.go @@ -109,7 +109,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2021-02-01-preview/workloadclassifiers" "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2021-02-01-preview/workloadgroups" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -217,7 +217,7 @@ type Client struct { WorkloadGroups *workloadgroups.WorkloadGroupsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { backupShortTermRetentionPoliciesClient, err := backupshorttermretentionpolicies.NewBackupShortTermRetentionPoliciesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building BackupShortTermRetentionPolicies client: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databaseadvisors/client.go b/resource-manager/sql/2021-02-01-preview/databaseadvisors/client.go index 3cf12671bd2..684bb4b1b11 100644 --- a/resource-manager/sql/2021-02-01-preview/databaseadvisors/client.go +++ b/resource-manager/sql/2021-02-01-preview/databaseadvisors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseAdvisorsClient struct { Client *resourcemanager.Client } -func NewDatabaseAdvisorsClientWithBaseURI(api environments.Api) (*DatabaseAdvisorsClient, error) { +func NewDatabaseAdvisorsClientWithBaseURI(api sdkEnv.Api) (*DatabaseAdvisorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseadvisors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseAdvisorsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databaseautomatictuning/client.go b/resource-manager/sql/2021-02-01-preview/databaseautomatictuning/client.go index 7b44f38e124..4d92b71dd80 100644 --- a/resource-manager/sql/2021-02-01-preview/databaseautomatictuning/client.go +++ b/resource-manager/sql/2021-02-01-preview/databaseautomatictuning/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseAutomaticTuningClient struct { Client *resourcemanager.Client } -func NewDatabaseAutomaticTuningClientWithBaseURI(api environments.Api) (*DatabaseAutomaticTuningClient, error) { +func NewDatabaseAutomaticTuningClientWithBaseURI(api sdkEnv.Api) (*DatabaseAutomaticTuningClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseautomatictuning", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseAutomaticTuningClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databasecolumns/client.go b/resource-manager/sql/2021-02-01-preview/databasecolumns/client.go index 30fd3899647..97bbbf3702c 100644 --- a/resource-manager/sql/2021-02-01-preview/databasecolumns/client.go +++ b/resource-manager/sql/2021-02-01-preview/databasecolumns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseColumnsClient struct { Client *resourcemanager.Client } -func NewDatabaseColumnsClientWithBaseURI(api environments.Api) (*DatabaseColumnsClient, error) { +func NewDatabaseColumnsClientWithBaseURI(api sdkEnv.Api) (*DatabaseColumnsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasecolumns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseColumnsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databaseextensions/client.go b/resource-manager/sql/2021-02-01-preview/databaseextensions/client.go index f21053bbffa..647a32ddf82 100644 --- a/resource-manager/sql/2021-02-01-preview/databaseextensions/client.go +++ b/resource-manager/sql/2021-02-01-preview/databaseextensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseExtensionsClient struct { Client *resourcemanager.Client } -func NewDatabaseExtensionsClientWithBaseURI(api environments.Api) (*DatabaseExtensionsClient, error) { +func NewDatabaseExtensionsClientWithBaseURI(api sdkEnv.Api) (*DatabaseExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseextensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseExtensionsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databaseoperations/client.go b/resource-manager/sql/2021-02-01-preview/databaseoperations/client.go index 5161347e5a1..2cd7a9e3235 100644 --- a/resource-manager/sql/2021-02-01-preview/databaseoperations/client.go +++ b/resource-manager/sql/2021-02-01-preview/databaseoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseOperationsClient struct { Client *resourcemanager.Client } -func NewDatabaseOperationsClientWithBaseURI(api environments.Api) (*DatabaseOperationsClient, error) { +func NewDatabaseOperationsClientWithBaseURI(api sdkEnv.Api) (*DatabaseOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseOperationsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databaserecommendedactions/client.go b/resource-manager/sql/2021-02-01-preview/databaserecommendedactions/client.go index 84c938da8c1..986053a05bc 100644 --- a/resource-manager/sql/2021-02-01-preview/databaserecommendedactions/client.go +++ b/resource-manager/sql/2021-02-01-preview/databaserecommendedactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseRecommendedActionsClient struct { Client *resourcemanager.Client } -func NewDatabaseRecommendedActionsClientWithBaseURI(api environments.Api) (*DatabaseRecommendedActionsClient, error) { +func NewDatabaseRecommendedActionsClientWithBaseURI(api sdkEnv.Api) (*DatabaseRecommendedActionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaserecommendedactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseRecommendedActionsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databases/client.go b/resource-manager/sql/2021-02-01-preview/databases/client.go index bb94a331f78..6f48891ebd3 100644 --- a/resource-manager/sql/2021-02-01-preview/databases/client.go +++ b/resource-manager/sql/2021-02-01-preview/databases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabasesClient struct { Client *resourcemanager.Client } -func NewDatabasesClientWithBaseURI(api environments.Api) (*DatabasesClient, error) { +func NewDatabasesClientWithBaseURI(api sdkEnv.Api) (*DatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databaseschemas/client.go b/resource-manager/sql/2021-02-01-preview/databaseschemas/client.go index 7ab29b07f75..50dd05342f2 100644 --- a/resource-manager/sql/2021-02-01-preview/databaseschemas/client.go +++ b/resource-manager/sql/2021-02-01-preview/databaseschemas/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSchemasClient struct { Client *resourcemanager.Client } -func NewDatabaseSchemasClientWithBaseURI(api environments.Api) (*DatabaseSchemasClient, error) { +func NewDatabaseSchemasClientWithBaseURI(api sdkEnv.Api) (*DatabaseSchemasClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseschemas", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSchemasClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databasesecurityalertpolicies/client.go b/resource-manager/sql/2021-02-01-preview/databasesecurityalertpolicies/client.go index 725816aac0a..5760ab45ff7 100644 --- a/resource-manager/sql/2021-02-01-preview/databasesecurityalertpolicies/client.go +++ b/resource-manager/sql/2021-02-01-preview/databasesecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewDatabaseSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*DatabaseSecurityAlertPoliciesClient, error) { +func NewDatabaseSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*DatabaseSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasesecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databasetables/client.go b/resource-manager/sql/2021-02-01-preview/databasetables/client.go index 4f5f9c46fa1..f91a2c5f51a 100644 --- a/resource-manager/sql/2021-02-01-preview/databasetables/client.go +++ b/resource-manager/sql/2021-02-01-preview/databasetables/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseTablesClient struct { Client *resourcemanager.Client } -func NewDatabaseTablesClientWithBaseURI(api environments.Api) (*DatabaseTablesClient, error) { +func NewDatabaseTablesClientWithBaseURI(api sdkEnv.Api) (*DatabaseTablesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasetables", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseTablesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databaseusages/client.go b/resource-manager/sql/2021-02-01-preview/databaseusages/client.go index 079453d5c9b..a742adc356c 100644 --- a/resource-manager/sql/2021-02-01-preview/databaseusages/client.go +++ b/resource-manager/sql/2021-02-01-preview/databaseusages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseUsagesClient struct { Client *resourcemanager.Client } -func NewDatabaseUsagesClientWithBaseURI(api environments.Api) (*DatabaseUsagesClient, error) { +func NewDatabaseUsagesClientWithBaseURI(api sdkEnv.Api) (*DatabaseUsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseusages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseUsagesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessmentrulebaselines/client.go b/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessmentrulebaselines/client.go index 2d3eb562821..53eb028d10e 100644 --- a/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessmentrulebaselines/client.go +++ b/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessmentrulebaselines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseVulnerabilityAssessmentRuleBaselinesClient struct { Client *resourcemanager.Client } -func NewDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(api environments.Api) (*DatabaseVulnerabilityAssessmentRuleBaselinesClient, error) { +func NewDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(api sdkEnv.Api) (*DatabaseVulnerabilityAssessmentRuleBaselinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasevulnerabilityassessmentrulebaselines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseVulnerabilityAssessmentRuleBaselinesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessments/client.go b/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessments/client.go index 2a9ec654f8a..47d094dc471 100644 --- a/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessments/client.go +++ b/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseVulnerabilityAssessmentsClient struct { Client *resourcemanager.Client } -func NewDatabaseVulnerabilityAssessmentsClientWithBaseURI(api environments.Api) (*DatabaseVulnerabilityAssessmentsClient, error) { +func NewDatabaseVulnerabilityAssessmentsClientWithBaseURI(api sdkEnv.Api) (*DatabaseVulnerabilityAssessmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasevulnerabilityassessments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseVulnerabilityAssessmentsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessmentscans/client.go b/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessmentscans/client.go index e3b7a5f9dce..4b53861478c 100644 --- a/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessmentscans/client.go +++ b/resource-manager/sql/2021-02-01-preview/databasevulnerabilityassessmentscans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseVulnerabilityAssessmentScansClient struct { Client *resourcemanager.Client } -func NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI(api environments.Api) (*DatabaseVulnerabilityAssessmentScansClient, error) { +func NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI(api sdkEnv.Api) (*DatabaseVulnerabilityAssessmentScansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasevulnerabilityassessmentscans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseVulnerabilityAssessmentScansClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/datawarehouseuseractivities/client.go b/resource-manager/sql/2021-02-01-preview/datawarehouseuseractivities/client.go index cd30b370888..a7ce6c8c236 100644 --- a/resource-manager/sql/2021-02-01-preview/datawarehouseuseractivities/client.go +++ b/resource-manager/sql/2021-02-01-preview/datawarehouseuseractivities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataWarehouseUserActivitiesClient struct { Client *resourcemanager.Client } -func NewDataWarehouseUserActivitiesClientWithBaseURI(api environments.Api) (*DataWarehouseUserActivitiesClient, error) { +func NewDataWarehouseUserActivitiesClientWithBaseURI(api sdkEnv.Api) (*DataWarehouseUserActivitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datawarehouseuseractivities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataWarehouseUserActivitiesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/deletedservers/client.go b/resource-manager/sql/2021-02-01-preview/deletedservers/client.go index 4e4fc6974db..3fbca6fd290 100644 --- a/resource-manager/sql/2021-02-01-preview/deletedservers/client.go +++ b/resource-manager/sql/2021-02-01-preview/deletedservers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeletedServersClient struct { Client *resourcemanager.Client } -func NewDeletedServersClientWithBaseURI(api environments.Api) (*DeletedServersClient, error) { +func NewDeletedServersClientWithBaseURI(api sdkEnv.Api) (*DeletedServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "deletedservers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeletedServersClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/elasticpooloperations/client.go b/resource-manager/sql/2021-02-01-preview/elasticpooloperations/client.go index 5bf893f1479..42451de51a5 100644 --- a/resource-manager/sql/2021-02-01-preview/elasticpooloperations/client.go +++ b/resource-manager/sql/2021-02-01-preview/elasticpooloperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ElasticPoolOperationsClient struct { Client *resourcemanager.Client } -func NewElasticPoolOperationsClientWithBaseURI(api environments.Api) (*ElasticPoolOperationsClient, error) { +func NewElasticPoolOperationsClientWithBaseURI(api sdkEnv.Api) (*ElasticPoolOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "elasticpooloperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ElasticPoolOperationsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/elasticpools/client.go b/resource-manager/sql/2021-02-01-preview/elasticpools/client.go index 88d05246e2e..8ab632442a0 100644 --- a/resource-manager/sql/2021-02-01-preview/elasticpools/client.go +++ b/resource-manager/sql/2021-02-01-preview/elasticpools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ElasticPoolsClient struct { Client *resourcemanager.Client } -func NewElasticPoolsClientWithBaseURI(api environments.Api) (*ElasticPoolsClient, error) { +func NewElasticPoolsClientWithBaseURI(api sdkEnv.Api) (*ElasticPoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "elasticpools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ElasticPoolsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/encryptionprotectors/client.go b/resource-manager/sql/2021-02-01-preview/encryptionprotectors/client.go index 6178e180779..465d9359f7f 100644 --- a/resource-manager/sql/2021-02-01-preview/encryptionprotectors/client.go +++ b/resource-manager/sql/2021-02-01-preview/encryptionprotectors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EncryptionProtectorsClient struct { Client *resourcemanager.Client } -func NewEncryptionProtectorsClientWithBaseURI(api environments.Api) (*EncryptionProtectorsClient, error) { +func NewEncryptionProtectorsClientWithBaseURI(api sdkEnv.Api) (*EncryptionProtectorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "encryptionprotectors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EncryptionProtectorsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/failovergroups/client.go b/resource-manager/sql/2021-02-01-preview/failovergroups/client.go index bdcd78c3d40..84da3095d4e 100644 --- a/resource-manager/sql/2021-02-01-preview/failovergroups/client.go +++ b/resource-manager/sql/2021-02-01-preview/failovergroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FailoverGroupsClient struct { Client *resourcemanager.Client } -func NewFailoverGroupsClientWithBaseURI(api environments.Api) (*FailoverGroupsClient, error) { +func NewFailoverGroupsClientWithBaseURI(api sdkEnv.Api) (*FailoverGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "failovergroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FailoverGroupsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/firewallrules/client.go b/resource-manager/sql/2021-02-01-preview/firewallrules/client.go index 6493e429eb1..86eebdae36a 100644 --- a/resource-manager/sql/2021-02-01-preview/firewallrules/client.go +++ b/resource-manager/sql/2021-02-01-preview/firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallRulesClient struct { Client *resourcemanager.Client } -func NewFirewallRulesClientWithBaseURI(api environments.Api) (*FirewallRulesClient, error) { +func NewFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/instancefailovergroups/client.go b/resource-manager/sql/2021-02-01-preview/instancefailovergroups/client.go index 3b41475a987..085ef1c5b4c 100644 --- a/resource-manager/sql/2021-02-01-preview/instancefailovergroups/client.go +++ b/resource-manager/sql/2021-02-01-preview/instancefailovergroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type InstanceFailoverGroupsClient struct { Client *resourcemanager.Client } -func NewInstanceFailoverGroupsClientWithBaseURI(api environments.Api) (*InstanceFailoverGroupsClient, error) { +func NewInstanceFailoverGroupsClientWithBaseURI(api sdkEnv.Api) (*InstanceFailoverGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "instancefailovergroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating InstanceFailoverGroupsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/instancepools/client.go b/resource-manager/sql/2021-02-01-preview/instancepools/client.go index 5d154feeb14..de3377d037d 100644 --- a/resource-manager/sql/2021-02-01-preview/instancepools/client.go +++ b/resource-manager/sql/2021-02-01-preview/instancepools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type InstancePoolsClient struct { Client *resourcemanager.Client } -func NewInstancePoolsClientWithBaseURI(api environments.Api) (*InstancePoolsClient, error) { +func NewInstancePoolsClientWithBaseURI(api sdkEnv.Api) (*InstancePoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "instancepools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating InstancePoolsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/jobagents/client.go b/resource-manager/sql/2021-02-01-preview/jobagents/client.go index 98054c033a0..5699e8adc22 100644 --- a/resource-manager/sql/2021-02-01-preview/jobagents/client.go +++ b/resource-manager/sql/2021-02-01-preview/jobagents/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobAgentsClient struct { Client *resourcemanager.Client } -func NewJobAgentsClientWithBaseURI(api environments.Api) (*JobAgentsClient, error) { +func NewJobAgentsClientWithBaseURI(api sdkEnv.Api) (*JobAgentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobagents", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobAgentsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/jobcredentials/client.go b/resource-manager/sql/2021-02-01-preview/jobcredentials/client.go index 50266bc8457..9c23c45f48a 100644 --- a/resource-manager/sql/2021-02-01-preview/jobcredentials/client.go +++ b/resource-manager/sql/2021-02-01-preview/jobcredentials/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobCredentialsClient struct { Client *resourcemanager.Client } -func NewJobCredentialsClientWithBaseURI(api environments.Api) (*JobCredentialsClient, error) { +func NewJobCredentialsClientWithBaseURI(api sdkEnv.Api) (*JobCredentialsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobcredentials", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobCredentialsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/jobexecutions/client.go b/resource-manager/sql/2021-02-01-preview/jobexecutions/client.go index a747e2f4d38..77afc026dc1 100644 --- a/resource-manager/sql/2021-02-01-preview/jobexecutions/client.go +++ b/resource-manager/sql/2021-02-01-preview/jobexecutions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobExecutionsClient struct { Client *resourcemanager.Client } -func NewJobExecutionsClientWithBaseURI(api environments.Api) (*JobExecutionsClient, error) { +func NewJobExecutionsClientWithBaseURI(api sdkEnv.Api) (*JobExecutionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobexecutions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobExecutionsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/jobs/client.go b/resource-manager/sql/2021-02-01-preview/jobs/client.go index e2cca931b31..a7c521817f9 100644 --- a/resource-manager/sql/2021-02-01-preview/jobs/client.go +++ b/resource-manager/sql/2021-02-01-preview/jobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobsClient struct { Client *resourcemanager.Client } -func NewJobsClientWithBaseURI(api environments.Api) (*JobsClient, error) { +func NewJobsClientWithBaseURI(api sdkEnv.Api) (*JobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/jobstepexecutions/client.go b/resource-manager/sql/2021-02-01-preview/jobstepexecutions/client.go index 747214e6542..04727a0768c 100644 --- a/resource-manager/sql/2021-02-01-preview/jobstepexecutions/client.go +++ b/resource-manager/sql/2021-02-01-preview/jobstepexecutions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobStepExecutionsClient struct { Client *resourcemanager.Client } -func NewJobStepExecutionsClientWithBaseURI(api environments.Api) (*JobStepExecutionsClient, error) { +func NewJobStepExecutionsClientWithBaseURI(api sdkEnv.Api) (*JobStepExecutionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobstepexecutions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobStepExecutionsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/jobsteps/client.go b/resource-manager/sql/2021-02-01-preview/jobsteps/client.go index 288fc5a5c7a..c0fd7cb974a 100644 --- a/resource-manager/sql/2021-02-01-preview/jobsteps/client.go +++ b/resource-manager/sql/2021-02-01-preview/jobsteps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobStepsClient struct { Client *resourcemanager.Client } -func NewJobStepsClientWithBaseURI(api environments.Api) (*JobStepsClient, error) { +func NewJobStepsClientWithBaseURI(api sdkEnv.Api) (*JobStepsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobsteps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobStepsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/jobtargetexecutions/client.go b/resource-manager/sql/2021-02-01-preview/jobtargetexecutions/client.go index 44b20159aa4..acc70a2987e 100644 --- a/resource-manager/sql/2021-02-01-preview/jobtargetexecutions/client.go +++ b/resource-manager/sql/2021-02-01-preview/jobtargetexecutions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobTargetExecutionsClient struct { Client *resourcemanager.Client } -func NewJobTargetExecutionsClientWithBaseURI(api environments.Api) (*JobTargetExecutionsClient, error) { +func NewJobTargetExecutionsClientWithBaseURI(api sdkEnv.Api) (*JobTargetExecutionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobtargetexecutions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobTargetExecutionsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/jobtargetgroups/client.go b/resource-manager/sql/2021-02-01-preview/jobtargetgroups/client.go index b66f9c2418b..2179339ea93 100644 --- a/resource-manager/sql/2021-02-01-preview/jobtargetgroups/client.go +++ b/resource-manager/sql/2021-02-01-preview/jobtargetgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobTargetGroupsClient struct { Client *resourcemanager.Client } -func NewJobTargetGroupsClientWithBaseURI(api environments.Api) (*JobTargetGroupsClient, error) { +func NewJobTargetGroupsClientWithBaseURI(api sdkEnv.Api) (*JobTargetGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobtargetgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobTargetGroupsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/jobversions/client.go b/resource-manager/sql/2021-02-01-preview/jobversions/client.go index eba7cc6e229..fe50e278589 100644 --- a/resource-manager/sql/2021-02-01-preview/jobversions/client.go +++ b/resource-manager/sql/2021-02-01-preview/jobversions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobVersionsClient struct { Client *resourcemanager.Client } -func NewJobVersionsClientWithBaseURI(api environments.Api) (*JobVersionsClient, error) { +func NewJobVersionsClientWithBaseURI(api sdkEnv.Api) (*JobVersionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobversions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobVersionsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/ledgerdigestuploads/client.go b/resource-manager/sql/2021-02-01-preview/ledgerdigestuploads/client.go index 398a6bf63db..943684c3af0 100644 --- a/resource-manager/sql/2021-02-01-preview/ledgerdigestuploads/client.go +++ b/resource-manager/sql/2021-02-01-preview/ledgerdigestuploads/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LedgerDigestUploadsClient struct { Client *resourcemanager.Client } -func NewLedgerDigestUploadsClientWithBaseURI(api environments.Api) (*LedgerDigestUploadsClient, error) { +func NewLedgerDigestUploadsClientWithBaseURI(api sdkEnv.Api) (*LedgerDigestUploadsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ledgerdigestuploads", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LedgerDigestUploadsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/locationcapabilities/client.go b/resource-manager/sql/2021-02-01-preview/locationcapabilities/client.go index 7cd99f7aac2..c15d86af0d3 100644 --- a/resource-manager/sql/2021-02-01-preview/locationcapabilities/client.go +++ b/resource-manager/sql/2021-02-01-preview/locationcapabilities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationCapabilitiesClient struct { Client *resourcemanager.Client } -func NewLocationCapabilitiesClientWithBaseURI(api environments.Api) (*LocationCapabilitiesClient, error) { +func NewLocationCapabilitiesClientWithBaseURI(api sdkEnv.Api) (*LocationCapabilitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locationcapabilities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationCapabilitiesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/longtermretentionbackups/client.go b/resource-manager/sql/2021-02-01-preview/longtermretentionbackups/client.go index 1c4a9a73a65..8ab1793d043 100644 --- a/resource-manager/sql/2021-02-01-preview/longtermretentionbackups/client.go +++ b/resource-manager/sql/2021-02-01-preview/longtermretentionbackups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LongTermRetentionBackupsClient struct { Client *resourcemanager.Client } -func NewLongTermRetentionBackupsClientWithBaseURI(api environments.Api) (*LongTermRetentionBackupsClient, error) { +func NewLongTermRetentionBackupsClientWithBaseURI(api sdkEnv.Api) (*LongTermRetentionBackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "longtermretentionbackups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LongTermRetentionBackupsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/longtermretentionmanagedinstancebackups/client.go b/resource-manager/sql/2021-02-01-preview/longtermretentionmanagedinstancebackups/client.go index 30ae6a1a604..b4c84ba3d9e 100644 --- a/resource-manager/sql/2021-02-01-preview/longtermretentionmanagedinstancebackups/client.go +++ b/resource-manager/sql/2021-02-01-preview/longtermretentionmanagedinstancebackups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LongTermRetentionManagedInstanceBackupsClient struct { Client *resourcemanager.Client } -func NewLongTermRetentionManagedInstanceBackupsClientWithBaseURI(api environments.Api) (*LongTermRetentionManagedInstanceBackupsClient, error) { +func NewLongTermRetentionManagedInstanceBackupsClientWithBaseURI(api sdkEnv.Api) (*LongTermRetentionManagedInstanceBackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "longtermretentionmanagedinstancebackups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LongTermRetentionManagedInstanceBackupsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/longtermretentionpolicies/client.go b/resource-manager/sql/2021-02-01-preview/longtermretentionpolicies/client.go index 2f5372f22cc..4372b0a9782 100644 --- a/resource-manager/sql/2021-02-01-preview/longtermretentionpolicies/client.go +++ b/resource-manager/sql/2021-02-01-preview/longtermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LongTermRetentionPoliciesClient struct { Client *resourcemanager.Client } -func NewLongTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*LongTermRetentionPoliciesClient, error) { +func NewLongTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*LongTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "longtermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LongTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/maintenancewindowoptions/client.go b/resource-manager/sql/2021-02-01-preview/maintenancewindowoptions/client.go index e4b27210bf2..ec456905b54 100644 --- a/resource-manager/sql/2021-02-01-preview/maintenancewindowoptions/client.go +++ b/resource-manager/sql/2021-02-01-preview/maintenancewindowoptions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MaintenanceWindowOptionsClient struct { Client *resourcemanager.Client } -func NewMaintenanceWindowOptionsClientWithBaseURI(api environments.Api) (*MaintenanceWindowOptionsClient, error) { +func NewMaintenanceWindowOptionsClientWithBaseURI(api sdkEnv.Api) (*MaintenanceWindowOptionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "maintenancewindowoptions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MaintenanceWindowOptionsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/maintenancewindows/client.go b/resource-manager/sql/2021-02-01-preview/maintenancewindows/client.go index e83739e60a9..0f7c1623d09 100644 --- a/resource-manager/sql/2021-02-01-preview/maintenancewindows/client.go +++ b/resource-manager/sql/2021-02-01-preview/maintenancewindows/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MaintenanceWindowsClient struct { Client *resourcemanager.Client } -func NewMaintenanceWindowsClientWithBaseURI(api environments.Api) (*MaintenanceWindowsClient, error) { +func NewMaintenanceWindowsClientWithBaseURI(api sdkEnv.Api) (*MaintenanceWindowsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "maintenancewindows", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MaintenanceWindowsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedbackupshorttermretentionpolicies/client.go b/resource-manager/sql/2021-02-01-preview/managedbackupshorttermretentionpolicies/client.go index 0f914d6c4fe..aef1b895d74 100644 --- a/resource-manager/sql/2021-02-01-preview/managedbackupshorttermretentionpolicies/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedbackupshorttermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedBackupShortTermRetentionPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedBackupShortTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*ManagedBackupShortTermRetentionPoliciesClient, error) { +func NewManagedBackupShortTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedBackupShortTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedbackupshorttermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedBackupShortTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabasecolumns/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabasecolumns/client.go index 4864ec5542b..538bf11dddd 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabasecolumns/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabasecolumns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseColumnsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseColumnsClientWithBaseURI(api environments.Api) (*ManagedDatabaseColumnsClient, error) { +func NewManagedDatabaseColumnsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseColumnsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasecolumns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseColumnsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabasequeries/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabasequeries/client.go index 22eee60eb6f..b6cf88a0109 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabasequeries/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabasequeries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseQueriesClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseQueriesClientWithBaseURI(api environments.Api) (*ManagedDatabaseQueriesClient, error) { +func NewManagedDatabaseQueriesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseQueriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasequeries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseQueriesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabaserestoredetails/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabaserestoredetails/client.go index ddf71605817..d81d7cf5c19 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabaserestoredetails/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabaserestoredetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseRestoreDetailsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseRestoreDetailsClientWithBaseURI(api environments.Api) (*ManagedDatabaseRestoreDetailsClient, error) { +func NewManagedDatabaseRestoreDetailsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseRestoreDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabaserestoredetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseRestoreDetailsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabases/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabases/client.go index 09fd490cf51..0881fcb5f69 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabases/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabasesClient struct { Client *resourcemanager.Client } -func NewManagedDatabasesClientWithBaseURI(api environments.Api) (*ManagedDatabasesClient, error) { +func NewManagedDatabasesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabaseschemas/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabaseschemas/client.go index 80428f02fe3..9eeef1def07 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabaseschemas/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabaseschemas/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseSchemasClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseSchemasClientWithBaseURI(api environments.Api) (*ManagedDatabaseSchemasClient, error) { +func NewManagedDatabaseSchemasClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseSchemasClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabaseschemas", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseSchemasClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabasesecurityalertpolicies/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabasesecurityalertpolicies/client.go index 62a2219ec3f..3709e4e4bfd 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabasesecurityalertpolicies/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabasesecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*ManagedDatabaseSecurityAlertPoliciesClient, error) { +func NewManagedDatabaseSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasesecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabasesecurityevents/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabasesecurityevents/client.go index 73c01b9bdf3..6daead92f9d 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabasesecurityevents/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabasesecurityevents/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseSecurityEventsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseSecurityEventsClientWithBaseURI(api environments.Api) (*ManagedDatabaseSecurityEventsClient, error) { +func NewManagedDatabaseSecurityEventsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseSecurityEventsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasesecurityevents", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseSecurityEventsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabasesensitivitylabels/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabasesensitivitylabels/client.go index 78458860b4a..8874421491f 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabasesensitivitylabels/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabasesensitivitylabels/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseSensitivityLabelsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseSensitivityLabelsClientWithBaseURI(api environments.Api) (*ManagedDatabaseSensitivityLabelsClient, error) { +func NewManagedDatabaseSensitivityLabelsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseSensitivityLabelsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasesensitivitylabels", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseSensitivityLabelsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabasetables/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabasetables/client.go index 1d9380f7cf1..1db4d4f81b0 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabasetables/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabasetables/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseTablesClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseTablesClientWithBaseURI(api environments.Api) (*ManagedDatabaseTablesClient, error) { +func NewManagedDatabaseTablesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseTablesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasetables", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseTablesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabasetransparentdataencryption/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabasetransparentdataencryption/client.go index 6c3d3c4b905..fc2685ce80b 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabasetransparentdataencryption/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabasetransparentdataencryption/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseTransparentDataEncryptionClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseTransparentDataEncryptionClientWithBaseURI(api environments.Api) (*ManagedDatabaseTransparentDataEncryptionClient, error) { +func NewManagedDatabaseTransparentDataEncryptionClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseTransparentDataEncryptionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasetransparentdataencryption", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseTransparentDataEncryptionClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/client.go index a6f46fb66ce..1ff05f1b589 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(api environments.Api) (*ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient, error) { +func NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasevulnerabilityassessmentrulebaselines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessments/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessments/client.go index 8e91917ebd7..7bddc409ce9 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessments/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseVulnerabilityAssessmentsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseVulnerabilityAssessmentsClientWithBaseURI(api environments.Api) (*ManagedDatabaseVulnerabilityAssessmentsClient, error) { +func NewManagedDatabaseVulnerabilityAssessmentsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseVulnerabilityAssessmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasevulnerabilityassessments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseVulnerabilityAssessmentsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessmentscans/client.go b/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessmentscans/client.go index 47f1b8fce44..063b024d7a4 100644 --- a/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessmentscans/client.go +++ b/resource-manager/sql/2021-02-01-preview/manageddatabasevulnerabilityassessmentscans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseVulnerabilityAssessmentScansClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseVulnerabilityAssessmentScansClientWithBaseURI(api environments.Api) (*ManagedDatabaseVulnerabilityAssessmentScansClient, error) { +func NewManagedDatabaseVulnerabilityAssessmentScansClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseVulnerabilityAssessmentScansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasevulnerabilityassessmentscans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseVulnerabilityAssessmentScansClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedinstanceadministrators/client.go b/resource-manager/sql/2021-02-01-preview/managedinstanceadministrators/client.go index 3f36bed3138..e168d22b382 100644 --- a/resource-manager/sql/2021-02-01-preview/managedinstanceadministrators/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedinstanceadministrators/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceAdministratorsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceAdministratorsClientWithBaseURI(api environments.Api) (*ManagedInstanceAdministratorsClient, error) { +func NewManagedInstanceAdministratorsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceAdministratorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceadministrators", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceAdministratorsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedinstanceazureadonlyauthentications/client.go b/resource-manager/sql/2021-02-01-preview/managedinstanceazureadonlyauthentications/client.go index 1f985cb8d30..b720ba23aa9 100644 --- a/resource-manager/sql/2021-02-01-preview/managedinstanceazureadonlyauthentications/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedinstanceazureadonlyauthentications/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceAzureADOnlyAuthenticationsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceAzureADOnlyAuthenticationsClientWithBaseURI(api environments.Api) (*ManagedInstanceAzureADOnlyAuthenticationsClient, error) { +func NewManagedInstanceAzureADOnlyAuthenticationsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceAzureADOnlyAuthenticationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceazureadonlyauthentications", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceAzureADOnlyAuthenticationsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedinstanceencryptionprotectors/client.go b/resource-manager/sql/2021-02-01-preview/managedinstanceencryptionprotectors/client.go index ec30a659cfc..97851843a88 100644 --- a/resource-manager/sql/2021-02-01-preview/managedinstanceencryptionprotectors/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedinstanceencryptionprotectors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceEncryptionProtectorsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceEncryptionProtectorsClientWithBaseURI(api environments.Api) (*ManagedInstanceEncryptionProtectorsClient, error) { +func NewManagedInstanceEncryptionProtectorsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceEncryptionProtectorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceencryptionprotectors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceEncryptionProtectorsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedinstancekeys/client.go b/resource-manager/sql/2021-02-01-preview/managedinstancekeys/client.go index 23704f227a5..bcc500b4c35 100644 --- a/resource-manager/sql/2021-02-01-preview/managedinstancekeys/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedinstancekeys/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceKeysClient struct { Client *resourcemanager.Client } -func NewManagedInstanceKeysClientWithBaseURI(api environments.Api) (*ManagedInstanceKeysClient, error) { +func NewManagedInstanceKeysClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceKeysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstancekeys", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceKeysClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedinstancelongtermretentionpolicies/client.go b/resource-manager/sql/2021-02-01-preview/managedinstancelongtermretentionpolicies/client.go index 3158e1f6865..9903b619463 100644 --- a/resource-manager/sql/2021-02-01-preview/managedinstancelongtermretentionpolicies/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedinstancelongtermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceLongTermRetentionPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedInstanceLongTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*ManagedInstanceLongTermRetentionPoliciesClient, error) { +func NewManagedInstanceLongTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceLongTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstancelongtermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceLongTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedinstanceoperations/client.go b/resource-manager/sql/2021-02-01-preview/managedinstanceoperations/client.go index 0472d9b9de6..29c7670fb92 100644 --- a/resource-manager/sql/2021-02-01-preview/managedinstanceoperations/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedinstanceoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceOperationsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceOperationsClientWithBaseURI(api environments.Api) (*ManagedInstanceOperationsClient, error) { +func NewManagedInstanceOperationsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceOperationsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedinstanceprivateendpointconnections/client.go b/resource-manager/sql/2021-02-01-preview/managedinstanceprivateendpointconnections/client.go index 5d1f8bd729e..9d521b320c7 100644 --- a/resource-manager/sql/2021-02-01-preview/managedinstanceprivateendpointconnections/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedinstanceprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstancePrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewManagedInstancePrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*ManagedInstancePrivateEndpointConnectionsClient, error) { +func NewManagedInstancePrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstancePrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstancePrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedinstanceprivatelinkresources/client.go b/resource-manager/sql/2021-02-01-preview/managedinstanceprivatelinkresources/client.go index 2bea9210bdb..e9394f6ccc1 100644 --- a/resource-manager/sql/2021-02-01-preview/managedinstanceprivatelinkresources/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedinstanceprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstancePrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewManagedInstancePrivateLinkResourcesClientWithBaseURI(api environments.Api) (*ManagedInstancePrivateLinkResourcesClient, error) { +func NewManagedInstancePrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*ManagedInstancePrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstancePrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedinstances/client.go b/resource-manager/sql/2021-02-01-preview/managedinstances/client.go index f70c188e883..e3235f1761f 100644 --- a/resource-manager/sql/2021-02-01-preview/managedinstances/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstancesClient struct { Client *resourcemanager.Client } -func NewManagedInstancesClientWithBaseURI(api environments.Api) (*ManagedInstancesClient, error) { +func NewManagedInstancesClientWithBaseURI(api sdkEnv.Api) (*ManagedInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstancesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedinstancetdecertificates/client.go b/resource-manager/sql/2021-02-01-preview/managedinstancetdecertificates/client.go index 0e62a0c3c14..69a9782d30b 100644 --- a/resource-manager/sql/2021-02-01-preview/managedinstancetdecertificates/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedinstancetdecertificates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceTdeCertificatesClient struct { Client *resourcemanager.Client } -func NewManagedInstanceTdeCertificatesClientWithBaseURI(api environments.Api) (*ManagedInstanceTdeCertificatesClient, error) { +func NewManagedInstanceTdeCertificatesClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceTdeCertificatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstancetdecertificates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceTdeCertificatesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedinstancevulnerabilityassessments/client.go b/resource-manager/sql/2021-02-01-preview/managedinstancevulnerabilityassessments/client.go index dba1801866f..2ed4e36149a 100644 --- a/resource-manager/sql/2021-02-01-preview/managedinstancevulnerabilityassessments/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedinstancevulnerabilityassessments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceVulnerabilityAssessmentsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceVulnerabilityAssessmentsClientWithBaseURI(api environments.Api) (*ManagedInstanceVulnerabilityAssessmentsClient, error) { +func NewManagedInstanceVulnerabilityAssessmentsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceVulnerabilityAssessmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstancevulnerabilityassessments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceVulnerabilityAssessmentsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go b/resource-manager/sql/2021-02-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go index 4c4d6fc96ab..670015f9777 100644 --- a/resource-manager/sql/2021-02-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient stru Client *resourcemanager.Client } -func NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient, error) { +func NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedrestorabledroppeddatabasebackupshorttermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/managedserversecurityalertpolicies/client.go b/resource-manager/sql/2021-02-01-preview/managedserversecurityalertpolicies/client.go index 682f5dca4f1..05b3b5ac499 100644 --- a/resource-manager/sql/2021-02-01-preview/managedserversecurityalertpolicies/client.go +++ b/resource-manager/sql/2021-02-01-preview/managedserversecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedServerSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedServerSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*ManagedServerSecurityAlertPoliciesClient, error) { +func NewManagedServerSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedServerSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedserversecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedServerSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/outboundfirewallrules/client.go b/resource-manager/sql/2021-02-01-preview/outboundfirewallrules/client.go index c201a67bd0d..0c4a379b361 100644 --- a/resource-manager/sql/2021-02-01-preview/outboundfirewallrules/client.go +++ b/resource-manager/sql/2021-02-01-preview/outboundfirewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OutboundFirewallRulesClient struct { Client *resourcemanager.Client } -func NewOutboundFirewallRulesClientWithBaseURI(api environments.Api) (*OutboundFirewallRulesClient, error) { +func NewOutboundFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*OutboundFirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "outboundfirewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OutboundFirewallRulesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/privateendpointconnections/client.go b/resource-manager/sql/2021-02-01-preview/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/sql/2021-02-01-preview/privateendpointconnections/client.go +++ b/resource-manager/sql/2021-02-01-preview/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/privatelinkresources/client.go b/resource-manager/sql/2021-02-01-preview/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/sql/2021-02-01-preview/privatelinkresources/client.go +++ b/resource-manager/sql/2021-02-01-preview/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/recoverablemanageddatabases/client.go b/resource-manager/sql/2021-02-01-preview/recoverablemanageddatabases/client.go index b2a8dc495a7..dba4541310e 100644 --- a/resource-manager/sql/2021-02-01-preview/recoverablemanageddatabases/client.go +++ b/resource-manager/sql/2021-02-01-preview/recoverablemanageddatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecoverableManagedDatabasesClient struct { Client *resourcemanager.Client } -func NewRecoverableManagedDatabasesClientWithBaseURI(api environments.Api) (*RecoverableManagedDatabasesClient, error) { +func NewRecoverableManagedDatabasesClientWithBaseURI(api sdkEnv.Api) (*RecoverableManagedDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recoverablemanageddatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecoverableManagedDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/replicationlinks/client.go b/resource-manager/sql/2021-02-01-preview/replicationlinks/client.go index 03f89f79a5a..8c94eb32deb 100644 --- a/resource-manager/sql/2021-02-01-preview/replicationlinks/client.go +++ b/resource-manager/sql/2021-02-01-preview/replicationlinks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReplicationLinksClient struct { Client *resourcemanager.Client } -func NewReplicationLinksClientWithBaseURI(api environments.Api) (*ReplicationLinksClient, error) { +func NewReplicationLinksClientWithBaseURI(api sdkEnv.Api) (*ReplicationLinksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "replicationlinks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReplicationLinksClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/restorabledroppeddatabases/client.go b/resource-manager/sql/2021-02-01-preview/restorabledroppeddatabases/client.go index 99de64c31bb..f57ca75818c 100644 --- a/resource-manager/sql/2021-02-01-preview/restorabledroppeddatabases/client.go +++ b/resource-manager/sql/2021-02-01-preview/restorabledroppeddatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RestorableDroppedDatabasesClient struct { Client *resourcemanager.Client } -func NewRestorableDroppedDatabasesClientWithBaseURI(api environments.Api) (*RestorableDroppedDatabasesClient, error) { +func NewRestorableDroppedDatabasesClientWithBaseURI(api sdkEnv.Api) (*RestorableDroppedDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "restorabledroppeddatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RestorableDroppedDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/restorabledroppedmanageddatabases/client.go b/resource-manager/sql/2021-02-01-preview/restorabledroppedmanageddatabases/client.go index efe2c49c9e7..dfba7b21805 100644 --- a/resource-manager/sql/2021-02-01-preview/restorabledroppedmanageddatabases/client.go +++ b/resource-manager/sql/2021-02-01-preview/restorabledroppedmanageddatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RestorableDroppedManagedDatabasesClient struct { Client *resourcemanager.Client } -func NewRestorableDroppedManagedDatabasesClientWithBaseURI(api environments.Api) (*RestorableDroppedManagedDatabasesClient, error) { +func NewRestorableDroppedManagedDatabasesClientWithBaseURI(api sdkEnv.Api) (*RestorableDroppedManagedDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "restorabledroppedmanageddatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RestorableDroppedManagedDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/restorepoints/client.go b/resource-manager/sql/2021-02-01-preview/restorepoints/client.go index 48f2cb36b23..c9547779bf4 100644 --- a/resource-manager/sql/2021-02-01-preview/restorepoints/client.go +++ b/resource-manager/sql/2021-02-01-preview/restorepoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RestorePointsClient struct { Client *resourcemanager.Client } -func NewRestorePointsClientWithBaseURI(api environments.Api) (*RestorePointsClient, error) { +func NewRestorePointsClientWithBaseURI(api sdkEnv.Api) (*RestorePointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "restorepoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RestorePointsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/sensitivitylabels/client.go b/resource-manager/sql/2021-02-01-preview/sensitivitylabels/client.go index 53b1fe6d1ae..62811ab7985 100644 --- a/resource-manager/sql/2021-02-01-preview/sensitivitylabels/client.go +++ b/resource-manager/sql/2021-02-01-preview/sensitivitylabels/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SensitivityLabelsClient struct { Client *resourcemanager.Client } -func NewSensitivityLabelsClientWithBaseURI(api environments.Api) (*SensitivityLabelsClient, error) { +func NewSensitivityLabelsClientWithBaseURI(api sdkEnv.Api) (*SensitivityLabelsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sensitivitylabels", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SensitivityLabelsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/serveradvisors/client.go b/resource-manager/sql/2021-02-01-preview/serveradvisors/client.go index da2581af35c..4988b0f5a80 100644 --- a/resource-manager/sql/2021-02-01-preview/serveradvisors/client.go +++ b/resource-manager/sql/2021-02-01-preview/serveradvisors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerAdvisorsClient struct { Client *resourcemanager.Client } -func NewServerAdvisorsClientWithBaseURI(api environments.Api) (*ServerAdvisorsClient, error) { +func NewServerAdvisorsClientWithBaseURI(api sdkEnv.Api) (*ServerAdvisorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serveradvisors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerAdvisorsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/serverautomatictuning/client.go b/resource-manager/sql/2021-02-01-preview/serverautomatictuning/client.go index 521f5b2122c..e9b57bc0a61 100644 --- a/resource-manager/sql/2021-02-01-preview/serverautomatictuning/client.go +++ b/resource-manager/sql/2021-02-01-preview/serverautomatictuning/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerAutomaticTuningClient struct { Client *resourcemanager.Client } -func NewServerAutomaticTuningClientWithBaseURI(api environments.Api) (*ServerAutomaticTuningClient, error) { +func NewServerAutomaticTuningClientWithBaseURI(api sdkEnv.Api) (*ServerAutomaticTuningClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverautomatictuning", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerAutomaticTuningClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/serverazureadadministrators/client.go b/resource-manager/sql/2021-02-01-preview/serverazureadadministrators/client.go index fe5a9d1e7a9..2573ae2ca5b 100644 --- a/resource-manager/sql/2021-02-01-preview/serverazureadadministrators/client.go +++ b/resource-manager/sql/2021-02-01-preview/serverazureadadministrators/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerAzureADAdministratorsClient struct { Client *resourcemanager.Client } -func NewServerAzureADAdministratorsClientWithBaseURI(api environments.Api) (*ServerAzureADAdministratorsClient, error) { +func NewServerAzureADAdministratorsClientWithBaseURI(api sdkEnv.Api) (*ServerAzureADAdministratorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverazureadadministrators", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerAzureADAdministratorsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/serverazureadonlyauthentications/client.go b/resource-manager/sql/2021-02-01-preview/serverazureadonlyauthentications/client.go index b5c3d6d2bb3..a895d8f59db 100644 --- a/resource-manager/sql/2021-02-01-preview/serverazureadonlyauthentications/client.go +++ b/resource-manager/sql/2021-02-01-preview/serverazureadonlyauthentications/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerAzureADOnlyAuthenticationsClient struct { Client *resourcemanager.Client } -func NewServerAzureADOnlyAuthenticationsClientWithBaseURI(api environments.Api) (*ServerAzureADOnlyAuthenticationsClient, error) { +func NewServerAzureADOnlyAuthenticationsClientWithBaseURI(api sdkEnv.Api) (*ServerAzureADOnlyAuthenticationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverazureadonlyauthentications", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerAzureADOnlyAuthenticationsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/serverdevopsaudit/client.go b/resource-manager/sql/2021-02-01-preview/serverdevopsaudit/client.go index 6e6009ae7b6..642f119e3f3 100644 --- a/resource-manager/sql/2021-02-01-preview/serverdevopsaudit/client.go +++ b/resource-manager/sql/2021-02-01-preview/serverdevopsaudit/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerDevOpsAuditClient struct { Client *resourcemanager.Client } -func NewServerDevOpsAuditClientWithBaseURI(api environments.Api) (*ServerDevOpsAuditClient, error) { +func NewServerDevOpsAuditClientWithBaseURI(api sdkEnv.Api) (*ServerDevOpsAuditClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverdevopsaudit", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerDevOpsAuditClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/serverdnsaliases/client.go b/resource-manager/sql/2021-02-01-preview/serverdnsaliases/client.go index 08d964c99ca..466e1c505ff 100644 --- a/resource-manager/sql/2021-02-01-preview/serverdnsaliases/client.go +++ b/resource-manager/sql/2021-02-01-preview/serverdnsaliases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerDnsAliasesClient struct { Client *resourcemanager.Client } -func NewServerDnsAliasesClientWithBaseURI(api environments.Api) (*ServerDnsAliasesClient, error) { +func NewServerDnsAliasesClientWithBaseURI(api sdkEnv.Api) (*ServerDnsAliasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverdnsaliases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerDnsAliasesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/serverkeys/client.go b/resource-manager/sql/2021-02-01-preview/serverkeys/client.go index 2d13d1376e4..bdf57b964b5 100644 --- a/resource-manager/sql/2021-02-01-preview/serverkeys/client.go +++ b/resource-manager/sql/2021-02-01-preview/serverkeys/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerKeysClient struct { Client *resourcemanager.Client } -func NewServerKeysClientWithBaseURI(api environments.Api) (*ServerKeysClient, error) { +func NewServerKeysClientWithBaseURI(api sdkEnv.Api) (*ServerKeysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverkeys", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerKeysClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/serveroperations/client.go b/resource-manager/sql/2021-02-01-preview/serveroperations/client.go index 8110e209e12..cd60890eae4 100644 --- a/resource-manager/sql/2021-02-01-preview/serveroperations/client.go +++ b/resource-manager/sql/2021-02-01-preview/serveroperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerOperationsClient struct { Client *resourcemanager.Client } -func NewServerOperationsClientWithBaseURI(api environments.Api) (*ServerOperationsClient, error) { +func NewServerOperationsClientWithBaseURI(api sdkEnv.Api) (*ServerOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serveroperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerOperationsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/servers/client.go b/resource-manager/sql/2021-02-01-preview/servers/client.go index a1e11668771..0788963b1fb 100644 --- a/resource-manager/sql/2021-02-01-preview/servers/client.go +++ b/resource-manager/sql/2021-02-01-preview/servers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServersClient struct { Client *resourcemanager.Client } -func NewServersClientWithBaseURI(api environments.Api) (*ServersClient, error) { +func NewServersClientWithBaseURI(api sdkEnv.Api) (*ServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServersClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/serversecurityalertpolicies/client.go b/resource-manager/sql/2021-02-01-preview/serversecurityalertpolicies/client.go index 39566058ad5..14a7b7cdb0b 100644 --- a/resource-manager/sql/2021-02-01-preview/serversecurityalertpolicies/client.go +++ b/resource-manager/sql/2021-02-01-preview/serversecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewServerSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*ServerSecurityAlertPoliciesClient, error) { +func NewServerSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*ServerSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serversecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/servertrustgroups/client.go b/resource-manager/sql/2021-02-01-preview/servertrustgroups/client.go index 999ce9c96b4..ce887cfeef1 100644 --- a/resource-manager/sql/2021-02-01-preview/servertrustgroups/client.go +++ b/resource-manager/sql/2021-02-01-preview/servertrustgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerTrustGroupsClient struct { Client *resourcemanager.Client } -func NewServerTrustGroupsClientWithBaseURI(api environments.Api) (*ServerTrustGroupsClient, error) { +func NewServerTrustGroupsClientWithBaseURI(api sdkEnv.Api) (*ServerTrustGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servertrustgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerTrustGroupsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/servervulnerabilityassessments/client.go b/resource-manager/sql/2021-02-01-preview/servervulnerabilityassessments/client.go index d6add06fcde..e608a74baf3 100644 --- a/resource-manager/sql/2021-02-01-preview/servervulnerabilityassessments/client.go +++ b/resource-manager/sql/2021-02-01-preview/servervulnerabilityassessments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerVulnerabilityAssessmentsClient struct { Client *resourcemanager.Client } -func NewServerVulnerabilityAssessmentsClientWithBaseURI(api environments.Api) (*ServerVulnerabilityAssessmentsClient, error) { +func NewServerVulnerabilityAssessmentsClientWithBaseURI(api sdkEnv.Api) (*ServerVulnerabilityAssessmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servervulnerabilityassessments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerVulnerabilityAssessmentsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/sqlagent/client.go b/resource-manager/sql/2021-02-01-preview/sqlagent/client.go index 4fe921ff441..7296c7e0ed8 100644 --- a/resource-manager/sql/2021-02-01-preview/sqlagent/client.go +++ b/resource-manager/sql/2021-02-01-preview/sqlagent/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SqlAgentClient struct { Client *resourcemanager.Client } -func NewSqlAgentClientWithBaseURI(api environments.Api) (*SqlAgentClient, error) { +func NewSqlAgentClientWithBaseURI(api sdkEnv.Api) (*SqlAgentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sqlagent", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SqlAgentClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/subscriptionusages/client.go b/resource-manager/sql/2021-02-01-preview/subscriptionusages/client.go index 5a8f2f1f695..cb0d84cf060 100644 --- a/resource-manager/sql/2021-02-01-preview/subscriptionusages/client.go +++ b/resource-manager/sql/2021-02-01-preview/subscriptionusages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SubscriptionUsagesClient struct { Client *resourcemanager.Client } -func NewSubscriptionUsagesClientWithBaseURI(api environments.Api) (*SubscriptionUsagesClient, error) { +func NewSubscriptionUsagesClientWithBaseURI(api sdkEnv.Api) (*SubscriptionUsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "subscriptionusages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SubscriptionUsagesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/syncagents/client.go b/resource-manager/sql/2021-02-01-preview/syncagents/client.go index 0a8dacc0a53..fc1b48aacaf 100644 --- a/resource-manager/sql/2021-02-01-preview/syncagents/client.go +++ b/resource-manager/sql/2021-02-01-preview/syncagents/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SyncAgentsClient struct { Client *resourcemanager.Client } -func NewSyncAgentsClientWithBaseURI(api environments.Api) (*SyncAgentsClient, error) { +func NewSyncAgentsClientWithBaseURI(api sdkEnv.Api) (*SyncAgentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "syncagents", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SyncAgentsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/syncgroups/client.go b/resource-manager/sql/2021-02-01-preview/syncgroups/client.go index 1d8dd0ea3be..8283b09ee97 100644 --- a/resource-manager/sql/2021-02-01-preview/syncgroups/client.go +++ b/resource-manager/sql/2021-02-01-preview/syncgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SyncGroupsClient struct { Client *resourcemanager.Client } -func NewSyncGroupsClientWithBaseURI(api environments.Api) (*SyncGroupsClient, error) { +func NewSyncGroupsClientWithBaseURI(api sdkEnv.Api) (*SyncGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "syncgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SyncGroupsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/syncmembers/client.go b/resource-manager/sql/2021-02-01-preview/syncmembers/client.go index 6fc8fd37189..ce63e6bc760 100644 --- a/resource-manager/sql/2021-02-01-preview/syncmembers/client.go +++ b/resource-manager/sql/2021-02-01-preview/syncmembers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SyncMembersClient struct { Client *resourcemanager.Client } -func NewSyncMembersClientWithBaseURI(api environments.Api) (*SyncMembersClient, error) { +func NewSyncMembersClientWithBaseURI(api sdkEnv.Api) (*SyncMembersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "syncmembers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SyncMembersClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/tdecertificates/client.go b/resource-manager/sql/2021-02-01-preview/tdecertificates/client.go index a243cc5e8a8..8bab9de60f8 100644 --- a/resource-manager/sql/2021-02-01-preview/tdecertificates/client.go +++ b/resource-manager/sql/2021-02-01-preview/tdecertificates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TdeCertificatesClient struct { Client *resourcemanager.Client } -func NewTdeCertificatesClientWithBaseURI(api environments.Api) (*TdeCertificatesClient, error) { +func NewTdeCertificatesClientWithBaseURI(api sdkEnv.Api) (*TdeCertificatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tdecertificates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TdeCertificatesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/timezones/client.go b/resource-manager/sql/2021-02-01-preview/timezones/client.go index 985d2a69dc3..0e725b9f424 100644 --- a/resource-manager/sql/2021-02-01-preview/timezones/client.go +++ b/resource-manager/sql/2021-02-01-preview/timezones/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TimeZonesClient struct { Client *resourcemanager.Client } -func NewTimeZonesClientWithBaseURI(api environments.Api) (*TimeZonesClient, error) { +func NewTimeZonesClientWithBaseURI(api sdkEnv.Api) (*TimeZonesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "timezones", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TimeZonesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/transparentdataencryptions/client.go b/resource-manager/sql/2021-02-01-preview/transparentdataencryptions/client.go index 3e0fc0829a6..de631e81772 100644 --- a/resource-manager/sql/2021-02-01-preview/transparentdataencryptions/client.go +++ b/resource-manager/sql/2021-02-01-preview/transparentdataencryptions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TransparentDataEncryptionsClient struct { Client *resourcemanager.Client } -func NewTransparentDataEncryptionsClientWithBaseURI(api environments.Api) (*TransparentDataEncryptionsClient, error) { +func NewTransparentDataEncryptionsClientWithBaseURI(api sdkEnv.Api) (*TransparentDataEncryptionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "transparentdataencryptions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TransparentDataEncryptionsClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/usages/client.go b/resource-manager/sql/2021-02-01-preview/usages/client.go index 99b2625224d..9319b1a1f51 100644 --- a/resource-manager/sql/2021-02-01-preview/usages/client.go +++ b/resource-manager/sql/2021-02-01-preview/usages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsagesClient struct { Client *resourcemanager.Client } -func NewUsagesClientWithBaseURI(api environments.Api) (*UsagesClient, error) { +func NewUsagesClientWithBaseURI(api sdkEnv.Api) (*UsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsagesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/virtualclusters/client.go b/resource-manager/sql/2021-02-01-preview/virtualclusters/client.go index efe7feb3346..dbc5ecfc21c 100644 --- a/resource-manager/sql/2021-02-01-preview/virtualclusters/client.go +++ b/resource-manager/sql/2021-02-01-preview/virtualclusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualClustersClient struct { Client *resourcemanager.Client } -func NewVirtualClustersClientWithBaseURI(api environments.Api) (*VirtualClustersClient, error) { +func NewVirtualClustersClientWithBaseURI(api sdkEnv.Api) (*VirtualClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualclusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualClustersClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/virtualnetworkrules/client.go b/resource-manager/sql/2021-02-01-preview/virtualnetworkrules/client.go index b85d828ef86..6c65981bc1c 100644 --- a/resource-manager/sql/2021-02-01-preview/virtualnetworkrules/client.go +++ b/resource-manager/sql/2021-02-01-preview/virtualnetworkrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkRulesClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkRulesClientWithBaseURI(api environments.Api) (*VirtualNetworkRulesClient, error) { +func NewVirtualNetworkRulesClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworkrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkRulesClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/workloadclassifiers/client.go b/resource-manager/sql/2021-02-01-preview/workloadclassifiers/client.go index 08521d24396..e2175fb4869 100644 --- a/resource-manager/sql/2021-02-01-preview/workloadclassifiers/client.go +++ b/resource-manager/sql/2021-02-01-preview/workloadclassifiers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkloadClassifiersClient struct { Client *resourcemanager.Client } -func NewWorkloadClassifiersClientWithBaseURI(api environments.Api) (*WorkloadClassifiersClient, error) { +func NewWorkloadClassifiersClientWithBaseURI(api sdkEnv.Api) (*WorkloadClassifiersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workloadclassifiers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkloadClassifiersClient: %+v", err) diff --git a/resource-manager/sql/2021-02-01-preview/workloadgroups/client.go b/resource-manager/sql/2021-02-01-preview/workloadgroups/client.go index e52783a2762..4073edd116c 100644 --- a/resource-manager/sql/2021-02-01-preview/workloadgroups/client.go +++ b/resource-manager/sql/2021-02-01-preview/workloadgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkloadGroupsClient struct { Client *resourcemanager.Client } -func NewWorkloadGroupsClientWithBaseURI(api environments.Api) (*WorkloadGroupsClient, error) { +func NewWorkloadGroupsClientWithBaseURI(api sdkEnv.Api) (*WorkloadGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workloadgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkloadGroupsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/backupshorttermretentionpolicies/client.go b/resource-manager/sql/2022-11-01-preview/backupshorttermretentionpolicies/client.go index 1618e4eba1c..cac3154780e 100644 --- a/resource-manager/sql/2022-11-01-preview/backupshorttermretentionpolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/backupshorttermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupShortTermRetentionPoliciesClient struct { Client *resourcemanager.Client } -func NewBackupShortTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*BackupShortTermRetentionPoliciesClient, error) { +func NewBackupShortTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*BackupShortTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backupshorttermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupShortTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/blobauditing/client.go b/resource-manager/sql/2022-11-01-preview/blobauditing/client.go index 827a9af09ae..51286580a86 100644 --- a/resource-manager/sql/2022-11-01-preview/blobauditing/client.go +++ b/resource-manager/sql/2022-11-01-preview/blobauditing/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BlobAuditingClient struct { Client *resourcemanager.Client } -func NewBlobAuditingClientWithBaseURI(api environments.Api) (*BlobAuditingClient, error) { +func NewBlobAuditingClientWithBaseURI(api sdkEnv.Api) (*BlobAuditingClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "blobauditing", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BlobAuditingClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/client.go b/resource-manager/sql/2022-11-01-preview/client.go index b9b98cedb27..cbfe7f79879 100644 --- a/resource-manager/sql/2022-11-01-preview/client.go +++ b/resource-manager/sql/2022-11-01-preview/client.go @@ -145,7 +145,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2022-11-01-preview/workloadclassifiers" "github.com/hashicorp/go-azure-sdk/resource-manager/sql/2022-11-01-preview/workloadgroups" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -289,7 +289,7 @@ type Client struct { WorkloadGroups *workloadgroups.WorkloadGroupsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { backupShortTermRetentionPoliciesClient, err := backupshorttermretentionpolicies.NewBackupShortTermRetentionPoliciesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building BackupShortTermRetentionPolicies client: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databaseadvancedthreatprotectionsettings/client.go b/resource-manager/sql/2022-11-01-preview/databaseadvancedthreatprotectionsettings/client.go index 7a137326bda..1772590d2c2 100644 --- a/resource-manager/sql/2022-11-01-preview/databaseadvancedthreatprotectionsettings/client.go +++ b/resource-manager/sql/2022-11-01-preview/databaseadvancedthreatprotectionsettings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseAdvancedThreatProtectionSettingsClient struct { Client *resourcemanager.Client } -func NewDatabaseAdvancedThreatProtectionSettingsClientWithBaseURI(api environments.Api) (*DatabaseAdvancedThreatProtectionSettingsClient, error) { +func NewDatabaseAdvancedThreatProtectionSettingsClientWithBaseURI(api sdkEnv.Api) (*DatabaseAdvancedThreatProtectionSettingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseadvancedthreatprotectionsettings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseAdvancedThreatProtectionSettingsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databaseadvisors/client.go b/resource-manager/sql/2022-11-01-preview/databaseadvisors/client.go index 3cf12671bd2..684bb4b1b11 100644 --- a/resource-manager/sql/2022-11-01-preview/databaseadvisors/client.go +++ b/resource-manager/sql/2022-11-01-preview/databaseadvisors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseAdvisorsClient struct { Client *resourcemanager.Client } -func NewDatabaseAdvisorsClientWithBaseURI(api environments.Api) (*DatabaseAdvisorsClient, error) { +func NewDatabaseAdvisorsClientWithBaseURI(api sdkEnv.Api) (*DatabaseAdvisorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseadvisors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseAdvisorsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databaseautomatictuning/client.go b/resource-manager/sql/2022-11-01-preview/databaseautomatictuning/client.go index 7b44f38e124..4d92b71dd80 100644 --- a/resource-manager/sql/2022-11-01-preview/databaseautomatictuning/client.go +++ b/resource-manager/sql/2022-11-01-preview/databaseautomatictuning/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseAutomaticTuningClient struct { Client *resourcemanager.Client } -func NewDatabaseAutomaticTuningClientWithBaseURI(api environments.Api) (*DatabaseAutomaticTuningClient, error) { +func NewDatabaseAutomaticTuningClientWithBaseURI(api sdkEnv.Api) (*DatabaseAutomaticTuningClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseautomatictuning", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseAutomaticTuningClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasecolumns/client.go b/resource-manager/sql/2022-11-01-preview/databasecolumns/client.go index 30fd3899647..97bbbf3702c 100644 --- a/resource-manager/sql/2022-11-01-preview/databasecolumns/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasecolumns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseColumnsClient struct { Client *resourcemanager.Client } -func NewDatabaseColumnsClientWithBaseURI(api environments.Api) (*DatabaseColumnsClient, error) { +func NewDatabaseColumnsClientWithBaseURI(api sdkEnv.Api) (*DatabaseColumnsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasecolumns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseColumnsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databaseencryptionprotectorrevalidate/client.go b/resource-manager/sql/2022-11-01-preview/databaseencryptionprotectorrevalidate/client.go index 4ece5824cde..83f78cf6f5e 100644 --- a/resource-manager/sql/2022-11-01-preview/databaseencryptionprotectorrevalidate/client.go +++ b/resource-manager/sql/2022-11-01-preview/databaseencryptionprotectorrevalidate/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseEncryptionProtectorRevalidateClient struct { Client *resourcemanager.Client } -func NewDatabaseEncryptionProtectorRevalidateClientWithBaseURI(api environments.Api) (*DatabaseEncryptionProtectorRevalidateClient, error) { +func NewDatabaseEncryptionProtectorRevalidateClientWithBaseURI(api sdkEnv.Api) (*DatabaseEncryptionProtectorRevalidateClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseencryptionprotectorrevalidate", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseEncryptionProtectorRevalidateClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databaseencryptionprotectorrevert/client.go b/resource-manager/sql/2022-11-01-preview/databaseencryptionprotectorrevert/client.go index d5c5f7edfec..9d686aa4e81 100644 --- a/resource-manager/sql/2022-11-01-preview/databaseencryptionprotectorrevert/client.go +++ b/resource-manager/sql/2022-11-01-preview/databaseencryptionprotectorrevert/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseEncryptionProtectorRevertClient struct { Client *resourcemanager.Client } -func NewDatabaseEncryptionProtectorRevertClientWithBaseURI(api environments.Api) (*DatabaseEncryptionProtectorRevertClient, error) { +func NewDatabaseEncryptionProtectorRevertClientWithBaseURI(api sdkEnv.Api) (*DatabaseEncryptionProtectorRevertClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseencryptionprotectorrevert", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseEncryptionProtectorRevertClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databaseextensions/client.go b/resource-manager/sql/2022-11-01-preview/databaseextensions/client.go index f21053bbffa..647a32ddf82 100644 --- a/resource-manager/sql/2022-11-01-preview/databaseextensions/client.go +++ b/resource-manager/sql/2022-11-01-preview/databaseextensions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseExtensionsClient struct { Client *resourcemanager.Client } -func NewDatabaseExtensionsClientWithBaseURI(api environments.Api) (*DatabaseExtensionsClient, error) { +func NewDatabaseExtensionsClientWithBaseURI(api sdkEnv.Api) (*DatabaseExtensionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseextensions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseExtensionsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databaseoperations/client.go b/resource-manager/sql/2022-11-01-preview/databaseoperations/client.go index 5161347e5a1..2cd7a9e3235 100644 --- a/resource-manager/sql/2022-11-01-preview/databaseoperations/client.go +++ b/resource-manager/sql/2022-11-01-preview/databaseoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseOperationsClient struct { Client *resourcemanager.Client } -func NewDatabaseOperationsClientWithBaseURI(api environments.Api) (*DatabaseOperationsClient, error) { +func NewDatabaseOperationsClientWithBaseURI(api sdkEnv.Api) (*DatabaseOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseOperationsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databaserecommendedactions/client.go b/resource-manager/sql/2022-11-01-preview/databaserecommendedactions/client.go index 84c938da8c1..986053a05bc 100644 --- a/resource-manager/sql/2022-11-01-preview/databaserecommendedactions/client.go +++ b/resource-manager/sql/2022-11-01-preview/databaserecommendedactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseRecommendedActionsClient struct { Client *resourcemanager.Client } -func NewDatabaseRecommendedActionsClientWithBaseURI(api environments.Api) (*DatabaseRecommendedActionsClient, error) { +func NewDatabaseRecommendedActionsClientWithBaseURI(api sdkEnv.Api) (*DatabaseRecommendedActionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaserecommendedactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseRecommendedActionsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databases/client.go b/resource-manager/sql/2022-11-01-preview/databases/client.go index bb94a331f78..6f48891ebd3 100644 --- a/resource-manager/sql/2022-11-01-preview/databases/client.go +++ b/resource-manager/sql/2022-11-01-preview/databases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabasesClient struct { Client *resourcemanager.Client } -func NewDatabasesClientWithBaseURI(api environments.Api) (*DatabasesClient, error) { +func NewDatabasesClientWithBaseURI(api sdkEnv.Api) (*DatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databaseschemas/client.go b/resource-manager/sql/2022-11-01-preview/databaseschemas/client.go index 7ab29b07f75..50dd05342f2 100644 --- a/resource-manager/sql/2022-11-01-preview/databaseschemas/client.go +++ b/resource-manager/sql/2022-11-01-preview/databaseschemas/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSchemasClient struct { Client *resourcemanager.Client } -func NewDatabaseSchemasClientWithBaseURI(api environments.Api) (*DatabaseSchemasClient, error) { +func NewDatabaseSchemasClientWithBaseURI(api sdkEnv.Api) (*DatabaseSchemasClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseschemas", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSchemasClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasesecurityalertpolicies/client.go b/resource-manager/sql/2022-11-01-preview/databasesecurityalertpolicies/client.go index 725816aac0a..5760ab45ff7 100644 --- a/resource-manager/sql/2022-11-01-preview/databasesecurityalertpolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasesecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewDatabaseSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*DatabaseSecurityAlertPoliciesClient, error) { +func NewDatabaseSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*DatabaseSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasesecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentbaselines/client.go b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentbaselines/client.go index 314e8440112..4fea0108206 100644 --- a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentbaselines/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentbaselines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSqlVulnerabilityAssessmentBaselinesClient struct { Client *resourcemanager.Client } -func NewDatabaseSqlVulnerabilityAssessmentBaselinesClientWithBaseURI(api environments.Api) (*DatabaseSqlVulnerabilityAssessmentBaselinesClient, error) { +func NewDatabaseSqlVulnerabilityAssessmentBaselinesClientWithBaseURI(api sdkEnv.Api) (*DatabaseSqlVulnerabilityAssessmentBaselinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasesqlvulnerabilityassessmentbaselines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSqlVulnerabilityAssessmentBaselinesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentexecutescan/client.go b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentexecutescan/client.go index 5a52313e9b5..8f675f3cb70 100644 --- a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentexecutescan/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentexecutescan/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSqlVulnerabilityAssessmentExecuteScanClient struct { Client *resourcemanager.Client } -func NewDatabaseSqlVulnerabilityAssessmentExecuteScanClientWithBaseURI(api environments.Api) (*DatabaseSqlVulnerabilityAssessmentExecuteScanClient, error) { +func NewDatabaseSqlVulnerabilityAssessmentExecuteScanClientWithBaseURI(api sdkEnv.Api) (*DatabaseSqlVulnerabilityAssessmentExecuteScanClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasesqlvulnerabilityassessmentexecutescan", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSqlVulnerabilityAssessmentExecuteScanClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentrulebaselines/client.go b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentrulebaselines/client.go index 519d97d2303..dd5fffd3322 100644 --- a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentrulebaselines/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentrulebaselines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient struct { Client *resourcemanager.Client } -func NewDatabaseSqlVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(api environments.Api) (*DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient, error) { +func NewDatabaseSqlVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(api sdkEnv.Api) (*DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasesqlvulnerabilityassessmentrulebaselines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentscanresult/client.go b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentscanresult/client.go index 51d488bad8a..46e87db35d4 100644 --- a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentscanresult/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentscanresult/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSqlVulnerabilityAssessmentScanResultClient struct { Client *resourcemanager.Client } -func NewDatabaseSqlVulnerabilityAssessmentScanResultClientWithBaseURI(api environments.Api) (*DatabaseSqlVulnerabilityAssessmentScanResultClient, error) { +func NewDatabaseSqlVulnerabilityAssessmentScanResultClientWithBaseURI(api sdkEnv.Api) (*DatabaseSqlVulnerabilityAssessmentScanResultClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasesqlvulnerabilityassessmentscanresult", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSqlVulnerabilityAssessmentScanResultClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentscans/client.go b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentscans/client.go index 6715fba3335..b2e301847e2 100644 --- a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentscans/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentscans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSqlVulnerabilityAssessmentScansClient struct { Client *resourcemanager.Client } -func NewDatabaseSqlVulnerabilityAssessmentScansClientWithBaseURI(api environments.Api) (*DatabaseSqlVulnerabilityAssessmentScansClient, error) { +func NewDatabaseSqlVulnerabilityAssessmentScansClientWithBaseURI(api sdkEnv.Api) (*DatabaseSqlVulnerabilityAssessmentScansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasesqlvulnerabilityassessmentscans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSqlVulnerabilityAssessmentScansClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentssettings/client.go b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentssettings/client.go index 9ac2e8eb00c..8ed5105a310 100644 --- a/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentssettings/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasesqlvulnerabilityassessmentssettings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseSqlVulnerabilityAssessmentsSettingsClient struct { Client *resourcemanager.Client } -func NewDatabaseSqlVulnerabilityAssessmentsSettingsClientWithBaseURI(api environments.Api) (*DatabaseSqlVulnerabilityAssessmentsSettingsClient, error) { +func NewDatabaseSqlVulnerabilityAssessmentsSettingsClientWithBaseURI(api sdkEnv.Api) (*DatabaseSqlVulnerabilityAssessmentsSettingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasesqlvulnerabilityassessmentssettings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseSqlVulnerabilityAssessmentsSettingsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasetables/client.go b/resource-manager/sql/2022-11-01-preview/databasetables/client.go index 4f5f9c46fa1..f91a2c5f51a 100644 --- a/resource-manager/sql/2022-11-01-preview/databasetables/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasetables/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseTablesClient struct { Client *resourcemanager.Client } -func NewDatabaseTablesClientWithBaseURI(api environments.Api) (*DatabaseTablesClient, error) { +func NewDatabaseTablesClientWithBaseURI(api sdkEnv.Api) (*DatabaseTablesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasetables", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseTablesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databaseusages/client.go b/resource-manager/sql/2022-11-01-preview/databaseusages/client.go index 079453d5c9b..a742adc356c 100644 --- a/resource-manager/sql/2022-11-01-preview/databaseusages/client.go +++ b/resource-manager/sql/2022-11-01-preview/databaseusages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseUsagesClient struct { Client *resourcemanager.Client } -func NewDatabaseUsagesClientWithBaseURI(api environments.Api) (*DatabaseUsagesClient, error) { +func NewDatabaseUsagesClientWithBaseURI(api sdkEnv.Api) (*DatabaseUsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databaseusages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseUsagesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessmentrulebaselines/client.go b/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessmentrulebaselines/client.go index 2d3eb562821..53eb028d10e 100644 --- a/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessmentrulebaselines/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessmentrulebaselines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseVulnerabilityAssessmentRuleBaselinesClient struct { Client *resourcemanager.Client } -func NewDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(api environments.Api) (*DatabaseVulnerabilityAssessmentRuleBaselinesClient, error) { +func NewDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(api sdkEnv.Api) (*DatabaseVulnerabilityAssessmentRuleBaselinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasevulnerabilityassessmentrulebaselines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseVulnerabilityAssessmentRuleBaselinesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessments/client.go b/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessments/client.go index 2a9ec654f8a..47d094dc471 100644 --- a/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessments/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseVulnerabilityAssessmentsClient struct { Client *resourcemanager.Client } -func NewDatabaseVulnerabilityAssessmentsClientWithBaseURI(api environments.Api) (*DatabaseVulnerabilityAssessmentsClient, error) { +func NewDatabaseVulnerabilityAssessmentsClientWithBaseURI(api sdkEnv.Api) (*DatabaseVulnerabilityAssessmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasevulnerabilityassessments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseVulnerabilityAssessmentsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessmentscans/client.go b/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessmentscans/client.go index e3b7a5f9dce..4b53861478c 100644 --- a/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessmentscans/client.go +++ b/resource-manager/sql/2022-11-01-preview/databasevulnerabilityassessmentscans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DatabaseVulnerabilityAssessmentScansClient struct { Client *resourcemanager.Client } -func NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI(api environments.Api) (*DatabaseVulnerabilityAssessmentScansClient, error) { +func NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI(api sdkEnv.Api) (*DatabaseVulnerabilityAssessmentScansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "databasevulnerabilityassessmentscans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DatabaseVulnerabilityAssessmentScansClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/datamaskingpolicies/client.go b/resource-manager/sql/2022-11-01-preview/datamaskingpolicies/client.go index a4f96697189..a2b658d1459 100644 --- a/resource-manager/sql/2022-11-01-preview/datamaskingpolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/datamaskingpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataMaskingPoliciesClient struct { Client *resourcemanager.Client } -func NewDataMaskingPoliciesClientWithBaseURI(api environments.Api) (*DataMaskingPoliciesClient, error) { +func NewDataMaskingPoliciesClientWithBaseURI(api sdkEnv.Api) (*DataMaskingPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datamaskingpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataMaskingPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/datamaskingrules/client.go b/resource-manager/sql/2022-11-01-preview/datamaskingrules/client.go index 7940303e686..e4a2127b4ef 100644 --- a/resource-manager/sql/2022-11-01-preview/datamaskingrules/client.go +++ b/resource-manager/sql/2022-11-01-preview/datamaskingrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataMaskingRulesClient struct { Client *resourcemanager.Client } -func NewDataMaskingRulesClientWithBaseURI(api environments.Api) (*DataMaskingRulesClient, error) { +func NewDataMaskingRulesClientWithBaseURI(api sdkEnv.Api) (*DataMaskingRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datamaskingrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataMaskingRulesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/datawarehouseuseractivities/client.go b/resource-manager/sql/2022-11-01-preview/datawarehouseuseractivities/client.go index cd30b370888..a7ce6c8c236 100644 --- a/resource-manager/sql/2022-11-01-preview/datawarehouseuseractivities/client.go +++ b/resource-manager/sql/2022-11-01-preview/datawarehouseuseractivities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataWarehouseUserActivitiesClient struct { Client *resourcemanager.Client } -func NewDataWarehouseUserActivitiesClientWithBaseURI(api environments.Api) (*DataWarehouseUserActivitiesClient, error) { +func NewDataWarehouseUserActivitiesClientWithBaseURI(api sdkEnv.Api) (*DataWarehouseUserActivitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datawarehouseuseractivities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataWarehouseUserActivitiesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/deletedservers/client.go b/resource-manager/sql/2022-11-01-preview/deletedservers/client.go index 4e4fc6974db..3fbca6fd290 100644 --- a/resource-manager/sql/2022-11-01-preview/deletedservers/client.go +++ b/resource-manager/sql/2022-11-01-preview/deletedservers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeletedServersClient struct { Client *resourcemanager.Client } -func NewDeletedServersClientWithBaseURI(api environments.Api) (*DeletedServersClient, error) { +func NewDeletedServersClientWithBaseURI(api sdkEnv.Api) (*DeletedServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "deletedservers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeletedServersClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/distributedavailabilitygroups/client.go b/resource-manager/sql/2022-11-01-preview/distributedavailabilitygroups/client.go index 30b77d0a728..5c4db977002 100644 --- a/resource-manager/sql/2022-11-01-preview/distributedavailabilitygroups/client.go +++ b/resource-manager/sql/2022-11-01-preview/distributedavailabilitygroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DistributedAvailabilityGroupsClient struct { Client *resourcemanager.Client } -func NewDistributedAvailabilityGroupsClientWithBaseURI(api environments.Api) (*DistributedAvailabilityGroupsClient, error) { +func NewDistributedAvailabilityGroupsClientWithBaseURI(api sdkEnv.Api) (*DistributedAvailabilityGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "distributedavailabilitygroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DistributedAvailabilityGroupsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/elasticpooloperations/client.go b/resource-manager/sql/2022-11-01-preview/elasticpooloperations/client.go index 5bf893f1479..42451de51a5 100644 --- a/resource-manager/sql/2022-11-01-preview/elasticpooloperations/client.go +++ b/resource-manager/sql/2022-11-01-preview/elasticpooloperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ElasticPoolOperationsClient struct { Client *resourcemanager.Client } -func NewElasticPoolOperationsClientWithBaseURI(api environments.Api) (*ElasticPoolOperationsClient, error) { +func NewElasticPoolOperationsClientWithBaseURI(api sdkEnv.Api) (*ElasticPoolOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "elasticpooloperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ElasticPoolOperationsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/elasticpools/client.go b/resource-manager/sql/2022-11-01-preview/elasticpools/client.go index 88d05246e2e..8ab632442a0 100644 --- a/resource-manager/sql/2022-11-01-preview/elasticpools/client.go +++ b/resource-manager/sql/2022-11-01-preview/elasticpools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ElasticPoolsClient struct { Client *resourcemanager.Client } -func NewElasticPoolsClientWithBaseURI(api environments.Api) (*ElasticPoolsClient, error) { +func NewElasticPoolsClientWithBaseURI(api sdkEnv.Api) (*ElasticPoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "elasticpools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ElasticPoolsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/encryptionprotectors/client.go b/resource-manager/sql/2022-11-01-preview/encryptionprotectors/client.go index 6178e180779..465d9359f7f 100644 --- a/resource-manager/sql/2022-11-01-preview/encryptionprotectors/client.go +++ b/resource-manager/sql/2022-11-01-preview/encryptionprotectors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EncryptionProtectorsClient struct { Client *resourcemanager.Client } -func NewEncryptionProtectorsClientWithBaseURI(api environments.Api) (*EncryptionProtectorsClient, error) { +func NewEncryptionProtectorsClientWithBaseURI(api sdkEnv.Api) (*EncryptionProtectorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "encryptionprotectors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EncryptionProtectorsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/endpointcertificates/client.go b/resource-manager/sql/2022-11-01-preview/endpointcertificates/client.go index e78bf30d0c3..78052b67775 100644 --- a/resource-manager/sql/2022-11-01-preview/endpointcertificates/client.go +++ b/resource-manager/sql/2022-11-01-preview/endpointcertificates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EndpointCertificatesClient struct { Client *resourcemanager.Client } -func NewEndpointCertificatesClientWithBaseURI(api environments.Api) (*EndpointCertificatesClient, error) { +func NewEndpointCertificatesClientWithBaseURI(api sdkEnv.Api) (*EndpointCertificatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "endpointcertificates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EndpointCertificatesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/failovergroups/client.go b/resource-manager/sql/2022-11-01-preview/failovergroups/client.go index bdcd78c3d40..84da3095d4e 100644 --- a/resource-manager/sql/2022-11-01-preview/failovergroups/client.go +++ b/resource-manager/sql/2022-11-01-preview/failovergroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FailoverGroupsClient struct { Client *resourcemanager.Client } -func NewFailoverGroupsClientWithBaseURI(api environments.Api) (*FailoverGroupsClient, error) { +func NewFailoverGroupsClientWithBaseURI(api sdkEnv.Api) (*FailoverGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "failovergroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FailoverGroupsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/firewallrules/client.go b/resource-manager/sql/2022-11-01-preview/firewallrules/client.go index 6493e429eb1..86eebdae36a 100644 --- a/resource-manager/sql/2022-11-01-preview/firewallrules/client.go +++ b/resource-manager/sql/2022-11-01-preview/firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type FirewallRulesClient struct { Client *resourcemanager.Client } -func NewFirewallRulesClientWithBaseURI(api environments.Api) (*FirewallRulesClient, error) { +func NewFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating FirewallRulesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/geobackuppolicies/client.go b/resource-manager/sql/2022-11-01-preview/geobackuppolicies/client.go index 648ed5bfb34..e890f2ffd2d 100644 --- a/resource-manager/sql/2022-11-01-preview/geobackuppolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/geobackuppolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GeoBackupPoliciesClient struct { Client *resourcemanager.Client } -func NewGeoBackupPoliciesClientWithBaseURI(api environments.Api) (*GeoBackupPoliciesClient, error) { +func NewGeoBackupPoliciesClientWithBaseURI(api sdkEnv.Api) (*GeoBackupPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "geobackuppolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GeoBackupPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/instancefailovergroups/client.go b/resource-manager/sql/2022-11-01-preview/instancefailovergroups/client.go index 3b41475a987..085ef1c5b4c 100644 --- a/resource-manager/sql/2022-11-01-preview/instancefailovergroups/client.go +++ b/resource-manager/sql/2022-11-01-preview/instancefailovergroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type InstanceFailoverGroupsClient struct { Client *resourcemanager.Client } -func NewInstanceFailoverGroupsClientWithBaseURI(api environments.Api) (*InstanceFailoverGroupsClient, error) { +func NewInstanceFailoverGroupsClientWithBaseURI(api sdkEnv.Api) (*InstanceFailoverGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "instancefailovergroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating InstanceFailoverGroupsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/instancepools/client.go b/resource-manager/sql/2022-11-01-preview/instancepools/client.go index 5d154feeb14..de3377d037d 100644 --- a/resource-manager/sql/2022-11-01-preview/instancepools/client.go +++ b/resource-manager/sql/2022-11-01-preview/instancepools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type InstancePoolsClient struct { Client *resourcemanager.Client } -func NewInstancePoolsClientWithBaseURI(api environments.Api) (*InstancePoolsClient, error) { +func NewInstancePoolsClientWithBaseURI(api sdkEnv.Api) (*InstancePoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "instancepools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating InstancePoolsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/ipv6firewallrules/client.go b/resource-manager/sql/2022-11-01-preview/ipv6firewallrules/client.go index 327087cc818..06546347da6 100644 --- a/resource-manager/sql/2022-11-01-preview/ipv6firewallrules/client.go +++ b/resource-manager/sql/2022-11-01-preview/ipv6firewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IPv6FirewallRulesClient struct { Client *resourcemanager.Client } -func NewIPv6FirewallRulesClientWithBaseURI(api environments.Api) (*IPv6FirewallRulesClient, error) { +func NewIPv6FirewallRulesClientWithBaseURI(api sdkEnv.Api) (*IPv6FirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ipv6firewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IPv6FirewallRulesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/jobagents/client.go b/resource-manager/sql/2022-11-01-preview/jobagents/client.go index 98054c033a0..5699e8adc22 100644 --- a/resource-manager/sql/2022-11-01-preview/jobagents/client.go +++ b/resource-manager/sql/2022-11-01-preview/jobagents/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobAgentsClient struct { Client *resourcemanager.Client } -func NewJobAgentsClientWithBaseURI(api environments.Api) (*JobAgentsClient, error) { +func NewJobAgentsClientWithBaseURI(api sdkEnv.Api) (*JobAgentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobagents", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobAgentsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/jobcredentials/client.go b/resource-manager/sql/2022-11-01-preview/jobcredentials/client.go index 50266bc8457..9c23c45f48a 100644 --- a/resource-manager/sql/2022-11-01-preview/jobcredentials/client.go +++ b/resource-manager/sql/2022-11-01-preview/jobcredentials/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobCredentialsClient struct { Client *resourcemanager.Client } -func NewJobCredentialsClientWithBaseURI(api environments.Api) (*JobCredentialsClient, error) { +func NewJobCredentialsClientWithBaseURI(api sdkEnv.Api) (*JobCredentialsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobcredentials", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobCredentialsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/jobexecutions/client.go b/resource-manager/sql/2022-11-01-preview/jobexecutions/client.go index a747e2f4d38..77afc026dc1 100644 --- a/resource-manager/sql/2022-11-01-preview/jobexecutions/client.go +++ b/resource-manager/sql/2022-11-01-preview/jobexecutions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobExecutionsClient struct { Client *resourcemanager.Client } -func NewJobExecutionsClientWithBaseURI(api environments.Api) (*JobExecutionsClient, error) { +func NewJobExecutionsClientWithBaseURI(api sdkEnv.Api) (*JobExecutionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobexecutions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobExecutionsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/jobs/client.go b/resource-manager/sql/2022-11-01-preview/jobs/client.go index e2cca931b31..a7c521817f9 100644 --- a/resource-manager/sql/2022-11-01-preview/jobs/client.go +++ b/resource-manager/sql/2022-11-01-preview/jobs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobsClient struct { Client *resourcemanager.Client } -func NewJobsClientWithBaseURI(api environments.Api) (*JobsClient, error) { +func NewJobsClientWithBaseURI(api sdkEnv.Api) (*JobsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/jobstepexecutions/client.go b/resource-manager/sql/2022-11-01-preview/jobstepexecutions/client.go index 747214e6542..04727a0768c 100644 --- a/resource-manager/sql/2022-11-01-preview/jobstepexecutions/client.go +++ b/resource-manager/sql/2022-11-01-preview/jobstepexecutions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobStepExecutionsClient struct { Client *resourcemanager.Client } -func NewJobStepExecutionsClientWithBaseURI(api environments.Api) (*JobStepExecutionsClient, error) { +func NewJobStepExecutionsClientWithBaseURI(api sdkEnv.Api) (*JobStepExecutionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobstepexecutions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobStepExecutionsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/jobsteps/client.go b/resource-manager/sql/2022-11-01-preview/jobsteps/client.go index 288fc5a5c7a..c0fd7cb974a 100644 --- a/resource-manager/sql/2022-11-01-preview/jobsteps/client.go +++ b/resource-manager/sql/2022-11-01-preview/jobsteps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobStepsClient struct { Client *resourcemanager.Client } -func NewJobStepsClientWithBaseURI(api environments.Api) (*JobStepsClient, error) { +func NewJobStepsClientWithBaseURI(api sdkEnv.Api) (*JobStepsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobsteps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobStepsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/jobtargetexecutions/client.go b/resource-manager/sql/2022-11-01-preview/jobtargetexecutions/client.go index 44b20159aa4..acc70a2987e 100644 --- a/resource-manager/sql/2022-11-01-preview/jobtargetexecutions/client.go +++ b/resource-manager/sql/2022-11-01-preview/jobtargetexecutions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobTargetExecutionsClient struct { Client *resourcemanager.Client } -func NewJobTargetExecutionsClientWithBaseURI(api environments.Api) (*JobTargetExecutionsClient, error) { +func NewJobTargetExecutionsClientWithBaseURI(api sdkEnv.Api) (*JobTargetExecutionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobtargetexecutions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobTargetExecutionsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/jobtargetgroups/client.go b/resource-manager/sql/2022-11-01-preview/jobtargetgroups/client.go index b66f9c2418b..2179339ea93 100644 --- a/resource-manager/sql/2022-11-01-preview/jobtargetgroups/client.go +++ b/resource-manager/sql/2022-11-01-preview/jobtargetgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobTargetGroupsClient struct { Client *resourcemanager.Client } -func NewJobTargetGroupsClientWithBaseURI(api environments.Api) (*JobTargetGroupsClient, error) { +func NewJobTargetGroupsClientWithBaseURI(api sdkEnv.Api) (*JobTargetGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobtargetgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobTargetGroupsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/jobversions/client.go b/resource-manager/sql/2022-11-01-preview/jobversions/client.go index eba7cc6e229..fe50e278589 100644 --- a/resource-manager/sql/2022-11-01-preview/jobversions/client.go +++ b/resource-manager/sql/2022-11-01-preview/jobversions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobVersionsClient struct { Client *resourcemanager.Client } -func NewJobVersionsClientWithBaseURI(api environments.Api) (*JobVersionsClient, error) { +func NewJobVersionsClientWithBaseURI(api sdkEnv.Api) (*JobVersionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobversions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobVersionsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/ledgerdigestuploads/client.go b/resource-manager/sql/2022-11-01-preview/ledgerdigestuploads/client.go index 398a6bf63db..943684c3af0 100644 --- a/resource-manager/sql/2022-11-01-preview/ledgerdigestuploads/client.go +++ b/resource-manager/sql/2022-11-01-preview/ledgerdigestuploads/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LedgerDigestUploadsClient struct { Client *resourcemanager.Client } -func NewLedgerDigestUploadsClientWithBaseURI(api environments.Api) (*LedgerDigestUploadsClient, error) { +func NewLedgerDigestUploadsClientWithBaseURI(api sdkEnv.Api) (*LedgerDigestUploadsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ledgerdigestuploads", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LedgerDigestUploadsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/locationcapabilities/client.go b/resource-manager/sql/2022-11-01-preview/locationcapabilities/client.go index 7cd99f7aac2..c15d86af0d3 100644 --- a/resource-manager/sql/2022-11-01-preview/locationcapabilities/client.go +++ b/resource-manager/sql/2022-11-01-preview/locationcapabilities/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationCapabilitiesClient struct { Client *resourcemanager.Client } -func NewLocationCapabilitiesClientWithBaseURI(api environments.Api) (*LocationCapabilitiesClient, error) { +func NewLocationCapabilitiesClientWithBaseURI(api sdkEnv.Api) (*LocationCapabilitiesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locationcapabilities", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationCapabilitiesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/longtermretentionbackups/client.go b/resource-manager/sql/2022-11-01-preview/longtermretentionbackups/client.go index 1c4a9a73a65..8ab1793d043 100644 --- a/resource-manager/sql/2022-11-01-preview/longtermretentionbackups/client.go +++ b/resource-manager/sql/2022-11-01-preview/longtermretentionbackups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LongTermRetentionBackupsClient struct { Client *resourcemanager.Client } -func NewLongTermRetentionBackupsClientWithBaseURI(api environments.Api) (*LongTermRetentionBackupsClient, error) { +func NewLongTermRetentionBackupsClientWithBaseURI(api sdkEnv.Api) (*LongTermRetentionBackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "longtermretentionbackups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LongTermRetentionBackupsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/longtermretentionmanagedinstancebackups/client.go b/resource-manager/sql/2022-11-01-preview/longtermretentionmanagedinstancebackups/client.go index 30ae6a1a604..b4c84ba3d9e 100644 --- a/resource-manager/sql/2022-11-01-preview/longtermretentionmanagedinstancebackups/client.go +++ b/resource-manager/sql/2022-11-01-preview/longtermretentionmanagedinstancebackups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LongTermRetentionManagedInstanceBackupsClient struct { Client *resourcemanager.Client } -func NewLongTermRetentionManagedInstanceBackupsClientWithBaseURI(api environments.Api) (*LongTermRetentionManagedInstanceBackupsClient, error) { +func NewLongTermRetentionManagedInstanceBackupsClientWithBaseURI(api sdkEnv.Api) (*LongTermRetentionManagedInstanceBackupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "longtermretentionmanagedinstancebackups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LongTermRetentionManagedInstanceBackupsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/longtermretentionpolicies/client.go b/resource-manager/sql/2022-11-01-preview/longtermretentionpolicies/client.go index 2f5372f22cc..4372b0a9782 100644 --- a/resource-manager/sql/2022-11-01-preview/longtermretentionpolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/longtermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LongTermRetentionPoliciesClient struct { Client *resourcemanager.Client } -func NewLongTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*LongTermRetentionPoliciesClient, error) { +func NewLongTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*LongTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "longtermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LongTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/maintenancewindowoptions/client.go b/resource-manager/sql/2022-11-01-preview/maintenancewindowoptions/client.go index e4b27210bf2..ec456905b54 100644 --- a/resource-manager/sql/2022-11-01-preview/maintenancewindowoptions/client.go +++ b/resource-manager/sql/2022-11-01-preview/maintenancewindowoptions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MaintenanceWindowOptionsClient struct { Client *resourcemanager.Client } -func NewMaintenanceWindowOptionsClientWithBaseURI(api environments.Api) (*MaintenanceWindowOptionsClient, error) { +func NewMaintenanceWindowOptionsClientWithBaseURI(api sdkEnv.Api) (*MaintenanceWindowOptionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "maintenancewindowoptions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MaintenanceWindowOptionsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/maintenancewindows/client.go b/resource-manager/sql/2022-11-01-preview/maintenancewindows/client.go index e83739e60a9..0f7c1623d09 100644 --- a/resource-manager/sql/2022-11-01-preview/maintenancewindows/client.go +++ b/resource-manager/sql/2022-11-01-preview/maintenancewindows/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MaintenanceWindowsClient struct { Client *resourcemanager.Client } -func NewMaintenanceWindowsClientWithBaseURI(api environments.Api) (*MaintenanceWindowsClient, error) { +func NewMaintenanceWindowsClientWithBaseURI(api sdkEnv.Api) (*MaintenanceWindowsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "maintenancewindows", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MaintenanceWindowsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedbackupshorttermretentionpolicies/client.go b/resource-manager/sql/2022-11-01-preview/managedbackupshorttermretentionpolicies/client.go index 0f914d6c4fe..aef1b895d74 100644 --- a/resource-manager/sql/2022-11-01-preview/managedbackupshorttermretentionpolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedbackupshorttermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedBackupShortTermRetentionPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedBackupShortTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*ManagedBackupShortTermRetentionPoliciesClient, error) { +func NewManagedBackupShortTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedBackupShortTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedbackupshorttermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedBackupShortTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabaseadvancedthreatprotectionsettings/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabaseadvancedthreatprotectionsettings/client.go index 9438a3ae6f0..ba6297b24a3 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabaseadvancedthreatprotectionsettings/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabaseadvancedthreatprotectionsettings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseAdvancedThreatProtectionSettingsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseAdvancedThreatProtectionSettingsClientWithBaseURI(api environments.Api) (*ManagedDatabaseAdvancedThreatProtectionSettingsClient, error) { +func NewManagedDatabaseAdvancedThreatProtectionSettingsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseAdvancedThreatProtectionSettingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabaseadvancedthreatprotectionsettings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseAdvancedThreatProtectionSettingsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabasecolumns/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabasecolumns/client.go index 4864ec5542b..538bf11dddd 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabasecolumns/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabasecolumns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseColumnsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseColumnsClientWithBaseURI(api environments.Api) (*ManagedDatabaseColumnsClient, error) { +func NewManagedDatabaseColumnsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseColumnsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasecolumns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseColumnsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabasemoveoperations/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabasemoveoperations/client.go index c770f40e2f5..469856a128f 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabasemoveoperations/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabasemoveoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseMoveOperationsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseMoveOperationsClientWithBaseURI(api environments.Api) (*ManagedDatabaseMoveOperationsClient, error) { +func NewManagedDatabaseMoveOperationsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseMoveOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasemoveoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseMoveOperationsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabasequeries/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabasequeries/client.go index 22eee60eb6f..b6cf88a0109 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabasequeries/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabasequeries/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseQueriesClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseQueriesClientWithBaseURI(api environments.Api) (*ManagedDatabaseQueriesClient, error) { +func NewManagedDatabaseQueriesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseQueriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasequeries", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseQueriesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabaserestoredetails/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabaserestoredetails/client.go index ddf71605817..d81d7cf5c19 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabaserestoredetails/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabaserestoredetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseRestoreDetailsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseRestoreDetailsClientWithBaseURI(api environments.Api) (*ManagedDatabaseRestoreDetailsClient, error) { +func NewManagedDatabaseRestoreDetailsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseRestoreDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabaserestoredetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseRestoreDetailsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabases/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabases/client.go index 09fd490cf51..0881fcb5f69 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabases/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabasesClient struct { Client *resourcemanager.Client } -func NewManagedDatabasesClientWithBaseURI(api environments.Api) (*ManagedDatabasesClient, error) { +func NewManagedDatabasesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabaseschemas/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabaseschemas/client.go index 80428f02fe3..9eeef1def07 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabaseschemas/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabaseschemas/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseSchemasClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseSchemasClientWithBaseURI(api environments.Api) (*ManagedDatabaseSchemasClient, error) { +func NewManagedDatabaseSchemasClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseSchemasClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabaseschemas", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseSchemasClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabasesecurityalertpolicies/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabasesecurityalertpolicies/client.go index 62a2219ec3f..3709e4e4bfd 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabasesecurityalertpolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabasesecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*ManagedDatabaseSecurityAlertPoliciesClient, error) { +func NewManagedDatabaseSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasesecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabasesecurityevents/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabasesecurityevents/client.go index 73c01b9bdf3..6daead92f9d 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabasesecurityevents/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabasesecurityevents/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseSecurityEventsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseSecurityEventsClientWithBaseURI(api environments.Api) (*ManagedDatabaseSecurityEventsClient, error) { +func NewManagedDatabaseSecurityEventsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseSecurityEventsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasesecurityevents", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseSecurityEventsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabasesensitivitylabels/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabasesensitivitylabels/client.go index 78458860b4a..8874421491f 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabasesensitivitylabels/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabasesensitivitylabels/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseSensitivityLabelsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseSensitivityLabelsClientWithBaseURI(api environments.Api) (*ManagedDatabaseSensitivityLabelsClient, error) { +func NewManagedDatabaseSensitivityLabelsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseSensitivityLabelsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasesensitivitylabels", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseSensitivityLabelsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabasetables/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabasetables/client.go index 1d9380f7cf1..1db4d4f81b0 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabasetables/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabasetables/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseTablesClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseTablesClientWithBaseURI(api environments.Api) (*ManagedDatabaseTablesClient, error) { +func NewManagedDatabaseTablesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseTablesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasetables", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseTablesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabasetransparentdataencryption/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabasetransparentdataencryption/client.go index 6c3d3c4b905..fc2685ce80b 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabasetransparentdataencryption/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabasetransparentdataencryption/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseTransparentDataEncryptionClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseTransparentDataEncryptionClientWithBaseURI(api environments.Api) (*ManagedDatabaseTransparentDataEncryptionClient, error) { +func NewManagedDatabaseTransparentDataEncryptionClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseTransparentDataEncryptionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasetransparentdataencryption", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseTransparentDataEncryptionClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/client.go index a6f46fb66ce..1ff05f1b589 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(api environments.Api) (*ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient, error) { +func NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasevulnerabilityassessmentrulebaselines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessments/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessments/client.go index 8e91917ebd7..7bddc409ce9 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessments/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseVulnerabilityAssessmentsClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseVulnerabilityAssessmentsClientWithBaseURI(api environments.Api) (*ManagedDatabaseVulnerabilityAssessmentsClient, error) { +func NewManagedDatabaseVulnerabilityAssessmentsClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseVulnerabilityAssessmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasevulnerabilityassessments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseVulnerabilityAssessmentsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessmentscans/client.go b/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessmentscans/client.go index 47f1b8fce44..063b024d7a4 100644 --- a/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessmentscans/client.go +++ b/resource-manager/sql/2022-11-01-preview/manageddatabasevulnerabilityassessmentscans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedDatabaseVulnerabilityAssessmentScansClient struct { Client *resourcemanager.Client } -func NewManagedDatabaseVulnerabilityAssessmentScansClientWithBaseURI(api environments.Api) (*ManagedDatabaseVulnerabilityAssessmentScansClient, error) { +func NewManagedDatabaseVulnerabilityAssessmentScansClientWithBaseURI(api sdkEnv.Api) (*ManagedDatabaseVulnerabilityAssessmentScansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "manageddatabasevulnerabilityassessmentscans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedDatabaseVulnerabilityAssessmentScansClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstanceadministrators/client.go b/resource-manager/sql/2022-11-01-preview/managedinstanceadministrators/client.go index 3f36bed3138..e168d22b382 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstanceadministrators/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstanceadministrators/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceAdministratorsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceAdministratorsClientWithBaseURI(api environments.Api) (*ManagedInstanceAdministratorsClient, error) { +func NewManagedInstanceAdministratorsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceAdministratorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceadministrators", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceAdministratorsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstanceadvancedthreatprotectionsettings/client.go b/resource-manager/sql/2022-11-01-preview/managedinstanceadvancedthreatprotectionsettings/client.go index e51f1530149..49a17f94091 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstanceadvancedthreatprotectionsettings/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstanceadvancedthreatprotectionsettings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceAdvancedThreatProtectionSettingsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceAdvancedThreatProtectionSettingsClientWithBaseURI(api environments.Api) (*ManagedInstanceAdvancedThreatProtectionSettingsClient, error) { +func NewManagedInstanceAdvancedThreatProtectionSettingsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceAdvancedThreatProtectionSettingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceadvancedthreatprotectionsettings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceAdvancedThreatProtectionSettingsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstanceazureadonlyauthentications/client.go b/resource-manager/sql/2022-11-01-preview/managedinstanceazureadonlyauthentications/client.go index 1f985cb8d30..b720ba23aa9 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstanceazureadonlyauthentications/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstanceazureadonlyauthentications/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceAzureADOnlyAuthenticationsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceAzureADOnlyAuthenticationsClientWithBaseURI(api environments.Api) (*ManagedInstanceAzureADOnlyAuthenticationsClient, error) { +func NewManagedInstanceAzureADOnlyAuthenticationsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceAzureADOnlyAuthenticationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceazureadonlyauthentications", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceAzureADOnlyAuthenticationsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstancedtcs/client.go b/resource-manager/sql/2022-11-01-preview/managedinstancedtcs/client.go index 2b9b96c424a..40ec8064090 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstancedtcs/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstancedtcs/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceDtcsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceDtcsClientWithBaseURI(api environments.Api) (*ManagedInstanceDtcsClient, error) { +func NewManagedInstanceDtcsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceDtcsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstancedtcs", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceDtcsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstanceencryptionprotectors/client.go b/resource-manager/sql/2022-11-01-preview/managedinstanceencryptionprotectors/client.go index ec30a659cfc..97851843a88 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstanceencryptionprotectors/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstanceencryptionprotectors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceEncryptionProtectorsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceEncryptionProtectorsClientWithBaseURI(api environments.Api) (*ManagedInstanceEncryptionProtectorsClient, error) { +func NewManagedInstanceEncryptionProtectorsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceEncryptionProtectorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceencryptionprotectors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceEncryptionProtectorsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstancekeys/client.go b/resource-manager/sql/2022-11-01-preview/managedinstancekeys/client.go index 23704f227a5..bcc500b4c35 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstancekeys/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstancekeys/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceKeysClient struct { Client *resourcemanager.Client } -func NewManagedInstanceKeysClientWithBaseURI(api environments.Api) (*ManagedInstanceKeysClient, error) { +func NewManagedInstanceKeysClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceKeysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstancekeys", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceKeysClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstancelongtermretentionpolicies/client.go b/resource-manager/sql/2022-11-01-preview/managedinstancelongtermretentionpolicies/client.go index 3158e1f6865..9903b619463 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstancelongtermretentionpolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstancelongtermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceLongTermRetentionPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedInstanceLongTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*ManagedInstanceLongTermRetentionPoliciesClient, error) { +func NewManagedInstanceLongTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceLongTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstancelongtermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceLongTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstanceoperations/client.go b/resource-manager/sql/2022-11-01-preview/managedinstanceoperations/client.go index 0472d9b9de6..29c7670fb92 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstanceoperations/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstanceoperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceOperationsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceOperationsClientWithBaseURI(api environments.Api) (*ManagedInstanceOperationsClient, error) { +func NewManagedInstanceOperationsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceoperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceOperationsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstanceprivateendpointconnections/client.go b/resource-manager/sql/2022-11-01-preview/managedinstanceprivateendpointconnections/client.go index 5d1f8bd729e..9d521b320c7 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstanceprivateendpointconnections/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstanceprivateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstancePrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewManagedInstancePrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*ManagedInstancePrivateEndpointConnectionsClient, error) { +func NewManagedInstancePrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstancePrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceprivateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstancePrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstanceprivatelinkresources/client.go b/resource-manager/sql/2022-11-01-preview/managedinstanceprivatelinkresources/client.go index 2bea9210bdb..e9394f6ccc1 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstanceprivatelinkresources/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstanceprivatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstancePrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewManagedInstancePrivateLinkResourcesClientWithBaseURI(api environments.Api) (*ManagedInstancePrivateLinkResourcesClient, error) { +func NewManagedInstancePrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*ManagedInstancePrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstanceprivatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstancePrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstances/client.go b/resource-manager/sql/2022-11-01-preview/managedinstances/client.go index f70c188e883..e3235f1761f 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstances/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstancesClient struct { Client *resourcemanager.Client } -func NewManagedInstancesClientWithBaseURI(api environments.Api) (*ManagedInstancesClient, error) { +func NewManagedInstancesClientWithBaseURI(api sdkEnv.Api) (*ManagedInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstancesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstancetdecertificates/client.go b/resource-manager/sql/2022-11-01-preview/managedinstancetdecertificates/client.go index 0e62a0c3c14..69a9782d30b 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstancetdecertificates/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstancetdecertificates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceTdeCertificatesClient struct { Client *resourcemanager.Client } -func NewManagedInstanceTdeCertificatesClientWithBaseURI(api environments.Api) (*ManagedInstanceTdeCertificatesClient, error) { +func NewManagedInstanceTdeCertificatesClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceTdeCertificatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstancetdecertificates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceTdeCertificatesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedinstancevulnerabilityassessments/client.go b/resource-manager/sql/2022-11-01-preview/managedinstancevulnerabilityassessments/client.go index dba1801866f..2ed4e36149a 100644 --- a/resource-manager/sql/2022-11-01-preview/managedinstancevulnerabilityassessments/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedinstancevulnerabilityassessments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedInstanceVulnerabilityAssessmentsClient struct { Client *resourcemanager.Client } -func NewManagedInstanceVulnerabilityAssessmentsClientWithBaseURI(api environments.Api) (*ManagedInstanceVulnerabilityAssessmentsClient, error) { +func NewManagedInstanceVulnerabilityAssessmentsClientWithBaseURI(api sdkEnv.Api) (*ManagedInstanceVulnerabilityAssessmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedinstancevulnerabilityassessments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedInstanceVulnerabilityAssessmentsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedledgerdigestuploads/client.go b/resource-manager/sql/2022-11-01-preview/managedledgerdigestuploads/client.go index 5bbc8135ed8..7281124bb07 100644 --- a/resource-manager/sql/2022-11-01-preview/managedledgerdigestuploads/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedledgerdigestuploads/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedLedgerDigestUploadsClient struct { Client *resourcemanager.Client } -func NewManagedLedgerDigestUploadsClientWithBaseURI(api environments.Api) (*ManagedLedgerDigestUploadsClient, error) { +func NewManagedLedgerDigestUploadsClientWithBaseURI(api sdkEnv.Api) (*ManagedLedgerDigestUploadsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedledgerdigestuploads", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedLedgerDigestUploadsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go b/resource-manager/sql/2022-11-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go index 4c4d6fc96ab..670015f9777 100644 --- a/resource-manager/sql/2022-11-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient stru Client *resourcemanager.Client } -func NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientWithBaseURI(api environments.Api) (*ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient, error) { +func NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedrestorabledroppeddatabasebackupshorttermretentionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedserverdnsaliases/client.go b/resource-manager/sql/2022-11-01-preview/managedserverdnsaliases/client.go index c0b02c58120..98d463859ed 100644 --- a/resource-manager/sql/2022-11-01-preview/managedserverdnsaliases/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedserverdnsaliases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedServerDnsAliasesClient struct { Client *resourcemanager.Client } -func NewManagedServerDnsAliasesClientWithBaseURI(api environments.Api) (*ManagedServerDnsAliasesClient, error) { +func NewManagedServerDnsAliasesClientWithBaseURI(api sdkEnv.Api) (*ManagedServerDnsAliasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedserverdnsaliases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedServerDnsAliasesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/managedserversecurityalertpolicies/client.go b/resource-manager/sql/2022-11-01-preview/managedserversecurityalertpolicies/client.go index 682f5dca4f1..05b3b5ac499 100644 --- a/resource-manager/sql/2022-11-01-preview/managedserversecurityalertpolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/managedserversecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedServerSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewManagedServerSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*ManagedServerSecurityAlertPoliciesClient, error) { +func NewManagedServerSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*ManagedServerSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedserversecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedServerSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/networksecurityperimeterconfigurations/client.go b/resource-manager/sql/2022-11-01-preview/networksecurityperimeterconfigurations/client.go index 126a8a7f6e7..fcfa52dea19 100644 --- a/resource-manager/sql/2022-11-01-preview/networksecurityperimeterconfigurations/client.go +++ b/resource-manager/sql/2022-11-01-preview/networksecurityperimeterconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type NetworkSecurityPerimeterConfigurationsClient struct { Client *resourcemanager.Client } -func NewNetworkSecurityPerimeterConfigurationsClientWithBaseURI(api environments.Api) (*NetworkSecurityPerimeterConfigurationsClient, error) { +func NewNetworkSecurityPerimeterConfigurationsClientWithBaseURI(api sdkEnv.Api) (*NetworkSecurityPerimeterConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "networksecurityperimeterconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating NetworkSecurityPerimeterConfigurationsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/outboundfirewallrules/client.go b/resource-manager/sql/2022-11-01-preview/outboundfirewallrules/client.go index c201a67bd0d..0c4a379b361 100644 --- a/resource-manager/sql/2022-11-01-preview/outboundfirewallrules/client.go +++ b/resource-manager/sql/2022-11-01-preview/outboundfirewallrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OutboundFirewallRulesClient struct { Client *resourcemanager.Client } -func NewOutboundFirewallRulesClientWithBaseURI(api environments.Api) (*OutboundFirewallRulesClient, error) { +func NewOutboundFirewallRulesClientWithBaseURI(api sdkEnv.Api) (*OutboundFirewallRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "outboundfirewallrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OutboundFirewallRulesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/privateendpointconnections/client.go b/resource-manager/sql/2022-11-01-preview/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/sql/2022-11-01-preview/privateendpointconnections/client.go +++ b/resource-manager/sql/2022-11-01-preview/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/privatelinkresources/client.go b/resource-manager/sql/2022-11-01-preview/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/sql/2022-11-01-preview/privatelinkresources/client.go +++ b/resource-manager/sql/2022-11-01-preview/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/recoverabledatabases/client.go b/resource-manager/sql/2022-11-01-preview/recoverabledatabases/client.go index e160aa7f8b1..02f03a13870 100644 --- a/resource-manager/sql/2022-11-01-preview/recoverabledatabases/client.go +++ b/resource-manager/sql/2022-11-01-preview/recoverabledatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecoverableDatabasesClient struct { Client *resourcemanager.Client } -func NewRecoverableDatabasesClientWithBaseURI(api environments.Api) (*RecoverableDatabasesClient, error) { +func NewRecoverableDatabasesClientWithBaseURI(api sdkEnv.Api) (*RecoverableDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recoverabledatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecoverableDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/recoverablemanageddatabases/client.go b/resource-manager/sql/2022-11-01-preview/recoverablemanageddatabases/client.go index b2a8dc495a7..dba4541310e 100644 --- a/resource-manager/sql/2022-11-01-preview/recoverablemanageddatabases/client.go +++ b/resource-manager/sql/2022-11-01-preview/recoverablemanageddatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecoverableManagedDatabasesClient struct { Client *resourcemanager.Client } -func NewRecoverableManagedDatabasesClientWithBaseURI(api environments.Api) (*RecoverableManagedDatabasesClient, error) { +func NewRecoverableManagedDatabasesClientWithBaseURI(api sdkEnv.Api) (*RecoverableManagedDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recoverablemanageddatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecoverableManagedDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/replicationlinks/client.go b/resource-manager/sql/2022-11-01-preview/replicationlinks/client.go index 03f89f79a5a..8c94eb32deb 100644 --- a/resource-manager/sql/2022-11-01-preview/replicationlinks/client.go +++ b/resource-manager/sql/2022-11-01-preview/replicationlinks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ReplicationLinksClient struct { Client *resourcemanager.Client } -func NewReplicationLinksClientWithBaseURI(api environments.Api) (*ReplicationLinksClient, error) { +func NewReplicationLinksClientWithBaseURI(api sdkEnv.Api) (*ReplicationLinksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "replicationlinks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ReplicationLinksClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/restorabledroppeddatabases/client.go b/resource-manager/sql/2022-11-01-preview/restorabledroppeddatabases/client.go index 99de64c31bb..f57ca75818c 100644 --- a/resource-manager/sql/2022-11-01-preview/restorabledroppeddatabases/client.go +++ b/resource-manager/sql/2022-11-01-preview/restorabledroppeddatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RestorableDroppedDatabasesClient struct { Client *resourcemanager.Client } -func NewRestorableDroppedDatabasesClientWithBaseURI(api environments.Api) (*RestorableDroppedDatabasesClient, error) { +func NewRestorableDroppedDatabasesClientWithBaseURI(api sdkEnv.Api) (*RestorableDroppedDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "restorabledroppeddatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RestorableDroppedDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/restorabledroppedmanageddatabases/client.go b/resource-manager/sql/2022-11-01-preview/restorabledroppedmanageddatabases/client.go index efe2c49c9e7..dfba7b21805 100644 --- a/resource-manager/sql/2022-11-01-preview/restorabledroppedmanageddatabases/client.go +++ b/resource-manager/sql/2022-11-01-preview/restorabledroppedmanageddatabases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RestorableDroppedManagedDatabasesClient struct { Client *resourcemanager.Client } -func NewRestorableDroppedManagedDatabasesClientWithBaseURI(api environments.Api) (*RestorableDroppedManagedDatabasesClient, error) { +func NewRestorableDroppedManagedDatabasesClientWithBaseURI(api sdkEnv.Api) (*RestorableDroppedManagedDatabasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "restorabledroppedmanageddatabases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RestorableDroppedManagedDatabasesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/restorepoints/client.go b/resource-manager/sql/2022-11-01-preview/restorepoints/client.go index 48f2cb36b23..c9547779bf4 100644 --- a/resource-manager/sql/2022-11-01-preview/restorepoints/client.go +++ b/resource-manager/sql/2022-11-01-preview/restorepoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RestorePointsClient struct { Client *resourcemanager.Client } -func NewRestorePointsClientWithBaseURI(api environments.Api) (*RestorePointsClient, error) { +func NewRestorePointsClientWithBaseURI(api sdkEnv.Api) (*RestorePointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "restorepoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RestorePointsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/sensitivitylabels/client.go b/resource-manager/sql/2022-11-01-preview/sensitivitylabels/client.go index 53b1fe6d1ae..62811ab7985 100644 --- a/resource-manager/sql/2022-11-01-preview/sensitivitylabels/client.go +++ b/resource-manager/sql/2022-11-01-preview/sensitivitylabels/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SensitivityLabelsClient struct { Client *resourcemanager.Client } -func NewSensitivityLabelsClientWithBaseURI(api environments.Api) (*SensitivityLabelsClient, error) { +func NewSensitivityLabelsClientWithBaseURI(api sdkEnv.Api) (*SensitivityLabelsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sensitivitylabels", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SensitivityLabelsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serveradvancedthreatprotectionsettings/client.go b/resource-manager/sql/2022-11-01-preview/serveradvancedthreatprotectionsettings/client.go index 6cda6d7a90f..9cfaf6b6a75 100644 --- a/resource-manager/sql/2022-11-01-preview/serveradvancedthreatprotectionsettings/client.go +++ b/resource-manager/sql/2022-11-01-preview/serveradvancedthreatprotectionsettings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerAdvancedThreatProtectionSettingsClient struct { Client *resourcemanager.Client } -func NewServerAdvancedThreatProtectionSettingsClientWithBaseURI(api environments.Api) (*ServerAdvancedThreatProtectionSettingsClient, error) { +func NewServerAdvancedThreatProtectionSettingsClientWithBaseURI(api sdkEnv.Api) (*ServerAdvancedThreatProtectionSettingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serveradvancedthreatprotectionsettings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerAdvancedThreatProtectionSettingsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serveradvisors/client.go b/resource-manager/sql/2022-11-01-preview/serveradvisors/client.go index da2581af35c..4988b0f5a80 100644 --- a/resource-manager/sql/2022-11-01-preview/serveradvisors/client.go +++ b/resource-manager/sql/2022-11-01-preview/serveradvisors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerAdvisorsClient struct { Client *resourcemanager.Client } -func NewServerAdvisorsClientWithBaseURI(api environments.Api) (*ServerAdvisorsClient, error) { +func NewServerAdvisorsClientWithBaseURI(api sdkEnv.Api) (*ServerAdvisorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serveradvisors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerAdvisorsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serverautomatictuning/client.go b/resource-manager/sql/2022-11-01-preview/serverautomatictuning/client.go index 521f5b2122c..e9b57bc0a61 100644 --- a/resource-manager/sql/2022-11-01-preview/serverautomatictuning/client.go +++ b/resource-manager/sql/2022-11-01-preview/serverautomatictuning/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerAutomaticTuningClient struct { Client *resourcemanager.Client } -func NewServerAutomaticTuningClientWithBaseURI(api environments.Api) (*ServerAutomaticTuningClient, error) { +func NewServerAutomaticTuningClientWithBaseURI(api sdkEnv.Api) (*ServerAutomaticTuningClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverautomatictuning", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerAutomaticTuningClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serverazureadadministrators/client.go b/resource-manager/sql/2022-11-01-preview/serverazureadadministrators/client.go index fe5a9d1e7a9..2573ae2ca5b 100644 --- a/resource-manager/sql/2022-11-01-preview/serverazureadadministrators/client.go +++ b/resource-manager/sql/2022-11-01-preview/serverazureadadministrators/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerAzureADAdministratorsClient struct { Client *resourcemanager.Client } -func NewServerAzureADAdministratorsClientWithBaseURI(api environments.Api) (*ServerAzureADAdministratorsClient, error) { +func NewServerAzureADAdministratorsClientWithBaseURI(api sdkEnv.Api) (*ServerAzureADAdministratorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverazureadadministrators", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerAzureADAdministratorsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serverazureadonlyauthentications/client.go b/resource-manager/sql/2022-11-01-preview/serverazureadonlyauthentications/client.go index b5c3d6d2bb3..a895d8f59db 100644 --- a/resource-manager/sql/2022-11-01-preview/serverazureadonlyauthentications/client.go +++ b/resource-manager/sql/2022-11-01-preview/serverazureadonlyauthentications/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerAzureADOnlyAuthenticationsClient struct { Client *resourcemanager.Client } -func NewServerAzureADOnlyAuthenticationsClientWithBaseURI(api environments.Api) (*ServerAzureADOnlyAuthenticationsClient, error) { +func NewServerAzureADOnlyAuthenticationsClientWithBaseURI(api sdkEnv.Api) (*ServerAzureADOnlyAuthenticationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverazureadonlyauthentications", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerAzureADOnlyAuthenticationsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serverconfigurationoptions/client.go b/resource-manager/sql/2022-11-01-preview/serverconfigurationoptions/client.go index e9ce3e63684..d7432e27645 100644 --- a/resource-manager/sql/2022-11-01-preview/serverconfigurationoptions/client.go +++ b/resource-manager/sql/2022-11-01-preview/serverconfigurationoptions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerConfigurationOptionsClient struct { Client *resourcemanager.Client } -func NewServerConfigurationOptionsClientWithBaseURI(api environments.Api) (*ServerConfigurationOptionsClient, error) { +func NewServerConfigurationOptionsClientWithBaseURI(api sdkEnv.Api) (*ServerConfigurationOptionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverconfigurationoptions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerConfigurationOptionsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serverconnectionpolicies/client.go b/resource-manager/sql/2022-11-01-preview/serverconnectionpolicies/client.go index 725a173c26b..588925ecc96 100644 --- a/resource-manager/sql/2022-11-01-preview/serverconnectionpolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/serverconnectionpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerConnectionPoliciesClient struct { Client *resourcemanager.Client } -func NewServerConnectionPoliciesClientWithBaseURI(api environments.Api) (*ServerConnectionPoliciesClient, error) { +func NewServerConnectionPoliciesClientWithBaseURI(api sdkEnv.Api) (*ServerConnectionPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverconnectionpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerConnectionPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serverdevopsaudit/client.go b/resource-manager/sql/2022-11-01-preview/serverdevopsaudit/client.go index 6e6009ae7b6..642f119e3f3 100644 --- a/resource-manager/sql/2022-11-01-preview/serverdevopsaudit/client.go +++ b/resource-manager/sql/2022-11-01-preview/serverdevopsaudit/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerDevOpsAuditClient struct { Client *resourcemanager.Client } -func NewServerDevOpsAuditClientWithBaseURI(api environments.Api) (*ServerDevOpsAuditClient, error) { +func NewServerDevOpsAuditClientWithBaseURI(api sdkEnv.Api) (*ServerDevOpsAuditClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverdevopsaudit", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerDevOpsAuditClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serverdnsaliases/client.go b/resource-manager/sql/2022-11-01-preview/serverdnsaliases/client.go index 08d964c99ca..466e1c505ff 100644 --- a/resource-manager/sql/2022-11-01-preview/serverdnsaliases/client.go +++ b/resource-manager/sql/2022-11-01-preview/serverdnsaliases/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerDnsAliasesClient struct { Client *resourcemanager.Client } -func NewServerDnsAliasesClientWithBaseURI(api environments.Api) (*ServerDnsAliasesClient, error) { +func NewServerDnsAliasesClientWithBaseURI(api sdkEnv.Api) (*ServerDnsAliasesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverdnsaliases", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerDnsAliasesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serverkeys/client.go b/resource-manager/sql/2022-11-01-preview/serverkeys/client.go index 2d13d1376e4..bdf57b964b5 100644 --- a/resource-manager/sql/2022-11-01-preview/serverkeys/client.go +++ b/resource-manager/sql/2022-11-01-preview/serverkeys/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerKeysClient struct { Client *resourcemanager.Client } -func NewServerKeysClientWithBaseURI(api environments.Api) (*ServerKeysClient, error) { +func NewServerKeysClientWithBaseURI(api sdkEnv.Api) (*ServerKeysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverkeys", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerKeysClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serveroperations/client.go b/resource-manager/sql/2022-11-01-preview/serveroperations/client.go index 8110e209e12..cd60890eae4 100644 --- a/resource-manager/sql/2022-11-01-preview/serveroperations/client.go +++ b/resource-manager/sql/2022-11-01-preview/serveroperations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerOperationsClient struct { Client *resourcemanager.Client } -func NewServerOperationsClientWithBaseURI(api environments.Api) (*ServerOperationsClient, error) { +func NewServerOperationsClientWithBaseURI(api sdkEnv.Api) (*ServerOperationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serveroperations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerOperationsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/servers/client.go b/resource-manager/sql/2022-11-01-preview/servers/client.go index a1e11668771..0788963b1fb 100644 --- a/resource-manager/sql/2022-11-01-preview/servers/client.go +++ b/resource-manager/sql/2022-11-01-preview/servers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServersClient struct { Client *resourcemanager.Client } -func NewServersClientWithBaseURI(api environments.Api) (*ServersClient, error) { +func NewServersClientWithBaseURI(api sdkEnv.Api) (*ServersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServersClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serversecurityalertpolicies/client.go b/resource-manager/sql/2022-11-01-preview/serversecurityalertpolicies/client.go index 39566058ad5..14a7b7cdb0b 100644 --- a/resource-manager/sql/2022-11-01-preview/serversecurityalertpolicies/client.go +++ b/resource-manager/sql/2022-11-01-preview/serversecurityalertpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerSecurityAlertPoliciesClient struct { Client *resourcemanager.Client } -func NewServerSecurityAlertPoliciesClientWithBaseURI(api environments.Api) (*ServerSecurityAlertPoliciesClient, error) { +func NewServerSecurityAlertPoliciesClientWithBaseURI(api sdkEnv.Api) (*ServerSecurityAlertPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serversecurityalertpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerSecurityAlertPoliciesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/servertrustcertificates/client.go b/resource-manager/sql/2022-11-01-preview/servertrustcertificates/client.go index b7c20a753c7..88a9d787837 100644 --- a/resource-manager/sql/2022-11-01-preview/servertrustcertificates/client.go +++ b/resource-manager/sql/2022-11-01-preview/servertrustcertificates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerTrustCertificatesClient struct { Client *resourcemanager.Client } -func NewServerTrustCertificatesClientWithBaseURI(api environments.Api) (*ServerTrustCertificatesClient, error) { +func NewServerTrustCertificatesClientWithBaseURI(api sdkEnv.Api) (*ServerTrustCertificatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servertrustcertificates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerTrustCertificatesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/servertrustgroups/client.go b/resource-manager/sql/2022-11-01-preview/servertrustgroups/client.go index 999ce9c96b4..ce887cfeef1 100644 --- a/resource-manager/sql/2022-11-01-preview/servertrustgroups/client.go +++ b/resource-manager/sql/2022-11-01-preview/servertrustgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerTrustGroupsClient struct { Client *resourcemanager.Client } -func NewServerTrustGroupsClientWithBaseURI(api environments.Api) (*ServerTrustGroupsClient, error) { +func NewServerTrustGroupsClientWithBaseURI(api sdkEnv.Api) (*ServerTrustGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servertrustgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerTrustGroupsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/serverusages/client.go b/resource-manager/sql/2022-11-01-preview/serverusages/client.go index c277024d343..1297a754abd 100644 --- a/resource-manager/sql/2022-11-01-preview/serverusages/client.go +++ b/resource-manager/sql/2022-11-01-preview/serverusages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerUsagesClient struct { Client *resourcemanager.Client } -func NewServerUsagesClientWithBaseURI(api environments.Api) (*ServerUsagesClient, error) { +func NewServerUsagesClientWithBaseURI(api sdkEnv.Api) (*ServerUsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverusages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerUsagesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/servervulnerabilityassessments/client.go b/resource-manager/sql/2022-11-01-preview/servervulnerabilityassessments/client.go index d6add06fcde..e608a74baf3 100644 --- a/resource-manager/sql/2022-11-01-preview/servervulnerabilityassessments/client.go +++ b/resource-manager/sql/2022-11-01-preview/servervulnerabilityassessments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerVulnerabilityAssessmentsClient struct { Client *resourcemanager.Client } -func NewServerVulnerabilityAssessmentsClientWithBaseURI(api environments.Api) (*ServerVulnerabilityAssessmentsClient, error) { +func NewServerVulnerabilityAssessmentsClientWithBaseURI(api sdkEnv.Api) (*ServerVulnerabilityAssessmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "servervulnerabilityassessments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerVulnerabilityAssessmentsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/sqlagent/client.go b/resource-manager/sql/2022-11-01-preview/sqlagent/client.go index 4fe921ff441..7296c7e0ed8 100644 --- a/resource-manager/sql/2022-11-01-preview/sqlagent/client.go +++ b/resource-manager/sql/2022-11-01-preview/sqlagent/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SqlAgentClient struct { Client *resourcemanager.Client } -func NewSqlAgentClientWithBaseURI(api environments.Api) (*SqlAgentClient, error) { +func NewSqlAgentClientWithBaseURI(api sdkEnv.Api) (*SqlAgentClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sqlagent", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SqlAgentClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentbaseline/client.go b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentbaseline/client.go index cee8c71ef7f..03483aeb4fe 100644 --- a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentbaseline/client.go +++ b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentbaseline/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SqlVulnerabilityAssessmentBaselineClient struct { Client *resourcemanager.Client } -func NewSqlVulnerabilityAssessmentBaselineClientWithBaseURI(api environments.Api) (*SqlVulnerabilityAssessmentBaselineClient, error) { +func NewSqlVulnerabilityAssessmentBaselineClientWithBaseURI(api sdkEnv.Api) (*SqlVulnerabilityAssessmentBaselineClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sqlvulnerabilityassessmentbaseline", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SqlVulnerabilityAssessmentBaselineClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentexecutescan/client.go b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentexecutescan/client.go index 1f905750180..7aa09c339c2 100644 --- a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentexecutescan/client.go +++ b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentexecutescan/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SqlVulnerabilityAssessmentExecuteScanClient struct { Client *resourcemanager.Client } -func NewSqlVulnerabilityAssessmentExecuteScanClientWithBaseURI(api environments.Api) (*SqlVulnerabilityAssessmentExecuteScanClient, error) { +func NewSqlVulnerabilityAssessmentExecuteScanClientWithBaseURI(api sdkEnv.Api) (*SqlVulnerabilityAssessmentExecuteScanClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sqlvulnerabilityassessmentexecutescan", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SqlVulnerabilityAssessmentExecuteScanClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentrulebaseline/client.go b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentrulebaseline/client.go index 18145154253..005bdc8e3ed 100644 --- a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentrulebaseline/client.go +++ b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentrulebaseline/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SqlVulnerabilityAssessmentRuleBaselineClient struct { Client *resourcemanager.Client } -func NewSqlVulnerabilityAssessmentRuleBaselineClientWithBaseURI(api environments.Api) (*SqlVulnerabilityAssessmentRuleBaselineClient, error) { +func NewSqlVulnerabilityAssessmentRuleBaselineClientWithBaseURI(api sdkEnv.Api) (*SqlVulnerabilityAssessmentRuleBaselineClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sqlvulnerabilityassessmentrulebaseline", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SqlVulnerabilityAssessmentRuleBaselineClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentscanresult/client.go b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentscanresult/client.go index 235769eea49..bafb7cb7dc4 100644 --- a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentscanresult/client.go +++ b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentscanresult/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SqlVulnerabilityAssessmentScanResultClient struct { Client *resourcemanager.Client } -func NewSqlVulnerabilityAssessmentScanResultClientWithBaseURI(api environments.Api) (*SqlVulnerabilityAssessmentScanResultClient, error) { +func NewSqlVulnerabilityAssessmentScanResultClientWithBaseURI(api sdkEnv.Api) (*SqlVulnerabilityAssessmentScanResultClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sqlvulnerabilityassessmentscanresult", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SqlVulnerabilityAssessmentScanResultClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentscans/client.go b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentscans/client.go index 9ba87ad7535..56772578b53 100644 --- a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentscans/client.go +++ b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentscans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SqlVulnerabilityAssessmentScansClient struct { Client *resourcemanager.Client } -func NewSqlVulnerabilityAssessmentScansClientWithBaseURI(api environments.Api) (*SqlVulnerabilityAssessmentScansClient, error) { +func NewSqlVulnerabilityAssessmentScansClientWithBaseURI(api sdkEnv.Api) (*SqlVulnerabilityAssessmentScansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sqlvulnerabilityassessmentscans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SqlVulnerabilityAssessmentScansClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentssettings/client.go b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentssettings/client.go index ccf4dc91c01..a5a450c11b6 100644 --- a/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentssettings/client.go +++ b/resource-manager/sql/2022-11-01-preview/sqlvulnerabilityassessmentssettings/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SqlVulnerabilityAssessmentsSettingsClient struct { Client *resourcemanager.Client } -func NewSqlVulnerabilityAssessmentsSettingsClientWithBaseURI(api environments.Api) (*SqlVulnerabilityAssessmentsSettingsClient, error) { +func NewSqlVulnerabilityAssessmentsSettingsClientWithBaseURI(api sdkEnv.Api) (*SqlVulnerabilityAssessmentsSettingsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sqlvulnerabilityassessmentssettings", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SqlVulnerabilityAssessmentsSettingsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/startstopmanagedinstanceschedules/client.go b/resource-manager/sql/2022-11-01-preview/startstopmanagedinstanceschedules/client.go index 2cad921decb..5fa3268d035 100644 --- a/resource-manager/sql/2022-11-01-preview/startstopmanagedinstanceschedules/client.go +++ b/resource-manager/sql/2022-11-01-preview/startstopmanagedinstanceschedules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StartStopManagedInstanceSchedulesClient struct { Client *resourcemanager.Client } -func NewStartStopManagedInstanceSchedulesClientWithBaseURI(api environments.Api) (*StartStopManagedInstanceSchedulesClient, error) { +func NewStartStopManagedInstanceSchedulesClientWithBaseURI(api sdkEnv.Api) (*StartStopManagedInstanceSchedulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "startstopmanagedinstanceschedules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StartStopManagedInstanceSchedulesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/subscriptionusages/client.go b/resource-manager/sql/2022-11-01-preview/subscriptionusages/client.go index 5a8f2f1f695..cb0d84cf060 100644 --- a/resource-manager/sql/2022-11-01-preview/subscriptionusages/client.go +++ b/resource-manager/sql/2022-11-01-preview/subscriptionusages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SubscriptionUsagesClient struct { Client *resourcemanager.Client } -func NewSubscriptionUsagesClientWithBaseURI(api environments.Api) (*SubscriptionUsagesClient, error) { +func NewSubscriptionUsagesClientWithBaseURI(api sdkEnv.Api) (*SubscriptionUsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "subscriptionusages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SubscriptionUsagesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/synapselinkworkspaces/client.go b/resource-manager/sql/2022-11-01-preview/synapselinkworkspaces/client.go index 3e0da64656d..3c117c2c2c3 100644 --- a/resource-manager/sql/2022-11-01-preview/synapselinkworkspaces/client.go +++ b/resource-manager/sql/2022-11-01-preview/synapselinkworkspaces/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SynapseLinkWorkspacesClient struct { Client *resourcemanager.Client } -func NewSynapseLinkWorkspacesClientWithBaseURI(api environments.Api) (*SynapseLinkWorkspacesClient, error) { +func NewSynapseLinkWorkspacesClientWithBaseURI(api sdkEnv.Api) (*SynapseLinkWorkspacesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "synapselinkworkspaces", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SynapseLinkWorkspacesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/syncagents/client.go b/resource-manager/sql/2022-11-01-preview/syncagents/client.go index 0a8dacc0a53..fc1b48aacaf 100644 --- a/resource-manager/sql/2022-11-01-preview/syncagents/client.go +++ b/resource-manager/sql/2022-11-01-preview/syncagents/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SyncAgentsClient struct { Client *resourcemanager.Client } -func NewSyncAgentsClientWithBaseURI(api environments.Api) (*SyncAgentsClient, error) { +func NewSyncAgentsClientWithBaseURI(api sdkEnv.Api) (*SyncAgentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "syncagents", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SyncAgentsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/syncgroups/client.go b/resource-manager/sql/2022-11-01-preview/syncgroups/client.go index 1d8dd0ea3be..8283b09ee97 100644 --- a/resource-manager/sql/2022-11-01-preview/syncgroups/client.go +++ b/resource-manager/sql/2022-11-01-preview/syncgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SyncGroupsClient struct { Client *resourcemanager.Client } -func NewSyncGroupsClientWithBaseURI(api environments.Api) (*SyncGroupsClient, error) { +func NewSyncGroupsClientWithBaseURI(api sdkEnv.Api) (*SyncGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "syncgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SyncGroupsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/syncmembers/client.go b/resource-manager/sql/2022-11-01-preview/syncmembers/client.go index 6fc8fd37189..ce63e6bc760 100644 --- a/resource-manager/sql/2022-11-01-preview/syncmembers/client.go +++ b/resource-manager/sql/2022-11-01-preview/syncmembers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SyncMembersClient struct { Client *resourcemanager.Client } -func NewSyncMembersClientWithBaseURI(api environments.Api) (*SyncMembersClient, error) { +func NewSyncMembersClientWithBaseURI(api sdkEnv.Api) (*SyncMembersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "syncmembers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SyncMembersClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/tdecertificates/client.go b/resource-manager/sql/2022-11-01-preview/tdecertificates/client.go index a243cc5e8a8..8bab9de60f8 100644 --- a/resource-manager/sql/2022-11-01-preview/tdecertificates/client.go +++ b/resource-manager/sql/2022-11-01-preview/tdecertificates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TdeCertificatesClient struct { Client *resourcemanager.Client } -func NewTdeCertificatesClientWithBaseURI(api environments.Api) (*TdeCertificatesClient, error) { +func NewTdeCertificatesClientWithBaseURI(api sdkEnv.Api) (*TdeCertificatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "tdecertificates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TdeCertificatesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/timezones/client.go b/resource-manager/sql/2022-11-01-preview/timezones/client.go index 985d2a69dc3..0e725b9f424 100644 --- a/resource-manager/sql/2022-11-01-preview/timezones/client.go +++ b/resource-manager/sql/2022-11-01-preview/timezones/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TimeZonesClient struct { Client *resourcemanager.Client } -func NewTimeZonesClientWithBaseURI(api environments.Api) (*TimeZonesClient, error) { +func NewTimeZonesClientWithBaseURI(api sdkEnv.Api) (*TimeZonesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "timezones", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TimeZonesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/transparentdataencryptions/client.go b/resource-manager/sql/2022-11-01-preview/transparentdataencryptions/client.go index 3e0fc0829a6..de631e81772 100644 --- a/resource-manager/sql/2022-11-01-preview/transparentdataencryptions/client.go +++ b/resource-manager/sql/2022-11-01-preview/transparentdataencryptions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TransparentDataEncryptionsClient struct { Client *resourcemanager.Client } -func NewTransparentDataEncryptionsClientWithBaseURI(api environments.Api) (*TransparentDataEncryptionsClient, error) { +func NewTransparentDataEncryptionsClientWithBaseURI(api sdkEnv.Api) (*TransparentDataEncryptionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "transparentdataencryptions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TransparentDataEncryptionsClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/usages/client.go b/resource-manager/sql/2022-11-01-preview/usages/client.go index 99b2625224d..9319b1a1f51 100644 --- a/resource-manager/sql/2022-11-01-preview/usages/client.go +++ b/resource-manager/sql/2022-11-01-preview/usages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsagesClient struct { Client *resourcemanager.Client } -func NewUsagesClientWithBaseURI(api environments.Api) (*UsagesClient, error) { +func NewUsagesClientWithBaseURI(api sdkEnv.Api) (*UsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsagesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/virtualclusters/client.go b/resource-manager/sql/2022-11-01-preview/virtualclusters/client.go index efe7feb3346..dbc5ecfc21c 100644 --- a/resource-manager/sql/2022-11-01-preview/virtualclusters/client.go +++ b/resource-manager/sql/2022-11-01-preview/virtualclusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualClustersClient struct { Client *resourcemanager.Client } -func NewVirtualClustersClientWithBaseURI(api environments.Api) (*VirtualClustersClient, error) { +func NewVirtualClustersClientWithBaseURI(api sdkEnv.Api) (*VirtualClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualclusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualClustersClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/virtualnetworkrules/client.go b/resource-manager/sql/2022-11-01-preview/virtualnetworkrules/client.go index b85d828ef86..6c65981bc1c 100644 --- a/resource-manager/sql/2022-11-01-preview/virtualnetworkrules/client.go +++ b/resource-manager/sql/2022-11-01-preview/virtualnetworkrules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualNetworkRulesClient struct { Client *resourcemanager.Client } -func NewVirtualNetworkRulesClientWithBaseURI(api environments.Api) (*VirtualNetworkRulesClient, error) { +func NewVirtualNetworkRulesClientWithBaseURI(api sdkEnv.Api) (*VirtualNetworkRulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualnetworkrules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualNetworkRulesClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/workloadclassifiers/client.go b/resource-manager/sql/2022-11-01-preview/workloadclassifiers/client.go index 08521d24396..e2175fb4869 100644 --- a/resource-manager/sql/2022-11-01-preview/workloadclassifiers/client.go +++ b/resource-manager/sql/2022-11-01-preview/workloadclassifiers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkloadClassifiersClient struct { Client *resourcemanager.Client } -func NewWorkloadClassifiersClientWithBaseURI(api environments.Api) (*WorkloadClassifiersClient, error) { +func NewWorkloadClassifiersClientWithBaseURI(api sdkEnv.Api) (*WorkloadClassifiersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workloadclassifiers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkloadClassifiersClient: %+v", err) diff --git a/resource-manager/sql/2022-11-01-preview/workloadgroups/client.go b/resource-manager/sql/2022-11-01-preview/workloadgroups/client.go index e52783a2762..4073edd116c 100644 --- a/resource-manager/sql/2022-11-01-preview/workloadgroups/client.go +++ b/resource-manager/sql/2022-11-01-preview/workloadgroups/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkloadGroupsClient struct { Client *resourcemanager.Client } -func NewWorkloadGroupsClientWithBaseURI(api environments.Api) (*WorkloadGroupsClient, error) { +func NewWorkloadGroupsClientWithBaseURI(api sdkEnv.Api) (*WorkloadGroupsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workloadgroups", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkloadGroupsClient: %+v", err) diff --git a/resource-manager/storagecache/2023-01-01/ascusages/client.go b/resource-manager/storagecache/2023-01-01/ascusages/client.go index 3add20a22b0..204c6b27c60 100644 --- a/resource-manager/storagecache/2023-01-01/ascusages/client.go +++ b/resource-manager/storagecache/2023-01-01/ascusages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AscUsagesClient struct { Client *resourcemanager.Client } -func NewAscUsagesClientWithBaseURI(api environments.Api) (*AscUsagesClient, error) { +func NewAscUsagesClientWithBaseURI(api sdkEnv.Api) (*AscUsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ascusages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AscUsagesClient: %+v", err) diff --git a/resource-manager/storagecache/2023-01-01/caches/client.go b/resource-manager/storagecache/2023-01-01/caches/client.go index 835669be0d9..dd4e856e437 100644 --- a/resource-manager/storagecache/2023-01-01/caches/client.go +++ b/resource-manager/storagecache/2023-01-01/caches/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CachesClient struct { Client *resourcemanager.Client } -func NewCachesClientWithBaseURI(api environments.Api) (*CachesClient, error) { +func NewCachesClientWithBaseURI(api sdkEnv.Api) (*CachesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "caches", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CachesClient: %+v", err) diff --git a/resource-manager/storagecache/2023-01-01/client.go b/resource-manager/storagecache/2023-01-01/client.go index 6e022cd724f..00363549fcb 100644 --- a/resource-manager/storagecache/2023-01-01/client.go +++ b/resource-manager/storagecache/2023-01-01/client.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/storagecache/2023-01-01/storagetargets" "github.com/hashicorp/go-azure-sdk/resource-manager/storagecache/2023-01-01/usagemodels" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -23,7 +23,7 @@ type Client struct { UsageModels *usagemodels.UsageModelsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { ascUsagesClient, err := ascusages.NewAscUsagesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AscUsages client: %+v", err) diff --git a/resource-manager/storagecache/2023-01-01/skus/client.go b/resource-manager/storagecache/2023-01-01/skus/client.go index a4a6d07870b..f3fc5c07d88 100644 --- a/resource-manager/storagecache/2023-01-01/skus/client.go +++ b/resource-manager/storagecache/2023-01-01/skus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SKUsClient struct { Client *resourcemanager.Client } -func NewSKUsClientWithBaseURI(api environments.Api) (*SKUsClient, error) { +func NewSKUsClientWithBaseURI(api sdkEnv.Api) (*SKUsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "skus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SKUsClient: %+v", err) diff --git a/resource-manager/storagecache/2023-01-01/storagetargets/client.go b/resource-manager/storagecache/2023-01-01/storagetargets/client.go index 66cbfc76336..1915834d1ad 100644 --- a/resource-manager/storagecache/2023-01-01/storagetargets/client.go +++ b/resource-manager/storagecache/2023-01-01/storagetargets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StorageTargetsClient struct { Client *resourcemanager.Client } -func NewStorageTargetsClientWithBaseURI(api environments.Api) (*StorageTargetsClient, error) { +func NewStorageTargetsClientWithBaseURI(api sdkEnv.Api) (*StorageTargetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "storagetargets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StorageTargetsClient: %+v", err) diff --git a/resource-manager/storagecache/2023-01-01/usagemodels/client.go b/resource-manager/storagecache/2023-01-01/usagemodels/client.go index 44b379baa2b..985ebdf1dfe 100644 --- a/resource-manager/storagecache/2023-01-01/usagemodels/client.go +++ b/resource-manager/storagecache/2023-01-01/usagemodels/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsageModelsClient struct { Client *resourcemanager.Client } -func NewUsageModelsClientWithBaseURI(api environments.Api) (*UsageModelsClient, error) { +func NewUsageModelsClientWithBaseURI(api sdkEnv.Api) (*UsageModelsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usagemodels", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsageModelsClient: %+v", err) diff --git a/resource-manager/storagecache/2023-05-01/amlfilesystems/client.go b/resource-manager/storagecache/2023-05-01/amlfilesystems/client.go index f7ac7ebaaed..2333fb988be 100644 --- a/resource-manager/storagecache/2023-05-01/amlfilesystems/client.go +++ b/resource-manager/storagecache/2023-05-01/amlfilesystems/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AmlFilesystemsClient struct { Client *resourcemanager.Client } -func NewAmlFilesystemsClientWithBaseURI(api environments.Api) (*AmlFilesystemsClient, error) { +func NewAmlFilesystemsClientWithBaseURI(api sdkEnv.Api) (*AmlFilesystemsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "amlfilesystems", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AmlFilesystemsClient: %+v", err) diff --git a/resource-manager/storagecache/2023-05-01/ascusages/client.go b/resource-manager/storagecache/2023-05-01/ascusages/client.go index 3add20a22b0..204c6b27c60 100644 --- a/resource-manager/storagecache/2023-05-01/ascusages/client.go +++ b/resource-manager/storagecache/2023-05-01/ascusages/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AscUsagesClient struct { Client *resourcemanager.Client } -func NewAscUsagesClientWithBaseURI(api environments.Api) (*AscUsagesClient, error) { +func NewAscUsagesClientWithBaseURI(api sdkEnv.Api) (*AscUsagesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "ascusages", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AscUsagesClient: %+v", err) diff --git a/resource-manager/storagecache/2023-05-01/caches/client.go b/resource-manager/storagecache/2023-05-01/caches/client.go index 835669be0d9..dd4e856e437 100644 --- a/resource-manager/storagecache/2023-05-01/caches/client.go +++ b/resource-manager/storagecache/2023-05-01/caches/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CachesClient struct { Client *resourcemanager.Client } -func NewCachesClientWithBaseURI(api environments.Api) (*CachesClient, error) { +func NewCachesClientWithBaseURI(api sdkEnv.Api) (*CachesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "caches", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CachesClient: %+v", err) diff --git a/resource-manager/storagecache/2023-05-01/client.go b/resource-manager/storagecache/2023-05-01/client.go index f563c3ebc90..d081542a603 100644 --- a/resource-manager/storagecache/2023-05-01/client.go +++ b/resource-manager/storagecache/2023-05-01/client.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/storagecache/2023-05-01/storagetargets" "github.com/hashicorp/go-azure-sdk/resource-manager/storagecache/2023-05-01/usagemodels" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -25,7 +25,7 @@ type Client struct { UsageModels *usagemodels.UsageModelsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { amlFilesystemsClient, err := amlfilesystems.NewAmlFilesystemsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AmlFilesystems client: %+v", err) diff --git a/resource-manager/storagecache/2023-05-01/skus/client.go b/resource-manager/storagecache/2023-05-01/skus/client.go index a4a6d07870b..f3fc5c07d88 100644 --- a/resource-manager/storagecache/2023-05-01/skus/client.go +++ b/resource-manager/storagecache/2023-05-01/skus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SKUsClient struct { Client *resourcemanager.Client } -func NewSKUsClientWithBaseURI(api environments.Api) (*SKUsClient, error) { +func NewSKUsClientWithBaseURI(api sdkEnv.Api) (*SKUsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "skus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SKUsClient: %+v", err) diff --git a/resource-manager/storagecache/2023-05-01/storagetargets/client.go b/resource-manager/storagecache/2023-05-01/storagetargets/client.go index 66cbfc76336..1915834d1ad 100644 --- a/resource-manager/storagecache/2023-05-01/storagetargets/client.go +++ b/resource-manager/storagecache/2023-05-01/storagetargets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StorageTargetsClient struct { Client *resourcemanager.Client } -func NewStorageTargetsClientWithBaseURI(api environments.Api) (*StorageTargetsClient, error) { +func NewStorageTargetsClientWithBaseURI(api sdkEnv.Api) (*StorageTargetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "storagetargets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StorageTargetsClient: %+v", err) diff --git a/resource-manager/storagecache/2023-05-01/usagemodels/client.go b/resource-manager/storagecache/2023-05-01/usagemodels/client.go index 44b379baa2b..985ebdf1dfe 100644 --- a/resource-manager/storagecache/2023-05-01/usagemodels/client.go +++ b/resource-manager/storagecache/2023-05-01/usagemodels/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type UsageModelsClient struct { Client *resourcemanager.Client } -func NewUsageModelsClientWithBaseURI(api environments.Api) (*UsageModelsClient, error) { +func NewUsageModelsClientWithBaseURI(api sdkEnv.Api) (*UsageModelsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "usagemodels", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating UsageModelsClient: %+v", err) diff --git a/resource-manager/storagemover/2023-03-01/agents/client.go b/resource-manager/storagemover/2023-03-01/agents/client.go index 73edd0c7f0c..ae22c24568a 100644 --- a/resource-manager/storagemover/2023-03-01/agents/client.go +++ b/resource-manager/storagemover/2023-03-01/agents/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AgentsClient struct { Client *resourcemanager.Client } -func NewAgentsClientWithBaseURI(api environments.Api) (*AgentsClient, error) { +func NewAgentsClientWithBaseURI(api sdkEnv.Api) (*AgentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "agents", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AgentsClient: %+v", err) diff --git a/resource-manager/storagemover/2023-03-01/client.go b/resource-manager/storagemover/2023-03-01/client.go index 7134e45ba31..f9795ad2866 100644 --- a/resource-manager/storagemover/2023-03-01/client.go +++ b/resource-manager/storagemover/2023-03-01/client.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2023-03-01/projects" "github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2023-03-01/storagemovers" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -25,7 +25,7 @@ type Client struct { StorageMovers *storagemovers.StorageMoversClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { agentsClient, err := agents.NewAgentsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Agents client: %+v", err) diff --git a/resource-manager/storagemover/2023-03-01/endpoints/client.go b/resource-manager/storagemover/2023-03-01/endpoints/client.go index d5d5f478257..7696c3b5ef5 100644 --- a/resource-manager/storagemover/2023-03-01/endpoints/client.go +++ b/resource-manager/storagemover/2023-03-01/endpoints/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EndpointsClient struct { Client *resourcemanager.Client } -func NewEndpointsClientWithBaseURI(api environments.Api) (*EndpointsClient, error) { +func NewEndpointsClientWithBaseURI(api sdkEnv.Api) (*EndpointsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "endpoints", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EndpointsClient: %+v", err) diff --git a/resource-manager/storagemover/2023-03-01/jobdefinitions/client.go b/resource-manager/storagemover/2023-03-01/jobdefinitions/client.go index b9093934f69..61afb8d1888 100644 --- a/resource-manager/storagemover/2023-03-01/jobdefinitions/client.go +++ b/resource-manager/storagemover/2023-03-01/jobdefinitions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobDefinitionsClient struct { Client *resourcemanager.Client } -func NewJobDefinitionsClientWithBaseURI(api environments.Api) (*JobDefinitionsClient, error) { +func NewJobDefinitionsClientWithBaseURI(api sdkEnv.Api) (*JobDefinitionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobdefinitions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobDefinitionsClient: %+v", err) diff --git a/resource-manager/storagemover/2023-03-01/jobruns/client.go b/resource-manager/storagemover/2023-03-01/jobruns/client.go index 2b3237755de..018c82bbb4e 100644 --- a/resource-manager/storagemover/2023-03-01/jobruns/client.go +++ b/resource-manager/storagemover/2023-03-01/jobruns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type JobRunsClient struct { Client *resourcemanager.Client } -func NewJobRunsClientWithBaseURI(api environments.Api) (*JobRunsClient, error) { +func NewJobRunsClientWithBaseURI(api sdkEnv.Api) (*JobRunsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "jobruns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating JobRunsClient: %+v", err) diff --git a/resource-manager/storagemover/2023-03-01/projects/client.go b/resource-manager/storagemover/2023-03-01/projects/client.go index 7ca9b42b2dd..5af75608c3f 100644 --- a/resource-manager/storagemover/2023-03-01/projects/client.go +++ b/resource-manager/storagemover/2023-03-01/projects/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProjectsClient struct { Client *resourcemanager.Client } -func NewProjectsClientWithBaseURI(api environments.Api) (*ProjectsClient, error) { +func NewProjectsClientWithBaseURI(api sdkEnv.Api) (*ProjectsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "projects", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProjectsClient: %+v", err) diff --git a/resource-manager/storagemover/2023-03-01/storagemovers/client.go b/resource-manager/storagemover/2023-03-01/storagemovers/client.go index 3a772ac6eb5..f6f21aaea39 100644 --- a/resource-manager/storagemover/2023-03-01/storagemovers/client.go +++ b/resource-manager/storagemover/2023-03-01/storagemovers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StorageMoversClient struct { Client *resourcemanager.Client } -func NewStorageMoversClientWithBaseURI(api environments.Api) (*StorageMoversClient, error) { +func NewStorageMoversClientWithBaseURI(api sdkEnv.Api) (*StorageMoversClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "storagemovers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StorageMoversClient: %+v", err) diff --git a/resource-manager/storagepool/2021-08-01/client.go b/resource-manager/storagepool/2021-08-01/client.go index 777ca9a1538..1d24e88373a 100644 --- a/resource-manager/storagepool/2021-08-01/client.go +++ b/resource-manager/storagepool/2021-08-01/client.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/storagepool/2021-08-01/iscsitargets" "github.com/hashicorp/go-azure-sdk/resource-manager/storagepool/2021-08-01/resourceskus" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -21,7 +21,7 @@ type Client struct { ResourceSkus *resourceskus.ResourceSkusClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { diskPoolZonesClient, err := diskpoolzones.NewDiskPoolZonesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building DiskPoolZones client: %+v", err) diff --git a/resource-manager/storagepool/2021-08-01/diskpools/client.go b/resource-manager/storagepool/2021-08-01/diskpools/client.go index 77d3dc49046..17d81159ab4 100644 --- a/resource-manager/storagepool/2021-08-01/diskpools/client.go +++ b/resource-manager/storagepool/2021-08-01/diskpools/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DiskPoolsClient struct { Client *resourcemanager.Client } -func NewDiskPoolsClientWithBaseURI(api environments.Api) (*DiskPoolsClient, error) { +func NewDiskPoolsClientWithBaseURI(api sdkEnv.Api) (*DiskPoolsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "diskpools", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DiskPoolsClient: %+v", err) diff --git a/resource-manager/storagepool/2021-08-01/diskpoolzones/client.go b/resource-manager/storagepool/2021-08-01/diskpoolzones/client.go index 8c4cc6596ef..d29ea53f467 100644 --- a/resource-manager/storagepool/2021-08-01/diskpoolzones/client.go +++ b/resource-manager/storagepool/2021-08-01/diskpoolzones/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DiskPoolZonesClient struct { Client *resourcemanager.Client } -func NewDiskPoolZonesClientWithBaseURI(api environments.Api) (*DiskPoolZonesClient, error) { +func NewDiskPoolZonesClientWithBaseURI(api sdkEnv.Api) (*DiskPoolZonesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "diskpoolzones", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DiskPoolZonesClient: %+v", err) diff --git a/resource-manager/storagepool/2021-08-01/iscsitargets/client.go b/resource-manager/storagepool/2021-08-01/iscsitargets/client.go index b3ceee532cb..9bbb7066d1b 100644 --- a/resource-manager/storagepool/2021-08-01/iscsitargets/client.go +++ b/resource-manager/storagepool/2021-08-01/iscsitargets/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type IscsiTargetsClient struct { Client *resourcemanager.Client } -func NewIscsiTargetsClientWithBaseURI(api environments.Api) (*IscsiTargetsClient, error) { +func NewIscsiTargetsClientWithBaseURI(api sdkEnv.Api) (*IscsiTargetsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "iscsitargets", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating IscsiTargetsClient: %+v", err) diff --git a/resource-manager/storagepool/2021-08-01/resourceskus/client.go b/resource-manager/storagepool/2021-08-01/resourceskus/client.go index f0cea40ac1b..c23a83b6b93 100644 --- a/resource-manager/storagepool/2021-08-01/resourceskus/client.go +++ b/resource-manager/storagepool/2021-08-01/resourceskus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResourceSkusClient struct { Client *resourcemanager.Client } -func NewResourceSkusClientWithBaseURI(api environments.Api) (*ResourceSkusClient, error) { +func NewResourceSkusClientWithBaseURI(api sdkEnv.Api) (*ResourceSkusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resourceskus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResourceSkusClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/actions/client.go b/resource-manager/storagesync/2020-03-01/actions/client.go index c310ea7f2bf..05b2db7facd 100644 --- a/resource-manager/storagesync/2020-03-01/actions/client.go +++ b/resource-manager/storagesync/2020-03-01/actions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ActionsClient struct { Client *resourcemanager.Client } -func NewActionsClientWithBaseURI(api environments.Api) (*ActionsClient, error) { +func NewActionsClientWithBaseURI(api sdkEnv.Api) (*ActionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "actions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ActionsClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/backuprestore/client.go b/resource-manager/storagesync/2020-03-01/backuprestore/client.go index a72a5e754bd..baba9d0d3cc 100644 --- a/resource-manager/storagesync/2020-03-01/backuprestore/client.go +++ b/resource-manager/storagesync/2020-03-01/backuprestore/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type BackupRestoreClient struct { Client *resourcemanager.Client } -func NewBackupRestoreClientWithBaseURI(api environments.Api) (*BackupRestoreClient, error) { +func NewBackupRestoreClientWithBaseURI(api sdkEnv.Api) (*BackupRestoreClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "backuprestore", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating BackupRestoreClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/changedetection/client.go b/resource-manager/storagesync/2020-03-01/changedetection/client.go index 5684df3f697..96f1f356e6d 100644 --- a/resource-manager/storagesync/2020-03-01/changedetection/client.go +++ b/resource-manager/storagesync/2020-03-01/changedetection/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ChangeDetectionClient struct { Client *resourcemanager.Client } -func NewChangeDetectionClientWithBaseURI(api environments.Api) (*ChangeDetectionClient, error) { +func NewChangeDetectionClientWithBaseURI(api sdkEnv.Api) (*ChangeDetectionClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "changedetection", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ChangeDetectionClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/client.go b/resource-manager/storagesync/2020-03-01/client.go index 68bbf48cc07..26343923b73 100644 --- a/resource-manager/storagesync/2020-03-01/client.go +++ b/resource-manager/storagesync/2020-03-01/client.go @@ -21,7 +21,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/storagesync/2020-03-01/syncgroupresource" "github.com/hashicorp/go-azure-sdk/resource-manager/storagesync/2020-03-01/workflowresource" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -41,7 +41,7 @@ type Client struct { WorkflowResource *workflowresource.WorkflowResourceClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { actionsClient, err := actions.NewActionsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Actions client: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/cloudendpointresource/client.go b/resource-manager/storagesync/2020-03-01/cloudendpointresource/client.go index 4d87a9e68c1..4d9ed20c01f 100644 --- a/resource-manager/storagesync/2020-03-01/cloudendpointresource/client.go +++ b/resource-manager/storagesync/2020-03-01/cloudendpointresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CloudEndpointResourceClient struct { Client *resourcemanager.Client } -func NewCloudEndpointResourceClientWithBaseURI(api environments.Api) (*CloudEndpointResourceClient, error) { +func NewCloudEndpointResourceClientWithBaseURI(api sdkEnv.Api) (*CloudEndpointResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "cloudendpointresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CloudEndpointResourceClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/operationstatus/client.go b/resource-manager/storagesync/2020-03-01/operationstatus/client.go index 85406b1c245..7bcd4a8928b 100644 --- a/resource-manager/storagesync/2020-03-01/operationstatus/client.go +++ b/resource-manager/storagesync/2020-03-01/operationstatus/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type OperationStatusClient struct { Client *resourcemanager.Client } -func NewOperationStatusClientWithBaseURI(api environments.Api) (*OperationStatusClient, error) { +func NewOperationStatusClientWithBaseURI(api sdkEnv.Api) (*OperationStatusClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "operationstatus", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating OperationStatusClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/privateendpointconnectionresource/client.go b/resource-manager/storagesync/2020-03-01/privateendpointconnectionresource/client.go index 608ace1a847..55461122ece 100644 --- a/resource-manager/storagesync/2020-03-01/privateendpointconnectionresource/client.go +++ b/resource-manager/storagesync/2020-03-01/privateendpointconnectionresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionResourceClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionResourceClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionResourceClient, error) { +func NewPrivateEndpointConnectionResourceClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnectionresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionResourceClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/privateendpointconnections/client.go b/resource-manager/storagesync/2020-03-01/privateendpointconnections/client.go index 05a6653dc59..869f8329c9a 100644 --- a/resource-manager/storagesync/2020-03-01/privateendpointconnections/client.go +++ b/resource-manager/storagesync/2020-03-01/privateendpointconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateEndpointConnectionsClient struct { Client *resourcemanager.Client } -func NewPrivateEndpointConnectionsClientWithBaseURI(api environments.Api) (*PrivateEndpointConnectionsClient, error) { +func NewPrivateEndpointConnectionsClientWithBaseURI(api sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateendpointconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/privatelinkresources/client.go b/resource-manager/storagesync/2020-03-01/privatelinkresources/client.go index d331270c8f6..8ac0d8f1669 100644 --- a/resource-manager/storagesync/2020-03-01/privatelinkresources/client.go +++ b/resource-manager/storagesync/2020-03-01/privatelinkresources/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewPrivateLinkResourcesClientWithBaseURI(api environments.Api) (*PrivateLinkResourcesClient, error) { +func NewPrivateLinkResourcesClientWithBaseURI(api sdkEnv.Api) (*PrivateLinkResourcesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privatelinkresources", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/registeredserverresource/client.go b/resource-manager/storagesync/2020-03-01/registeredserverresource/client.go index 9f0848a1edc..dd0a879ee6b 100644 --- a/resource-manager/storagesync/2020-03-01/registeredserverresource/client.go +++ b/resource-manager/storagesync/2020-03-01/registeredserverresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RegisteredServerResourceClient struct { Client *resourcemanager.Client } -func NewRegisteredServerResourceClientWithBaseURI(api environments.Api) (*RegisteredServerResourceClient, error) { +func NewRegisteredServerResourceClientWithBaseURI(api sdkEnv.Api) (*RegisteredServerResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "registeredserverresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RegisteredServerResourceClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/serverendpointresource/client.go b/resource-manager/storagesync/2020-03-01/serverendpointresource/client.go index 67188d7cf63..f0bfe77b9d9 100644 --- a/resource-manager/storagesync/2020-03-01/serverendpointresource/client.go +++ b/resource-manager/storagesync/2020-03-01/serverendpointresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ServerEndpointResourceClient struct { Client *resourcemanager.Client } -func NewServerEndpointResourceClientWithBaseURI(api environments.Api) (*ServerEndpointResourceClient, error) { +func NewServerEndpointResourceClientWithBaseURI(api sdkEnv.Api) (*ServerEndpointResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "serverendpointresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ServerEndpointResourceClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/storagesyncservice/client.go b/resource-manager/storagesync/2020-03-01/storagesyncservice/client.go index a82cf3d6b01..555032d738c 100644 --- a/resource-manager/storagesync/2020-03-01/storagesyncservice/client.go +++ b/resource-manager/storagesync/2020-03-01/storagesyncservice/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StorageSyncServiceClient struct { Client *resourcemanager.Client } -func NewStorageSyncServiceClientWithBaseURI(api environments.Api) (*StorageSyncServiceClient, error) { +func NewStorageSyncServiceClientWithBaseURI(api sdkEnv.Api) (*StorageSyncServiceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "storagesyncservice", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StorageSyncServiceClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/storagesyncservicesresource/client.go b/resource-manager/storagesync/2020-03-01/storagesyncservicesresource/client.go index 042090b4b7b..4d8f4070082 100644 --- a/resource-manager/storagesync/2020-03-01/storagesyncservicesresource/client.go +++ b/resource-manager/storagesync/2020-03-01/storagesyncservicesresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StorageSyncServicesResourceClient struct { Client *resourcemanager.Client } -func NewStorageSyncServicesResourceClientWithBaseURI(api environments.Api) (*StorageSyncServicesResourceClient, error) { +func NewStorageSyncServicesResourceClientWithBaseURI(api sdkEnv.Api) (*StorageSyncServicesResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "storagesyncservicesresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StorageSyncServicesResourceClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/syncgroupresource/client.go b/resource-manager/storagesync/2020-03-01/syncgroupresource/client.go index bea2c78fc52..e61455ab6c2 100644 --- a/resource-manager/storagesync/2020-03-01/syncgroupresource/client.go +++ b/resource-manager/storagesync/2020-03-01/syncgroupresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SyncGroupResourceClient struct { Client *resourcemanager.Client } -func NewSyncGroupResourceClientWithBaseURI(api environments.Api) (*SyncGroupResourceClient, error) { +func NewSyncGroupResourceClientWithBaseURI(api sdkEnv.Api) (*SyncGroupResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "syncgroupresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SyncGroupResourceClient: %+v", err) diff --git a/resource-manager/storagesync/2020-03-01/workflowresource/client.go b/resource-manager/storagesync/2020-03-01/workflowresource/client.go index 070f378bcf3..0cc8593de1b 100644 --- a/resource-manager/storagesync/2020-03-01/workflowresource/client.go +++ b/resource-manager/storagesync/2020-03-01/workflowresource/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowResourceClient struct { Client *resourcemanager.Client } -func NewWorkflowResourceClientWithBaseURI(api environments.Api) (*WorkflowResourceClient, error) { +func NewWorkflowResourceClientWithBaseURI(api sdkEnv.Api) (*WorkflowResourceClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowresource", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowResourceClient: %+v", err) diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/client.go b/resource-manager/videoanalyzer/2021-05-01-preview/client.go index b3240da90f8..103ba17b2fe 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/client.go +++ b/resource-manager/videoanalyzer/2021-05-01-preview/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers" "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videos" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { Videos *videos.VideosClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { edgeModulesClient, err := edgemodules.NewEdgeModulesClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building EdgeModules client: %+v", err) diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/client.go b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/client.go index a4d439ed088..83ffe79b86f 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/client.go +++ b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type EdgeModulesClient struct { Client *resourcemanager.Client } -func NewEdgeModulesClientWithBaseURI(api environments.Api) (*EdgeModulesClient, error) { +func NewEdgeModulesClientWithBaseURI(api sdkEnv.Api) (*EdgeModulesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "edgemodules", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating EdgeModulesClient: %+v", err) diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/client.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/client.go index f959f4feecf..8981dcde4ff 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/client.go +++ b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VideoAnalyzersClient struct { Client *resourcemanager.Client } -func NewVideoAnalyzersClientWithBaseURI(api environments.Api) (*VideoAnalyzersClient, error) { +func NewVideoAnalyzersClientWithBaseURI(api sdkEnv.Api) (*VideoAnalyzersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "videoanalyzers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VideoAnalyzersClient: %+v", err) diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/client.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/client.go index 1c0dc618285..76423153aef 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/client.go +++ b/resource-manager/videoanalyzer/2021-05-01-preview/videos/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VideosClient struct { Client *resourcemanager.Client } -func NewVideosClientWithBaseURI(api environments.Api) (*VideosClient, error) { +func NewVideosClientWithBaseURI(api sdkEnv.Api) (*VideosClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "videos", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VideosClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/addons/client.go b/resource-manager/vmware/2022-05-01/addons/client.go index 5e76a060858..06469fc3c99 100644 --- a/resource-manager/vmware/2022-05-01/addons/client.go +++ b/resource-manager/vmware/2022-05-01/addons/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AddonsClient struct { Client *resourcemanager.Client } -func NewAddonsClientWithBaseURI(api environments.Api) (*AddonsClient, error) { +func NewAddonsClientWithBaseURI(api sdkEnv.Api) (*AddonsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "addons", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AddonsClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/authorizations/client.go b/resource-manager/vmware/2022-05-01/authorizations/client.go index 20162719da1..09a531c90aa 100644 --- a/resource-manager/vmware/2022-05-01/authorizations/client.go +++ b/resource-manager/vmware/2022-05-01/authorizations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AuthorizationsClient struct { Client *resourcemanager.Client } -func NewAuthorizationsClientWithBaseURI(api environments.Api) (*AuthorizationsClient, error) { +func NewAuthorizationsClientWithBaseURI(api sdkEnv.Api) (*AuthorizationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "authorizations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AuthorizationsClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/client.go b/resource-manager/vmware/2022-05-01/client.go index 454b4e2be3e..ecaad486f2b 100644 --- a/resource-manager/vmware/2022-05-01/client.go +++ b/resource-manager/vmware/2022-05-01/client.go @@ -22,7 +22,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2022-05-01/workloadnetworks" "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2022-05-01/zone" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -43,7 +43,7 @@ type Client struct { Zone *zone.ZoneClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { addonsClient, err := addons.NewAddonsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Addons client: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/cloudlinks/client.go b/resource-manager/vmware/2022-05-01/cloudlinks/client.go index 13d1147363c..960e646f936 100644 --- a/resource-manager/vmware/2022-05-01/cloudlinks/client.go +++ b/resource-manager/vmware/2022-05-01/cloudlinks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CloudLinksClient struct { Client *resourcemanager.Client } -func NewCloudLinksClientWithBaseURI(api environments.Api) (*CloudLinksClient, error) { +func NewCloudLinksClientWithBaseURI(api sdkEnv.Api) (*CloudLinksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "cloudlinks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CloudLinksClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/cluster/client.go b/resource-manager/vmware/2022-05-01/cluster/client.go index 36f5883038e..9b5b4610fb4 100644 --- a/resource-manager/vmware/2022-05-01/cluster/client.go +++ b/resource-manager/vmware/2022-05-01/cluster/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ClusterClient struct { Client *resourcemanager.Client } -func NewClusterClientWithBaseURI(api environments.Api) (*ClusterClient, error) { +func NewClusterClientWithBaseURI(api sdkEnv.Api) (*ClusterClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "cluster", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ClusterClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/clusters/client.go b/resource-manager/vmware/2022-05-01/clusters/client.go index d6411c267f7..41e352f752c 100644 --- a/resource-manager/vmware/2022-05-01/clusters/client.go +++ b/resource-manager/vmware/2022-05-01/clusters/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ClustersClient struct { Client *resourcemanager.Client } -func NewClustersClientWithBaseURI(api environments.Api) (*ClustersClient, error) { +func NewClustersClientWithBaseURI(api sdkEnv.Api) (*ClustersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "clusters", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ClustersClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/datastores/client.go b/resource-manager/vmware/2022-05-01/datastores/client.go index 2a1c3f50a52..b0db0e5167c 100644 --- a/resource-manager/vmware/2022-05-01/datastores/client.go +++ b/resource-manager/vmware/2022-05-01/datastores/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DataStoresClient struct { Client *resourcemanager.Client } -func NewDataStoresClientWithBaseURI(api environments.Api) (*DataStoresClient, error) { +func NewDataStoresClientWithBaseURI(api sdkEnv.Api) (*DataStoresClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "datastores", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DataStoresClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/globalreachconnections/client.go b/resource-manager/vmware/2022-05-01/globalreachconnections/client.go index 30f3549fbb3..b270070d1be 100644 --- a/resource-manager/vmware/2022-05-01/globalreachconnections/client.go +++ b/resource-manager/vmware/2022-05-01/globalreachconnections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GlobalReachConnectionsClient struct { Client *resourcemanager.Client } -func NewGlobalReachConnectionsClientWithBaseURI(api environments.Api) (*GlobalReachConnectionsClient, error) { +func NewGlobalReachConnectionsClientWithBaseURI(api sdkEnv.Api) (*GlobalReachConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "globalreachconnections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GlobalReachConnectionsClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/hcxenterprisesites/client.go b/resource-manager/vmware/2022-05-01/hcxenterprisesites/client.go index ab0ec175cea..902bb75ed08 100644 --- a/resource-manager/vmware/2022-05-01/hcxenterprisesites/client.go +++ b/resource-manager/vmware/2022-05-01/hcxenterprisesites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type HcxEnterpriseSitesClient struct { Client *resourcemanager.Client } -func NewHcxEnterpriseSitesClientWithBaseURI(api environments.Api) (*HcxEnterpriseSitesClient, error) { +func NewHcxEnterpriseSitesClientWithBaseURI(api sdkEnv.Api) (*HcxEnterpriseSitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "hcxenterprisesites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating HcxEnterpriseSitesClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/locations/client.go b/resource-manager/vmware/2022-05-01/locations/client.go index 2317188109e..459b4dc0dc4 100644 --- a/resource-manager/vmware/2022-05-01/locations/client.go +++ b/resource-manager/vmware/2022-05-01/locations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type LocationsClient struct { Client *resourcemanager.Client } -func NewLocationsClientWithBaseURI(api environments.Api) (*LocationsClient, error) { +func NewLocationsClientWithBaseURI(api sdkEnv.Api) (*LocationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "locations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating LocationsClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/placementpolicies/client.go b/resource-manager/vmware/2022-05-01/placementpolicies/client.go index 928140d00fa..5d8fab9a98a 100644 --- a/resource-manager/vmware/2022-05-01/placementpolicies/client.go +++ b/resource-manager/vmware/2022-05-01/placementpolicies/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PlacementPoliciesClient struct { Client *resourcemanager.Client } -func NewPlacementPoliciesClientWithBaseURI(api environments.Api) (*PlacementPoliciesClient, error) { +func NewPlacementPoliciesClientWithBaseURI(api sdkEnv.Api) (*PlacementPoliciesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "placementpolicies", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PlacementPoliciesClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/privateclouds/client.go b/resource-manager/vmware/2022-05-01/privateclouds/client.go index 0a266d2dc8b..37be8e5cc5b 100644 --- a/resource-manager/vmware/2022-05-01/privateclouds/client.go +++ b/resource-manager/vmware/2022-05-01/privateclouds/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type PrivateCloudsClient struct { Client *resourcemanager.Client } -func NewPrivateCloudsClientWithBaseURI(api environments.Api) (*PrivateCloudsClient, error) { +func NewPrivateCloudsClientWithBaseURI(api sdkEnv.Api) (*PrivateCloudsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "privateclouds", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating PrivateCloudsClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/scripts/client.go b/resource-manager/vmware/2022-05-01/scripts/client.go index e30d4cdb390..f4aadf3cf6c 100644 --- a/resource-manager/vmware/2022-05-01/scripts/client.go +++ b/resource-manager/vmware/2022-05-01/scripts/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ScriptsClient struct { Client *resourcemanager.Client } -func NewScriptsClientWithBaseURI(api environments.Api) (*ScriptsClient, error) { +func NewScriptsClientWithBaseURI(api sdkEnv.Api) (*ScriptsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "scripts", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ScriptsClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/virtualmachines/client.go b/resource-manager/vmware/2022-05-01/virtualmachines/client.go index ddde210da17..d9b2555ade0 100644 --- a/resource-manager/vmware/2022-05-01/virtualmachines/client.go +++ b/resource-manager/vmware/2022-05-01/virtualmachines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VirtualMachinesClient struct { Client *resourcemanager.Client } -func NewVirtualMachinesClientWithBaseURI(api environments.Api) (*VirtualMachinesClient, error) { +func NewVirtualMachinesClientWithBaseURI(api sdkEnv.Api) (*VirtualMachinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "virtualmachines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VirtualMachinesClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/workloadnetworks/client.go b/resource-manager/vmware/2022-05-01/workloadnetworks/client.go index 8eab5757577..36c1b7a31fa 100644 --- a/resource-manager/vmware/2022-05-01/workloadnetworks/client.go +++ b/resource-manager/vmware/2022-05-01/workloadnetworks/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkloadNetworksClient struct { Client *resourcemanager.Client } -func NewWorkloadNetworksClientWithBaseURI(api environments.Api) (*WorkloadNetworksClient, error) { +func NewWorkloadNetworksClientWithBaseURI(api sdkEnv.Api) (*WorkloadNetworksClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workloadnetworks", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkloadNetworksClient: %+v", err) diff --git a/resource-manager/vmware/2022-05-01/zone/client.go b/resource-manager/vmware/2022-05-01/zone/client.go index 7bd01420c7a..931ef7e29ca 100644 --- a/resource-manager/vmware/2022-05-01/zone/client.go +++ b/resource-manager/vmware/2022-05-01/zone/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ZoneClient struct { Client *resourcemanager.Client } -func NewZoneClientWithBaseURI(api environments.Api) (*ZoneClient, error) { +func NewZoneClientWithBaseURI(api sdkEnv.Api) (*ZoneClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "zone", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ZoneClient: %+v", err) diff --git a/resource-manager/voiceservices/2023-04-03/client.go b/resource-manager/voiceservices/2023-04-03/client.go index fa466767e7b..ef068230b04 100644 --- a/resource-manager/voiceservices/2023-04-03/client.go +++ b/resource-manager/voiceservices/2023-04-03/client.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/voiceservices/2023-04-03/testlines" "github.com/hashicorp/go-azure-sdk/resource-manager/voiceservices/2023-04-03/voiceservices" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -19,7 +19,7 @@ type Client struct { Voiceservices *voiceservices.VoiceservicesClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { communicationsGatewaysClient, err := communicationsgateways.NewCommunicationsGatewaysClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building CommunicationsGateways client: %+v", err) diff --git a/resource-manager/voiceservices/2023-04-03/communicationsgateways/client.go b/resource-manager/voiceservices/2023-04-03/communicationsgateways/client.go index 65d2718f44b..fc2162d2b98 100644 --- a/resource-manager/voiceservices/2023-04-03/communicationsgateways/client.go +++ b/resource-manager/voiceservices/2023-04-03/communicationsgateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CommunicationsGatewaysClient struct { Client *resourcemanager.Client } -func NewCommunicationsGatewaysClientWithBaseURI(api environments.Api) (*CommunicationsGatewaysClient, error) { +func NewCommunicationsGatewaysClientWithBaseURI(api sdkEnv.Api) (*CommunicationsGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "communicationsgateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CommunicationsGatewaysClient: %+v", err) diff --git a/resource-manager/voiceservices/2023-04-03/testlines/client.go b/resource-manager/voiceservices/2023-04-03/testlines/client.go index 6a89a99971f..80cae6ba64e 100644 --- a/resource-manager/voiceservices/2023-04-03/testlines/client.go +++ b/resource-manager/voiceservices/2023-04-03/testlines/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TestLinesClient struct { Client *resourcemanager.Client } -func NewTestLinesClientWithBaseURI(api environments.Api) (*TestLinesClient, error) { +func NewTestLinesClientWithBaseURI(api sdkEnv.Api) (*TestLinesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "testlines", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TestLinesClient: %+v", err) diff --git a/resource-manager/voiceservices/2023-04-03/voiceservices/client.go b/resource-manager/voiceservices/2023-04-03/voiceservices/client.go index 16dc5b2efd9..140f52979a0 100644 --- a/resource-manager/voiceservices/2023-04-03/voiceservices/client.go +++ b/resource-manager/voiceservices/2023-04-03/voiceservices/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type VoiceservicesClient struct { Client *resourcemanager.Client } -func NewVoiceservicesClientWithBaseURI(api environments.Api) (*VoiceservicesClient, error) { +func NewVoiceservicesClientWithBaseURI(api sdkEnv.Api) (*VoiceservicesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "voiceservices", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating VoiceservicesClient: %+v", err) diff --git a/resource-manager/web/2016-06-01/client.go b/resource-manager/web/2016-06-01/client.go index 27cd5338d38..153d31a762c 100644 --- a/resource-manager/web/2016-06-01/client.go +++ b/resource-manager/web/2016-06-01/client.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/customapis" "github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -21,7 +21,7 @@ type Client struct { ManagedAPIs *managedapis.ManagedAPIsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { connectionGatewaysClient, err := connectiongateways.NewConnectionGatewaysClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building ConnectionGateways client: %+v", err) diff --git a/resource-manager/web/2016-06-01/connectiongateways/client.go b/resource-manager/web/2016-06-01/connectiongateways/client.go index b05d99ac7e2..ef8c14817a6 100644 --- a/resource-manager/web/2016-06-01/connectiongateways/client.go +++ b/resource-manager/web/2016-06-01/connectiongateways/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConnectionGatewaysClient struct { Client *resourcemanager.Client } -func NewConnectionGatewaysClientWithBaseURI(api environments.Api) (*ConnectionGatewaysClient, error) { +func NewConnectionGatewaysClientWithBaseURI(api sdkEnv.Api) (*ConnectionGatewaysClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "connectiongateways", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConnectionGatewaysClient: %+v", err) diff --git a/resource-manager/web/2016-06-01/connections/client.go b/resource-manager/web/2016-06-01/connections/client.go index 896f2b69be8..042d13f792d 100644 --- a/resource-manager/web/2016-06-01/connections/client.go +++ b/resource-manager/web/2016-06-01/connections/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ConnectionsClient struct { Client *resourcemanager.Client } -func NewConnectionsClientWithBaseURI(api environments.Api) (*ConnectionsClient, error) { +func NewConnectionsClientWithBaseURI(api sdkEnv.Api) (*ConnectionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "connections", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ConnectionsClient: %+v", err) diff --git a/resource-manager/web/2016-06-01/customapis/client.go b/resource-manager/web/2016-06-01/customapis/client.go index d0af98f2c5a..8fef04b2bb9 100644 --- a/resource-manager/web/2016-06-01/customapis/client.go +++ b/resource-manager/web/2016-06-01/customapis/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CustomAPIsClient struct { Client *resourcemanager.Client } -func NewCustomAPIsClientWithBaseURI(api environments.Api) (*CustomAPIsClient, error) { +func NewCustomAPIsClientWithBaseURI(api sdkEnv.Api) (*CustomAPIsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "customapis", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CustomAPIsClient: %+v", err) diff --git a/resource-manager/web/2016-06-01/managedapis/client.go b/resource-manager/web/2016-06-01/managedapis/client.go index 2b5aa451355..a592128418f 100644 --- a/resource-manager/web/2016-06-01/managedapis/client.go +++ b/resource-manager/web/2016-06-01/managedapis/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ManagedAPIsClient struct { Client *resourcemanager.Client } -func NewManagedAPIsClientWithBaseURI(api environments.Api) (*ManagedAPIsClient, error) { +func NewManagedAPIsClientWithBaseURI(api sdkEnv.Api) (*ManagedAPIsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "managedapis", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ManagedAPIsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/appservicecertificateorders/client.go b/resource-manager/web/2022-09-01/appservicecertificateorders/client.go index a4d14f586ba..c385b24fdc3 100644 --- a/resource-manager/web/2022-09-01/appservicecertificateorders/client.go +++ b/resource-manager/web/2022-09-01/appservicecertificateorders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AppServiceCertificateOrdersClient struct { Client *resourcemanager.Client } -func NewAppServiceCertificateOrdersClientWithBaseURI(api environments.Api) (*AppServiceCertificateOrdersClient, error) { +func NewAppServiceCertificateOrdersClientWithBaseURI(api sdkEnv.Api) (*AppServiceCertificateOrdersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "appservicecertificateorders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AppServiceCertificateOrdersClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/appserviceenvironments/client.go b/resource-manager/web/2022-09-01/appserviceenvironments/client.go index b4293f8c768..e9df59e2581 100644 --- a/resource-manager/web/2022-09-01/appserviceenvironments/client.go +++ b/resource-manager/web/2022-09-01/appserviceenvironments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AppServiceEnvironmentsClient struct { Client *resourcemanager.Client } -func NewAppServiceEnvironmentsClientWithBaseURI(api environments.Api) (*AppServiceEnvironmentsClient, error) { +func NewAppServiceEnvironmentsClientWithBaseURI(api sdkEnv.Api) (*AppServiceEnvironmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "appserviceenvironments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AppServiceEnvironmentsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/appserviceplans/client.go b/resource-manager/web/2022-09-01/appserviceplans/client.go index 16725b30193..8b4a24996da 100644 --- a/resource-manager/web/2022-09-01/appserviceplans/client.go +++ b/resource-manager/web/2022-09-01/appserviceplans/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type AppServicePlansClient struct { Client *resourcemanager.Client } -func NewAppServicePlansClientWithBaseURI(api environments.Api) (*AppServicePlansClient, error) { +func NewAppServicePlansClientWithBaseURI(api sdkEnv.Api) (*AppServicePlansClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "appserviceplans", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating AppServicePlansClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/certificateordersdiagnostics/client.go b/resource-manager/web/2022-09-01/certificateordersdiagnostics/client.go index d4b2b27b862..a19391f6643 100644 --- a/resource-manager/web/2022-09-01/certificateordersdiagnostics/client.go +++ b/resource-manager/web/2022-09-01/certificateordersdiagnostics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CertificateOrdersDiagnosticsClient struct { Client *resourcemanager.Client } -func NewCertificateOrdersDiagnosticsClientWithBaseURI(api environments.Api) (*CertificateOrdersDiagnosticsClient, error) { +func NewCertificateOrdersDiagnosticsClientWithBaseURI(api sdkEnv.Api) (*CertificateOrdersDiagnosticsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "certificateordersdiagnostics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CertificateOrdersDiagnosticsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/certificates/client.go b/resource-manager/web/2022-09-01/certificates/client.go index 1df2d72c23a..6fe0f5ff95c 100644 --- a/resource-manager/web/2022-09-01/certificates/client.go +++ b/resource-manager/web/2022-09-01/certificates/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type CertificatesClient struct { Client *resourcemanager.Client } -func NewCertificatesClientWithBaseURI(api environments.Api) (*CertificatesClient, error) { +func NewCertificatesClientWithBaseURI(api sdkEnv.Api) (*CertificatesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "certificates", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating CertificatesClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/client.go b/resource-manager/web/2022-09-01/client.go index 7116db91bcd..df1227efbc3 100644 --- a/resource-manager/web/2022-09-01/client.go +++ b/resource-manager/web/2022-09-01/client.go @@ -32,7 +32,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/web/2022-09-01/workflowtriggers" "github.com/hashicorp/go-azure-sdk/resource-manager/web/2022-09-01/workflowversions" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -63,7 +63,7 @@ type Client struct { Workflows *workflows.WorkflowsClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { appServiceCertificateOrdersClient, err := appservicecertificateorders.NewAppServiceCertificateOrdersClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building AppServiceCertificateOrders client: %+v", err) diff --git a/resource-manager/web/2022-09-01/containerapps/client.go b/resource-manager/web/2022-09-01/containerapps/client.go index e416f85d501..13b5068332e 100644 --- a/resource-manager/web/2022-09-01/containerapps/client.go +++ b/resource-manager/web/2022-09-01/containerapps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ContainerAppsClient struct { Client *resourcemanager.Client } -func NewContainerAppsClientWithBaseURI(api environments.Api) (*ContainerAppsClient, error) { +func NewContainerAppsClientWithBaseURI(api sdkEnv.Api) (*ContainerAppsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "containerapps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ContainerAppsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/containerappsrevisions/client.go b/resource-manager/web/2022-09-01/containerappsrevisions/client.go index 4dded455868..1b43e3d304a 100644 --- a/resource-manager/web/2022-09-01/containerappsrevisions/client.go +++ b/resource-manager/web/2022-09-01/containerappsrevisions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ContainerAppsRevisionsClient struct { Client *resourcemanager.Client } -func NewContainerAppsRevisionsClientWithBaseURI(api environments.Api) (*ContainerAppsRevisionsClient, error) { +func NewContainerAppsRevisionsClientWithBaseURI(api sdkEnv.Api) (*ContainerAppsRevisionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "containerappsrevisions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ContainerAppsRevisionsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/deletedwebapps/client.go b/resource-manager/web/2022-09-01/deletedwebapps/client.go index 4385e47f870..fd12ae89cf1 100644 --- a/resource-manager/web/2022-09-01/deletedwebapps/client.go +++ b/resource-manager/web/2022-09-01/deletedwebapps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DeletedWebAppsClient struct { Client *resourcemanager.Client } -func NewDeletedWebAppsClientWithBaseURI(api environments.Api) (*DeletedWebAppsClient, error) { +func NewDeletedWebAppsClientWithBaseURI(api sdkEnv.Api) (*DeletedWebAppsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "deletedwebapps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DeletedWebAppsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/diagnostics/client.go b/resource-manager/web/2022-09-01/diagnostics/client.go index 2a59b0cb111..80c2f119dae 100644 --- a/resource-manager/web/2022-09-01/diagnostics/client.go +++ b/resource-manager/web/2022-09-01/diagnostics/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DiagnosticsClient struct { Client *resourcemanager.Client } -func NewDiagnosticsClientWithBaseURI(api environments.Api) (*DiagnosticsClient, error) { +func NewDiagnosticsClientWithBaseURI(api sdkEnv.Api) (*DiagnosticsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "diagnostics", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DiagnosticsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/domains/client.go b/resource-manager/web/2022-09-01/domains/client.go index 4816b188ae1..35bdff62532 100644 --- a/resource-manager/web/2022-09-01/domains/client.go +++ b/resource-manager/web/2022-09-01/domains/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type DomainsClient struct { Client *resourcemanager.Client } -func NewDomainsClientWithBaseURI(api environments.Api) (*DomainsClient, error) { +func NewDomainsClientWithBaseURI(api sdkEnv.Api) (*DomainsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "domains", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating DomainsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/global/client.go b/resource-manager/web/2022-09-01/global/client.go index 54e6697df83..ca825cea84a 100644 --- a/resource-manager/web/2022-09-01/global/client.go +++ b/resource-manager/web/2022-09-01/global/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type GlobalClient struct { Client *resourcemanager.Client } -func NewGlobalClientWithBaseURI(api environments.Api) (*GlobalClient, error) { +func NewGlobalClientWithBaseURI(api sdkEnv.Api) (*GlobalClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "global", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating GlobalClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/kubeenvironments/client.go b/resource-manager/web/2022-09-01/kubeenvironments/client.go index 271b96b5d26..6113f2c6d16 100644 --- a/resource-manager/web/2022-09-01/kubeenvironments/client.go +++ b/resource-manager/web/2022-09-01/kubeenvironments/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type KubeEnvironmentsClient struct { Client *resourcemanager.Client } -func NewKubeEnvironmentsClientWithBaseURI(api environments.Api) (*KubeEnvironmentsClient, error) { +func NewKubeEnvironmentsClientWithBaseURI(api sdkEnv.Api) (*KubeEnvironmentsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "kubeenvironments", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating KubeEnvironmentsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/provider/client.go b/resource-manager/web/2022-09-01/provider/client.go index d4c5b5c24aa..1a2acfd5b12 100644 --- a/resource-manager/web/2022-09-01/provider/client.go +++ b/resource-manager/web/2022-09-01/provider/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProviderClient struct { Client *resourcemanager.Client } -func NewProviderClientWithBaseURI(api environments.Api) (*ProviderClient, error) { +func NewProviderClientWithBaseURI(api sdkEnv.Api) (*ProviderClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "provider", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProviderClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/recommendations/client.go b/resource-manager/web/2022-09-01/recommendations/client.go index 7195d64b891..914ee04698a 100644 --- a/resource-manager/web/2022-09-01/recommendations/client.go +++ b/resource-manager/web/2022-09-01/recommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type RecommendationsClient struct { Client *resourcemanager.Client } -func NewRecommendationsClientWithBaseURI(api environments.Api) (*RecommendationsClient, error) { +func NewRecommendationsClientWithBaseURI(api sdkEnv.Api) (*RecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "recommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating RecommendationsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/resourcehealthmetadata/client.go b/resource-manager/web/2022-09-01/resourcehealthmetadata/client.go index 5fe8598fab7..ea04116d915 100644 --- a/resource-manager/web/2022-09-01/resourcehealthmetadata/client.go +++ b/resource-manager/web/2022-09-01/resourcehealthmetadata/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResourceHealthMetadataClient struct { Client *resourcemanager.Client } -func NewResourceHealthMetadataClientWithBaseURI(api environments.Api) (*ResourceHealthMetadataClient, error) { +func NewResourceHealthMetadataClientWithBaseURI(api sdkEnv.Api) (*ResourceHealthMetadataClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resourcehealthmetadata", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResourceHealthMetadataClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/resourceproviders/client.go b/resource-manager/web/2022-09-01/resourceproviders/client.go index bf4b3ad2627..6da5ce327e9 100644 --- a/resource-manager/web/2022-09-01/resourceproviders/client.go +++ b/resource-manager/web/2022-09-01/resourceproviders/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ResourceProvidersClient struct { Client *resourcemanager.Client } -func NewResourceProvidersClientWithBaseURI(api environments.Api) (*ResourceProvidersClient, error) { +func NewResourceProvidersClientWithBaseURI(api sdkEnv.Api) (*ResourceProvidersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "resourceproviders", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ResourceProvidersClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/staticsites/client.go b/resource-manager/web/2022-09-01/staticsites/client.go index 41a9a3d6d83..e6d96846148 100644 --- a/resource-manager/web/2022-09-01/staticsites/client.go +++ b/resource-manager/web/2022-09-01/staticsites/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type StaticSitesClient struct { Client *resourcemanager.Client } -func NewStaticSitesClientWithBaseURI(api environments.Api) (*StaticSitesClient, error) { +func NewStaticSitesClientWithBaseURI(api sdkEnv.Api) (*StaticSitesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "staticsites", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating StaticSitesClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/topleveldomains/client.go b/resource-manager/web/2022-09-01/topleveldomains/client.go index f5f3c86c992..4b2615c5588 100644 --- a/resource-manager/web/2022-09-01/topleveldomains/client.go +++ b/resource-manager/web/2022-09-01/topleveldomains/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type TopLevelDomainsClient struct { Client *resourcemanager.Client } -func NewTopLevelDomainsClientWithBaseURI(api environments.Api) (*TopLevelDomainsClient, error) { +func NewTopLevelDomainsClientWithBaseURI(api sdkEnv.Api) (*TopLevelDomainsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "topleveldomains", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating TopLevelDomainsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/webapps/client.go b/resource-manager/web/2022-09-01/webapps/client.go index ff15559f091..80b83cc8297 100644 --- a/resource-manager/web/2022-09-01/webapps/client.go +++ b/resource-manager/web/2022-09-01/webapps/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WebAppsClient struct { Client *resourcemanager.Client } -func NewWebAppsClientWithBaseURI(api environments.Api) (*WebAppsClient, error) { +func NewWebAppsClientWithBaseURI(api sdkEnv.Api) (*WebAppsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "webapps", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WebAppsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/workflowrunactions/client.go b/resource-manager/web/2022-09-01/workflowrunactions/client.go index b831f4e826e..499879042af 100644 --- a/resource-manager/web/2022-09-01/workflowrunactions/client.go +++ b/resource-manager/web/2022-09-01/workflowrunactions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowRunActionsClient struct { Client *resourcemanager.Client } -func NewWorkflowRunActionsClientWithBaseURI(api environments.Api) (*WorkflowRunActionsClient, error) { +func NewWorkflowRunActionsClientWithBaseURI(api sdkEnv.Api) (*WorkflowRunActionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowrunactions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowRunActionsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/workflowruns/client.go b/resource-manager/web/2022-09-01/workflowruns/client.go index 43b565b2cd6..92e78dac372 100644 --- a/resource-manager/web/2022-09-01/workflowruns/client.go +++ b/resource-manager/web/2022-09-01/workflowruns/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowRunsClient struct { Client *resourcemanager.Client } -func NewWorkflowRunsClientWithBaseURI(api environments.Api) (*WorkflowRunsClient, error) { +func NewWorkflowRunsClientWithBaseURI(api sdkEnv.Api) (*WorkflowRunsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowruns", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowRunsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/workflows/client.go b/resource-manager/web/2022-09-01/workflows/client.go index b86cd23219c..90fe462cb29 100644 --- a/resource-manager/web/2022-09-01/workflows/client.go +++ b/resource-manager/web/2022-09-01/workflows/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowsClient struct { Client *resourcemanager.Client } -func NewWorkflowsClientWithBaseURI(api environments.Api) (*WorkflowsClient, error) { +func NewWorkflowsClientWithBaseURI(api sdkEnv.Api) (*WorkflowsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflows", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowsClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/workflowtriggerhistories/client.go b/resource-manager/web/2022-09-01/workflowtriggerhistories/client.go index 2616be06d78..8cf7ef3f4a1 100644 --- a/resource-manager/web/2022-09-01/workflowtriggerhistories/client.go +++ b/resource-manager/web/2022-09-01/workflowtriggerhistories/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowTriggerHistoriesClient struct { Client *resourcemanager.Client } -func NewWorkflowTriggerHistoriesClientWithBaseURI(api environments.Api) (*WorkflowTriggerHistoriesClient, error) { +func NewWorkflowTriggerHistoriesClientWithBaseURI(api sdkEnv.Api) (*WorkflowTriggerHistoriesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowtriggerhistories", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowTriggerHistoriesClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/workflowtriggers/client.go b/resource-manager/web/2022-09-01/workflowtriggers/client.go index b3c445df3bd..6cbb113de0c 100644 --- a/resource-manager/web/2022-09-01/workflowtriggers/client.go +++ b/resource-manager/web/2022-09-01/workflowtriggers/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowTriggersClient struct { Client *resourcemanager.Client } -func NewWorkflowTriggersClientWithBaseURI(api environments.Api) (*WorkflowTriggersClient, error) { +func NewWorkflowTriggersClientWithBaseURI(api sdkEnv.Api) (*WorkflowTriggersClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowtriggers", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowTriggersClient: %+v", err) diff --git a/resource-manager/web/2022-09-01/workflowversions/client.go b/resource-manager/web/2022-09-01/workflowversions/client.go index 1e35b4c3284..9eb461a2018 100644 --- a/resource-manager/web/2022-09-01/workflowversions/client.go +++ b/resource-manager/web/2022-09-01/workflowversions/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type WorkflowVersionsClient struct { Client *resourcemanager.Client } -func NewWorkflowVersionsClientWithBaseURI(api environments.Api) (*WorkflowVersionsClient, error) { +func NewWorkflowVersionsClientWithBaseURI(api sdkEnv.Api) (*WorkflowVersionsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "workflowversions", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating WorkflowVersionsClient: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/client.go b/resource-manager/workloads/2023-04-01/client.go index 27f16f736ee..dda80695647 100644 --- a/resource-manager/workloads/2023-04-01/client.go +++ b/resource-manager/workloads/2023-04-01/client.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku" "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) type Client struct { @@ -35,7 +35,7 @@ type Client struct { SapLandscapeMonitor *saplandscapemonitor.SapLandscapeMonitorClient } -func NewClientWithBaseURI(api environments.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { +func NewClientWithBaseURI(api sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { monitorsClient, err := monitors.NewMonitorsClientWithBaseURI(api) if err != nil { return nil, fmt.Errorf("building Monitors client: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/monitors/client.go b/resource-manager/workloads/2023-04-01/monitors/client.go index 43af4ffbb85..f7c2a7b5509 100644 --- a/resource-manager/workloads/2023-04-01/monitors/client.go +++ b/resource-manager/workloads/2023-04-01/monitors/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type MonitorsClient struct { Client *resourcemanager.Client } -func NewMonitorsClientWithBaseURI(api environments.Api) (*MonitorsClient, error) { +func NewMonitorsClientWithBaseURI(api sdkEnv.Api) (*MonitorsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "monitors", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating MonitorsClient: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/providerinstances/client.go b/resource-manager/workloads/2023-04-01/providerinstances/client.go index 495443a9886..5e9d94ec8e7 100644 --- a/resource-manager/workloads/2023-04-01/providerinstances/client.go +++ b/resource-manager/workloads/2023-04-01/providerinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type ProviderInstancesClient struct { Client *resourcemanager.Client } -func NewProviderInstancesClientWithBaseURI(api environments.Api) (*ProviderInstancesClient, error) { +func NewProviderInstancesClientWithBaseURI(api sdkEnv.Api) (*ProviderInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "providerinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating ProviderInstancesClient: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/client.go b/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/client.go index 53f33039079..462dedb1beb 100644 --- a/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/client.go +++ b/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SAPApplicationServerInstancesClient struct { Client *resourcemanager.Client } -func NewSAPApplicationServerInstancesClientWithBaseURI(api environments.Api) (*SAPApplicationServerInstancesClient, error) { +func NewSAPApplicationServerInstancesClientWithBaseURI(api sdkEnv.Api) (*SAPApplicationServerInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sapapplicationserverinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SAPApplicationServerInstancesClient: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/client.go b/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/client.go index 845933febba..8f7c8fafca1 100644 --- a/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/client.go +++ b/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SAPAvailabilityZoneDetailsClient struct { Client *resourcemanager.Client } -func NewSAPAvailabilityZoneDetailsClientWithBaseURI(api environments.Api) (*SAPAvailabilityZoneDetailsClient, error) { +func NewSAPAvailabilityZoneDetailsClientWithBaseURI(api sdkEnv.Api) (*SAPAvailabilityZoneDetailsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sapavailabilityzonedetails", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SAPAvailabilityZoneDetailsClient: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/sapcentralinstances/client.go b/resource-manager/workloads/2023-04-01/sapcentralinstances/client.go index 78545754dd4..b9f86c5cf2a 100644 --- a/resource-manager/workloads/2023-04-01/sapcentralinstances/client.go +++ b/resource-manager/workloads/2023-04-01/sapcentralinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SAPCentralInstancesClient struct { Client *resourcemanager.Client } -func NewSAPCentralInstancesClientWithBaseURI(api environments.Api) (*SAPCentralInstancesClient, error) { +func NewSAPCentralInstancesClientWithBaseURI(api sdkEnv.Api) (*SAPCentralInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sapcentralinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SAPCentralInstancesClient: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/sapdatabaseinstances/client.go b/resource-manager/workloads/2023-04-01/sapdatabaseinstances/client.go index 1f582a54ae8..c6d954a3b2a 100644 --- a/resource-manager/workloads/2023-04-01/sapdatabaseinstances/client.go +++ b/resource-manager/workloads/2023-04-01/sapdatabaseinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SAPDatabaseInstancesClient struct { Client *resourcemanager.Client } -func NewSAPDatabaseInstancesClientWithBaseURI(api environments.Api) (*SAPDatabaseInstancesClient, error) { +func NewSAPDatabaseInstancesClientWithBaseURI(api sdkEnv.Api) (*SAPDatabaseInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sapdatabaseinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SAPDatabaseInstancesClient: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/sapdiskconfigurations/client.go b/resource-manager/workloads/2023-04-01/sapdiskconfigurations/client.go index 807bb242e0d..49592407c50 100644 --- a/resource-manager/workloads/2023-04-01/sapdiskconfigurations/client.go +++ b/resource-manager/workloads/2023-04-01/sapdiskconfigurations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SAPDiskConfigurationsClient struct { Client *resourcemanager.Client } -func NewSAPDiskConfigurationsClientWithBaseURI(api environments.Api) (*SAPDiskConfigurationsClient, error) { +func NewSAPDiskConfigurationsClientWithBaseURI(api sdkEnv.Api) (*SAPDiskConfigurationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sapdiskconfigurations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SAPDiskConfigurationsClient: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/saplandscapemonitor/client.go b/resource-manager/workloads/2023-04-01/saplandscapemonitor/client.go index ffdacc8d4a1..4e83bb1b0b1 100644 --- a/resource-manager/workloads/2023-04-01/saplandscapemonitor/client.go +++ b/resource-manager/workloads/2023-04-01/saplandscapemonitor/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SapLandscapeMonitorClient struct { Client *resourcemanager.Client } -func NewSapLandscapeMonitorClientWithBaseURI(api environments.Api) (*SapLandscapeMonitorClient, error) { +func NewSapLandscapeMonitorClientWithBaseURI(api sdkEnv.Api) (*SapLandscapeMonitorClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "saplandscapemonitor", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SapLandscapeMonitorClient: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/saprecommendations/client.go b/resource-manager/workloads/2023-04-01/saprecommendations/client.go index e3529e60abc..2a66e1169fe 100644 --- a/resource-manager/workloads/2023-04-01/saprecommendations/client.go +++ b/resource-manager/workloads/2023-04-01/saprecommendations/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SAPRecommendationsClient struct { Client *resourcemanager.Client } -func NewSAPRecommendationsClientWithBaseURI(api environments.Api) (*SAPRecommendationsClient, error) { +func NewSAPRecommendationsClientWithBaseURI(api sdkEnv.Api) (*SAPRecommendationsClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "saprecommendations", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SAPRecommendationsClient: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/sapsupportedsku/client.go b/resource-manager/workloads/2023-04-01/sapsupportedsku/client.go index 1d1356a57f3..03b6ed1a128 100644 --- a/resource-manager/workloads/2023-04-01/sapsupportedsku/client.go +++ b/resource-manager/workloads/2023-04-01/sapsupportedsku/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SAPSupportedSkuClient struct { Client *resourcemanager.Client } -func NewSAPSupportedSkuClientWithBaseURI(api environments.Api) (*SAPSupportedSkuClient, error) { +func NewSAPSupportedSkuClientWithBaseURI(api sdkEnv.Api) (*SAPSupportedSkuClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sapsupportedsku", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SAPSupportedSkuClient: %+v", err) diff --git a/resource-manager/workloads/2023-04-01/sapvirtualinstances/client.go b/resource-manager/workloads/2023-04-01/sapvirtualinstances/client.go index 7eab201dced..e4ec462ac1a 100644 --- a/resource-manager/workloads/2023-04-01/sapvirtualinstances/client.go +++ b/resource-manager/workloads/2023-04-01/sapvirtualinstances/client.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/go-azure-sdk/sdk/environments" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,7 +14,7 @@ type SAPVirtualInstancesClient struct { Client *resourcemanager.Client } -func NewSAPVirtualInstancesClientWithBaseURI(api environments.Api) (*SAPVirtualInstancesClient, error) { +func NewSAPVirtualInstancesClientWithBaseURI(api sdkEnv.Api) (*SAPVirtualInstancesClient, error) { client, err := resourcemanager.NewResourceManagerClient(api, "sapvirtualinstances", defaultApiVersion) if err != nil { return nil, fmt.Errorf("instantiating SAPVirtualInstancesClient: %+v", err)