From c9b9a425ab56588cefd416941aa6ec79acc9ebd1 Mon Sep 17 00:00:00 2001 From: njucz <740360112@qq.com> Date: Mon, 30 Mar 2020 10:35:41 +0800 Subject: [PATCH 1/8] new resource "azurerm_spring_cloud_service" --- azurerm/internal/clients/client.go | 71 + .../provider/required_resource_providers.go | 1 + azurerm/internal/provider/services.go | 2 + .../services/appplatform/client/client.go | 19 + .../data_source_spring_cloud_service.go | 230 +++ .../appplatform/parse/spring_cloud_service.go | 33 + .../parse/spring_cloud_service_test.go | 73 + .../services/appplatform/registration.go | 33 + .../resource_arm_spring_cloud_service.go | 703 +++++++ .../data_source_spring_cloud_service_test.go | 38 + .../resource_arm_spring_cloud_service_test.go | 261 +++ .../appplatform/tests/testdata/host_key | 1 + .../appplatform/tests/testdata/private_key | 51 + .../appplatform/validate/validation.go | 47 + .../appplatform/validate/validation_test.go | 61 + .../2019-05-01-preview/appplatform/apps.go | 585 ++++++ .../appplatform/bindings.go | 488 +++++ .../2019-05-01-preview/appplatform/client.go | 52 + .../appplatform/deployments.go | 954 +++++++++ .../2019-05-01-preview/appplatform/models.go | 1746 +++++++++++++++++ .../appplatform/operations.go | 147 ++ .../appplatform/services.go | 985 ++++++++++ .../2019-05-01-preview/appplatform/version.go | 30 + vendor/modules.txt | 1 + website/allowed-subcategories | 1 + website/azurerm.erb | 13 + .../docs/d/spring_cloud_service.html.markdown | 104 + .../docs/r/spring_cloud_service.html.markdown | 128 ++ 28 files changed, 6858 insertions(+) create mode 100644 azurerm/internal/services/appplatform/client/client.go create mode 100644 azurerm/internal/services/appplatform/data_source_spring_cloud_service.go create mode 100644 azurerm/internal/services/appplatform/parse/spring_cloud_service.go create mode 100644 azurerm/internal/services/appplatform/parse/spring_cloud_service_test.go create mode 100644 azurerm/internal/services/appplatform/registration.go create mode 100644 azurerm/internal/services/appplatform/resource_arm_spring_cloud_service.go create mode 100644 azurerm/internal/services/appplatform/tests/data_source_spring_cloud_service_test.go create mode 100644 azurerm/internal/services/appplatform/tests/resource_arm_spring_cloud_service_test.go create mode 100644 azurerm/internal/services/appplatform/tests/testdata/host_key create mode 100644 azurerm/internal/services/appplatform/tests/testdata/private_key create mode 100644 azurerm/internal/services/appplatform/validate/validation.go create mode 100644 azurerm/internal/services/appplatform/validate/validation_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/apps.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/bindings.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/client.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/deployments.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/models.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/operations.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/services.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/version.go create mode 100644 website/docs/d/spring_cloud_service.html.markdown create mode 100644 website/docs/r/spring_cloud_service.html.markdown diff --git a/azurerm/internal/clients/client.go b/azurerm/internal/clients/client.go index d246b09d2fa0..8b7932e57929 100644 --- a/azurerm/internal/clients/client.go +++ b/azurerm/internal/clients/client.go @@ -10,6 +10,7 @@ import ( apiManagement "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/apimanagement/client" appConfiguration "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/appconfiguration/client" applicationInsights "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/applicationinsights/client" + appPlatform "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/appplatform/client" authorization "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/authorization/client" automation "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/automation/client" batch "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/batch/client" @@ -82,6 +83,7 @@ type Client struct { Account *ResourceManagerAccount Features features.UserFeatures +<<<<<<< HEAD AnalysisServices *analysisServices.Client ApiManagement *apiManagement.Client AppConfiguration *appConfiguration.Client @@ -149,6 +151,74 @@ type Client struct { Sql *sql.Client TrafficManager *trafficManager.Client Web *web.Client +======= + AnalysisServices *analysisServices.Client + ApiManagement *apiManagement.Client + AppConfiguration *appConfiguration.Client + AppInsights *applicationInsights.Client + AppPlatform *appPlatform.Client + Authorization *authorization.Client + Automation *automation.Client + Batch *batch.Client + Bot *bot.Client + Cdn *cdn.Client + Cognitive *cognitiveServices.Client + Compute *compute.Client + Containers *containerServices.Client + Cosmos *cosmosdb.Client + CostManagement *costmanagement.Client + DatabaseMigration *datamigration.Client + DataBricks *databricks.Client + DataFactory *datafactory.Client + Datalake *datalake.Client + DevSpace *devspace.Client + DevTestLabs *devtestlabs.Client + Dns *dns.Client + EventGrid *eventgrid.Client + Eventhub *eventhub.Client + Frontdoor *frontdoor.Client + HDInsight *hdinsight.Client + HealthCare *healthcare.Client + IoTHub *iothub.Client + IoTCentral *iotcentral.Client + KeyVault *keyvault.Client + Kusto *kusto.Client + LogAnalytics *loganalytics.Client + Logic *logic.Client + MachineLearning *machinelearning.Client + ManagementGroups *managementgroup.Client + Maps *maps.Client + MariaDB *mariadb.Client + Media *media.Client + MixedReality *mixedreality.Client + Monitor *monitor.Client + MSI *msi.Client + MSSQL *mssql.Client + MySQL *mysql.Client + NetApp *netapp.Client + Network *network.Client + NotificationHubs *notificationhub.Client + Policy *policy.Client + Portal *portal.Client + Postgres *postgres.Client + PowerBI *powerBI.Client + PrivateDns *privatedns.Client + RecoveryServices *recoveryServices.Client + Redis *redis.Client + Relay *relay.Client + Resource *resource.Client + Search *search.Client + SecurityCenter *securityCenter.Client + ServiceBus *serviceBus.Client + ServiceFabric *serviceFabric.Client + SignalR *signalr.Client + Storage *storage.Client + StreamAnalytics *streamAnalytics.Client + Subscription *subscription.Client + Sql *sql.Client + TrafficManager *trafficManager.Client + Web *web.Client +>>>>>>> new resource "azurerm_spring_cloud_service" } // NOTE: it should be possible for this method to become Private once the top level Client's removed @@ -163,6 +233,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error client.ApiManagement = apiManagement.NewClient(o) client.AppConfiguration = appConfiguration.NewClient(o) client.AppInsights = applicationInsights.NewClient(o) + client.AppPlatform = appPlatform.NewClient(o) client.Authorization = authorization.NewClient(o) client.Automation = automation.NewClient(o) client.Batch = batch.NewClient(o) diff --git a/azurerm/internal/provider/required_resource_providers.go b/azurerm/internal/provider/required_resource_providers.go index 8654c4831d6b..fa86fdaf3ad1 100644 --- a/azurerm/internal/provider/required_resource_providers.go +++ b/azurerm/internal/provider/required_resource_providers.go @@ -17,6 +17,7 @@ func RequiredResourceProviders() map[string]struct{} { // NOTE: Resource Providers in this list are case sensitive return map[string]struct{}{ "Microsoft.ApiManagement": {}, + "Microsoft.AppPlatform": {}, "Microsoft.Authorization": {}, "Microsoft.Automation": {}, "Microsoft.BotService": {}, diff --git a/azurerm/internal/provider/services.go b/azurerm/internal/provider/services.go index 7ff6b1dceafe..eb0e855b0f09 100644 --- a/azurerm/internal/provider/services.go +++ b/azurerm/internal/provider/services.go @@ -5,6 +5,7 @@ import ( "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/apimanagement" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/appconfiguration" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/applicationinsights" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/appplatform" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/authorization" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/automation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/batch" @@ -78,6 +79,7 @@ func SupportedServices() []common.ServiceRegistration { analysisservices.Registration{}, apimanagement.Registration{}, appconfiguration.Registration{}, + appplatform.Registration{}, applicationinsights.Registration{}, authorization.Registration{}, automation.Registration{}, diff --git a/azurerm/internal/services/appplatform/client/client.go b/azurerm/internal/services/appplatform/client/client.go new file mode 100644 index 000000000000..db4af5abedd2 --- /dev/null +++ b/azurerm/internal/services/appplatform/client/client.go @@ -0,0 +1,19 @@ +package client + +import ( + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common" +) + +type Client struct { + ServicesClient *appplatform.ServicesClient +} + +func NewClient(o *common.ClientOptions) *Client { + servicesClient := appplatform.NewServicesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&servicesClient.Client, o.ResourceManagerAuthorizer) + + return &Client{ + ServicesClient: &servicesClient, + } +} diff --git a/azurerm/internal/services/appplatform/data_source_spring_cloud_service.go b/azurerm/internal/services/appplatform/data_source_spring_cloud_service.go new file mode 100644 index 000000000000..3a2a43d9f268 --- /dev/null +++ b/azurerm/internal/services/appplatform/data_source_spring_cloud_service.go @@ -0,0 +1,230 @@ +package appplatform + +import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/appplatform/validate" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func dataSourceArmSpringCloudService() *schema.Resource { + return &schema.Resource{ + Read: dataSourceArmSpringCloudServiceRead, + + Timeouts: &schema.ResourceTimeout{ + Read: schema.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validate.ValidateSpringCloudServiceName, + }, + + "location": azure.SchemaLocationForDataSource(), + + "resource_group_name": azure.SchemaResourceGroupNameForDataSource(), + + "config_server_git_settings": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "uri": { + Type: schema.TypeString, + Computed: true, + }, + + "label": { + Type: schema.TypeString, + Computed: true, + }, + + "search_paths": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + + "http_basic_auth": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "username": { + Type: schema.TypeString, + Computed: true, + }, + "password": { + Type: schema.TypeString, + Computed: true, + Sensitive: true, + }, + }, + }, + }, + + "ssh_auth": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "private_key": { + Type: schema.TypeString, + Computed: true, + Sensitive: true, + }, + "host_key": { + Type: schema.TypeString, + Computed: true, + Sensitive: true, + }, + "host_key_algorithm": { + Type: schema.TypeString, + Computed: true, + }, + "strict_host_key_checking_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + }, + }, + }, + + "repositories": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + }, + "uri": { + Type: schema.TypeString, + Computed: true, + }, + "label": { + Type: schema.TypeString, + Computed: true, + }, + "pattern": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "search_paths": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "http_basic_auth": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "username": { + Type: schema.TypeString, + Computed: true, + }, + + "password": { + Type: schema.TypeString, + Computed: true, + Sensitive: true, + }, + }, + }, + }, + "ssh_auth": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "private_key": { + Type: schema.TypeString, + Computed: true, + Sensitive: true, + }, + + "host_key": { + Type: schema.TypeString, + Computed: true, + Sensitive: true, + }, + + "host_key_algorithm": { + Type: schema.TypeString, + Computed: true, + }, + + "strict_host_key_checking_enabled": { + Type: schema.TypeBool, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + + "tags": tags.SchemaDataSource(), + }, + } +} + +func dataSourceArmSpringCloudServiceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("Error: Spring Cloud %q (Resource Group %q) was not found", name, resourceGroup) + } + return fmt.Errorf("Error reading Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + if resp.ID == nil || *resp.ID == "" { + return fmt.Errorf("Error retrieving Spring Cloud Service %q (Resource Group %q): ID was nil or empty", name, resourceGroup) + } + + d.SetId(*resp.ID) + + d.Set("name", resp.Name) + d.Set("resource_group_name", resourceGroup) + if location := resp.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } + + if resp.Properties != nil && resp.Properties.ConfigServerProperties != nil && resp.Properties.ConfigServerProperties.ConfigServer != nil { + if props := resp.Properties.ConfigServerProperties.ConfigServer.GitProperty; props != nil { + if err := d.Set("config_server_git_settings", flattenArmSpringCloudConfigServerGitSettings(props, d)); err != nil { + return fmt.Errorf("[DEBUG] failure setting AzureRM Spring Cloud Service Config Server error: %+v", err) + } + } + } + + return tags.FlattenAndSet(d, resp.Tags) +} diff --git a/azurerm/internal/services/appplatform/parse/spring_cloud_service.go b/azurerm/internal/services/appplatform/parse/spring_cloud_service.go new file mode 100644 index 000000000000..b2f2564ffb6b --- /dev/null +++ b/azurerm/internal/services/appplatform/parse/spring_cloud_service.go @@ -0,0 +1,33 @@ +package parse + +import ( + "fmt" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" +) + +type SpringCloudServiceId struct { + ResourceGroup string + Name string +} + +func SpringCloudServiceID(input string) (*SpringCloudServiceId, error) { + id, err := azure.ParseAzureResourceID(input) + if err != nil { + return nil, fmt.Errorf("unable to parse Spring Cloud Service ID %q: %+v", input, err) + } + + server := SpringCloudServiceId{ + ResourceGroup: id.ResourceGroup, + } + + if server.Name, err = id.PopSegment("Spring"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &server, nil +} diff --git a/azurerm/internal/services/appplatform/parse/spring_cloud_service_test.go b/azurerm/internal/services/appplatform/parse/spring_cloud_service_test.go new file mode 100644 index 000000000000..227e1c0b8e47 --- /dev/null +++ b/azurerm/internal/services/appplatform/parse/spring_cloud_service_test.go @@ -0,0 +1,73 @@ +package parse + +import ( + "testing" +) + +func TestSpringCloudServiceID(t *testing.T) { + testData := []struct { + Name string + Input string + Expected *SpringCloudServiceId + }{ + { + Name: "Empty", + Input: "", + Expected: nil, + }, + { + Name: "No Resource Groups Segment", + Input: "/subscriptions/00000000-0000-0000-0000-000000000000", + Expected: nil, + }, + { + Name: "No Resource Groups Value", + Input: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/", + Expected: nil, + }, + { + Name: "Resource Group ID", + Input: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/foo/", + Expected: nil, + }, + { + Name: "Missing Stores Value", + Input: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/Spring/", + Expected: nil, + }, + { + Name: "App Configuration ID", + Input: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/Spring/spring1", + Expected: &SpringCloudServiceId{ + Name: "spring1", + ResourceGroup: "resGroup1", + }, + }, + { + Name: "Wrong Casing", + Input: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/spring/spring1", + Expected: nil, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Name) + + actual, err := SpringCloudServiceID(v.Input) + if err != nil { + if v.Expected == nil { + continue + } + + t.Fatalf("Expected a value but got an error: %s", err) + } + + if actual.Name != v.Expected.Name { + t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) + } + + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for Resource Group", v.Expected.ResourceGroup, actual.ResourceGroup) + } + } +} diff --git a/azurerm/internal/services/appplatform/registration.go b/azurerm/internal/services/appplatform/registration.go new file mode 100644 index 000000000000..0a6b19ad9b3b --- /dev/null +++ b/azurerm/internal/services/appplatform/registration.go @@ -0,0 +1,33 @@ +package appplatform + +import ( + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +type Registration struct{} + +// Name is the name of this Service +func (r Registration) Name() string { + return "App Platform" +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return []string{ + "Spring Cloud", + } +} + +// SupportedDataSources returns the supported Data Sources supported by this Service +func (r Registration) SupportedDataSources() map[string]*schema.Resource { + return map[string]*schema.Resource{ + "azurerm_spring_cloud_service": dataSourceArmSpringCloudService(), + } +} + +// SupportedResources returns the supported Resources supported by this Service +func (r Registration) SupportedResources() map[string]*schema.Resource { + return map[string]*schema.Resource{ + "azurerm_spring_cloud_service": resourceArmSpringCloudService(), + } +} diff --git a/azurerm/internal/services/appplatform/resource_arm_spring_cloud_service.go b/azurerm/internal/services/appplatform/resource_arm_spring_cloud_service.go new file mode 100644 index 000000000000..d3899888a1f4 --- /dev/null +++ b/azurerm/internal/services/appplatform/resource_arm_spring_cloud_service.go @@ -0,0 +1,703 @@ +package appplatform + +import ( + "fmt" + "log" + "time" + + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform" + "github.com/hashicorp/go-azure-helpers/response" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/appplatform/parse" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/appplatform/validate" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags" + azSchema "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tf/schema" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceArmSpringCloudService() *schema.Resource { + return &schema.Resource{ + Create: resourceArmSpringCloudServiceCreate, + Read: resourceArmSpringCloudServiceRead, + Update: resourceArmSpringCloudServiceUpdate, + Delete: resourceArmSpringCloudServiceDelete, + + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(30 * time.Minute), + Read: schema.DefaultTimeout(5 * time.Minute), + Update: schema.DefaultTimeout(30 * time.Minute), + Delete: schema.DefaultTimeout(30 * time.Minute), + }, + + Importer: azSchema.ValidateResourceIDPriorToImport(func(id string) error { + _, err := parse.SpringCloudServiceID(id) + return err + }), + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.ValidateSpringCloudServiceName, + }, + + // Spring Cloud Service only supports following locations, we are still supporting more locations (Wednesday, November 20, 2019 4:20 PM): + // `East US`, `Southeast Asia`, `West Europe`, `West US 2` + "location": azure.SchemaLocation(), + + "resource_group_name": azure.SchemaResourceGroupName(), + + "config_server_git_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "uri": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validate.ValidateConfigServerURI, + }, + + "label": { + Type: schema.TypeString, + Optional: true, + }, + + "search_paths": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "http_basic_auth": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + ConflictsWith: []string{"config_server_git_settings.0.ssh_auth"}, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "username": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "password": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + }, + }, + }, + + "ssh_auth": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + ConflictsWith: []string{"config_server_git_settings.0.http_basic_auth"}, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "private_key": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "host_key": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "host_key_algorithm": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "ssh-dss", + "ssh-rsa", + "ecdsa-sha2-nistp256", + "ecdsa-sha2-nistp384", + "ecdsa-sha2-nistp521", + }, false), + }, + + "strict_host_key_checking_enabled": { + Type: schema.TypeBool, + Optional: true, + }, + }, + }, + }, + + "repositories": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "uri": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validate.ValidateConfigServerURI, + }, + "label": { + Type: schema.TypeString, + Optional: true, + }, + "pattern": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + "search_paths": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + "http_basic_auth": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "username": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "password": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + }, + }, + }, + "ssh_auth": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "private_key": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "host_key": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "host_key_algorithm": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "ssh-dss", + "ssh-rsa", + "ecdsa-sha2-nistp256", + "ecdsa-sha2-nistp384", + "ecdsa-sha2-nistp521", + }, false), + }, + + "strict_host_key_checking_enabled": { + Type: schema.TypeBool, + Optional: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + + "tags": tags.Schema(), + }, + } +} + +func resourceArmSpringCloudServiceCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + + existing, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for present of existing Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + } + if existing.ID != nil && *existing.ID != "" { + return tf.ImportAsExistsError("azurerm_spring_cloud_service", *existing.ID) + } + + location := azure.NormalizeLocation(d.Get("location").(string)) + resource := appplatform.ServiceResource{ + Location: utils.String(location), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + } + + // current create api doesn't take care parameters of config server. + // so we need to invoke create api first and then update api + future, err := client.CreateOrUpdate(ctx, resourceGroup, name, resource) + if err != nil { + return fmt.Errorf("creating Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for creation of Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + gitPropertyRaw := d.Get("config_server_git_settings").([]interface{}) + resource.Properties = &appplatform.ClusterResourceProperties{ + ConfigServerProperties: &appplatform.ConfigServerProperties{ + ConfigServer: &appplatform.ConfigServerSettings{ + GitProperty: expandArmSpringCloudConfigServerGitProperty(gitPropertyRaw), + }, + }, + } + + updateFuture, err := client.Update(ctx, resourceGroup, name, resource) + if err != nil { + return fmt.Errorf("failure updating config server of Spring Cloud Service %q (Resource Group %q): %+v", name, resourceGroup, err) + } + if err = updateFuture.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("failure waiting for setting config server of Spring Cloud Service %q config server (Resource Group %q): %+v", name, resourceGroup, err) + } + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + return fmt.Errorf("unable to retrieve Spring Cloud Service %q (Resource Group %q): %+v", name, resourceGroup, err) + } + if resp.Properties != nil && resp.Properties.ConfigServerProperties != nil { + if err := resp.Properties.ConfigServerProperties.Error; err != nil { + return fmt.Errorf("failure setting config server of Spring Cloud Service %q (Resource Group %q): %+v", name, resourceGroup, err) + } + } + if resp.ID == nil || *resp.ID == "" { + return fmt.Errorf("cannot read Spring Cloud Service %q (Resource Group %q) ID", name, resourceGroup) + } + d.SetId(*resp.ID) + + return resourceArmSpringCloudServiceRead(d, meta) +} + +func resourceArmSpringCloudServiceUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + gitPropertyRaw := d.Get("config_server_git_settings").([]interface{}) + + springCloudService := appplatform.ServiceResource{ + Properties: &appplatform.ClusterResourceProperties{ + ConfigServerProperties: &appplatform.ConfigServerProperties{ + ConfigServer: &appplatform.ConfigServerSettings{ + GitProperty: expandArmSpringCloudConfigServerGitProperty(gitPropertyRaw), + }, + }, + }, + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + } + + future, err := client.Update(ctx, resourceGroup, name, springCloudService) + if err != nil { + return fmt.Errorf("updating Spring Cloud Service %q (Resource Group %q): %+v", name, resourceGroup, err) + } + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for update of Spring Cloud Service %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + resp, err := future.Result(*client) + if err != nil { + return fmt.Errorf("failure getting result of Spring Cloud Service %q (Resource Group %q): %+v", name, resourceGroup, err) + } + if resp.Properties != nil && resp.Properties.ConfigServerProperties != nil { + if err := resp.Properties.ConfigServerProperties.Error; err != nil { + return fmt.Errorf("failure setting config server of Spring Cloud Service %q (Resource Group %q): %+v", name, resourceGroup, err) + } + } + + return resourceArmSpringCloudServiceRead(d, meta) +} + +func resourceArmSpringCloudServiceRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.SpringCloudServiceID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[INFO] Spring Cloud Service %q does not exist - removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("unable to read Spring Cloud Service %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + } + + d.Set("name", resp.Name) + d.Set("resource_group_name", id.ResourceGroup) + if location := resp.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } + + if resp.Properties != nil && resp.Properties.ConfigServerProperties != nil && resp.Properties.ConfigServerProperties.ConfigServer != nil { + if props := resp.Properties.ConfigServerProperties.ConfigServer.GitProperty; props != nil { + if err := d.Set("config_server_git_settings", flattenArmSpringCloudConfigServerGitSettings(props, d)); err != nil { + return fmt.Errorf("[DEBUG] failure setting AzureRM Spring Cloud Service error: %+v", err) + } + } + } + + return tags.FlattenAndSet(d, resp.Tags) +} + +func resourceArmSpringCloudServiceDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.SpringCloudServiceID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.Name) + if err != nil { + return fmt.Errorf("failure deleting Spring Cloud Service %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + if !response.WasNotFound(future.Response()) { + return fmt.Errorf("failure waiting for deleting Spring Cloud Service %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + } + } + + return nil +} + +func expandArmSpringCloudConfigServerGitProperty(input []interface{}) *appplatform.ConfigServerGitProperty { + if len(input) == 0 || input[0] == nil { + return nil + } + + v := input[0].(map[string]interface{}) + if v == nil { + return nil + } + + result := appplatform.ConfigServerGitProperty{ + URI: utils.String(v["uri"].(string)), + } + + if label := v["label"].(string); label != "" { + result.Label = utils.String(label) + } + if searchPaths := v["search_paths"].([]interface{}); len(searchPaths) > 0 { + result.SearchPaths = utils.ExpandStringSlice(searchPaths) + } + if httpBasicAuth := v["http_basic_auth"].([]interface{}); len(httpBasicAuth) > 0 { + v := httpBasicAuth[0].(map[string]interface{}) + result.Username = utils.String(v["username"].(string)) + result.Password = utils.String(v["password"].(string)) + } + if sshAuth := v["ssh_auth"].([]interface{}); len(sshAuth) > 0 { + v := sshAuth[0].(map[string]interface{}) + result.PrivateKey = utils.String(v["private_key"].(string)) + result.StrictHostKeyChecking = utils.Bool(v["strict_host_key_checking_enabled"].(bool)) + + if hostKey := v["host_key"].(string); hostKey != "" { + result.HostKey = utils.String(hostKey) + } + if hostKeyAlgorithm := v["host_key_algorithm"].(string); hostKeyAlgorithm != "" { + result.HostKeyAlgorithm = utils.String(hostKeyAlgorithm) + } + } + + if repositories, ok := v["repositories"]; ok { + result.Repositories = expandArmSpringCloudGitPatternRepository(repositories.([]interface{})) + } + + return &result +} + +func expandArmSpringCloudGitPatternRepository(input []interface{}) *[]appplatform.GitPatternRepository { + results := make([]appplatform.GitPatternRepository, 0) + for _, item := range input { + v := item.(map[string]interface{}) + + result := appplatform.GitPatternRepository{ + Name: utils.String(v["name"].(string)), + URI: utils.String(v["uri"].(string)), + } + + if label := v["label"].(string); len(label) > 0 { + result.Label = utils.String(label) + } + if pattern := v["pattern"].([]interface{}); len(pattern) > 0 { + result.Pattern = utils.ExpandStringSlice(pattern) + } + if searchPaths := v["search_paths"].([]interface{}); len(searchPaths) > 0 { + result.SearchPaths = utils.ExpandStringSlice(searchPaths) + } + if httpBasicAuth := v["http_basic_auth"].([]interface{}); len(httpBasicAuth) > 0 { + v := httpBasicAuth[0].(map[string]interface{}) + result.Username = utils.String(v["username"].(string)) + result.Password = utils.String(v["password"].(string)) + } + if sshAuth := v["ssh_auth"].([]interface{}); len(sshAuth) > 0 { + v := sshAuth[0].(map[string]interface{}) + result.PrivateKey = utils.String(v["private_key"].(string)) + result.StrictHostKeyChecking = utils.Bool(v["strict_host_key_checking_enabled"].(bool)) + + if hostKey := v["host_key"].(string); hostKey != "" { + result.HostKey = utils.String(hostKey) + } + if hostKeyAlgorithm := v["host_key_algorithm"].(string); hostKeyAlgorithm != "" { + result.HostKeyAlgorithm = utils.String(hostKeyAlgorithm) + } + } + + results = append(results, result) + } + return &results +} + +func flattenArmSpringCloudConfigServerGitSettings(input *appplatform.ConfigServerGitProperty, d *schema.ResourceData) []interface{} { + if input == nil { + return []interface{}{} + } + + // prepare old state to find sensitive props not returned by API. + oldGitSetting := make(map[string]interface{}) + if oldGitSettings := d.Get("config_server_git_settings").([]interface{}); len(oldGitSettings) > 0 { + oldGitSetting = oldGitSettings[0].(map[string]interface{}) + } + + uri := "" + if input.URI != nil { + uri = *input.URI + } + + label := "" + if input.Label != nil { + label = *input.Label + } + + searchPaths := utils.FlattenStringSlice(input.SearchPaths) + + httpBasicAuth := []interface{}{} + if input.Username != nil && input.Password != nil { + // username and password returned by API are * + // to avoid state diff, we get the props from old state + username := "" + password := "" + if v, ok := oldGitSetting["http_basic_auth"]; ok { + oldHTTPBasicAuth := v.([]interface{}) + if len(oldHTTPBasicAuth) > 0 { + oldItem := oldHTTPBasicAuth[0].(map[string]interface{}) + username = oldItem["username"].(string) + password = oldItem["password"].(string) + } + } + + httpBasicAuth = []interface{}{ + map[string]interface{}{ + "username": username, + "password": password, + }, + } + } + + sshAuth := []interface{}{} + if input.PrivateKey != nil { + // private_key, host_key and host_key_algorithm returned by API are * + // to avoid state diff, we get the props from old state + privateKey := "" + hostKey := "" + hostKeyAlgorithm := "" + if v, ok := oldGitSetting["ssh_auth"]; ok { + sshAuth := v.([]interface{}) + if len(sshAuth) > 0 { + oldItem := sshAuth[0].(map[string]interface{}) + privateKey = oldItem["private_key"].(string) + hostKey = oldItem["host_key"].(string) + hostKeyAlgorithm = oldItem["host_key_algorithm"].(string) + } + } + + strictHostKeyChecking := false + if input.StrictHostKeyChecking != nil { + strictHostKeyChecking = *input.StrictHostKeyChecking + } + + sshAuth = []interface{}{ + map[string]interface{}{ + "private_key": privateKey, + "host_key": hostKey, + "host_key_algorithm": hostKeyAlgorithm, + "strict_host_key_checking_enabled": strictHostKeyChecking, + }, + } + } + + return []interface{}{ + map[string]interface{}{ + "uri": uri, + "label": label, + "search_paths": searchPaths, + "http_basic_auth": httpBasicAuth, + "ssh_auth": sshAuth, + "repositories": flattenArmSpringCloudGitPatternRepository(input.Repositories, d), + }, + } +} + +func flattenArmSpringCloudGitPatternRepository(input *[]appplatform.GitPatternRepository, d *schema.ResourceData) []interface{} { + results := make([]interface{}, 0) + if input == nil { + return results + } + + // prepare old state to find sensitive props not returned by API. + oldGitPatternRepositories := []interface{}{} + if oldGitSettings := d.Get("config_server_git_settings").([]interface{}); len(oldGitSettings) > 0 { + oldGitSetting := oldGitSettings[0].(map[string]interface{}) + oldGitPatternRepositories = oldGitSetting["repositories"].([]interface{}) + } + + for i, item := range *input { + // prepare old state to find sensitive props not returned by API. + oldGitPatternRepository := make(map[string]interface{}) + if len(oldGitPatternRepositories) > 0 { + oldGitPatternRepository = oldGitPatternRepositories[i].(map[string]interface{}) + } + + name := "" + if item.Name != nil { + name = *item.Name + } + + uri := "" + if item.URI != nil { + uri = *item.URI + } + + label := "" + if item.Label != nil { + label = *item.Label + } + + pattern := utils.FlattenStringSlice(item.Pattern) + searchPaths := utils.FlattenStringSlice(item.SearchPaths) + + httpBasicAuth := []interface{}{} + if item.Username != nil && item.Password != nil { + // username and password returned by API are * + // to avoid state diff, we get the props from old state + username := "" + password := "" + if v, ok := oldGitPatternRepository["http_basic_auth"]; ok { + oldHTTPBasicAuth := v.([]interface{}) + if len(oldHTTPBasicAuth) > 0 { + oldItem := oldHTTPBasicAuth[0].(map[string]interface{}) + username = oldItem["username"].(string) + password = oldItem["password"].(string) + } + } + + httpBasicAuth = []interface{}{ + map[string]interface{}{ + "username": username, + "password": password, + }, + } + } + + sshAuth := []interface{}{} + if item.PrivateKey != nil { + // private_key, host_key and host_key_algorithm returned by API are * + // to avoid state diff, we get the props from old state + privateKey := "" + hostKey := "" + hostKeyAlgorithm := "" + if v, ok := oldGitPatternRepository["ssh_auth"]; ok { + sshAuth := v.([]interface{}) + if len(sshAuth) > 0 { + oldItem := sshAuth[0].(map[string]interface{}) + privateKey = oldItem["private_key"].(string) + hostKey = oldItem["host_key"].(string) + hostKeyAlgorithm = oldItem["host_key_algorithm"].(string) + } + } + + strictHostKeyChecking := false + if item.StrictHostKeyChecking != nil { + strictHostKeyChecking = *item.StrictHostKeyChecking + } + + sshAuth = []interface{}{ + map[string]interface{}{ + "private_key": privateKey, + "host_key": hostKey, + "host_key_algorithm": hostKeyAlgorithm, + "strict_host_key_checking_enabled": strictHostKeyChecking, + }, + } + } + + results = append(results, map[string]interface{}{ + "name": name, + "uri": uri, + "label": label, + "pattern": pattern, + "search_paths": searchPaths, + "http_basic_auth": httpBasicAuth, + "ssh_auth": sshAuth, + }) + } + + return results +} diff --git a/azurerm/internal/services/appplatform/tests/data_source_spring_cloud_service_test.go b/azurerm/internal/services/appplatform/tests/data_source_spring_cloud_service_test.go new file mode 100644 index 000000000000..db5c6950f68c --- /dev/null +++ b/azurerm/internal/services/appplatform/tests/data_source_spring_cloud_service_test.go @@ -0,0 +1,38 @@ +package tests + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/acceptance" +) + +func TestAccDataSourceAzureRMSpringCloudService_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_spring_cloud_service", "test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.PreCheck(t) }, + Providers: acceptance.SupportedProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceSpringCloudService_basic(data), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(data.ResourceName, "id"), + ), + }, + }, + }) +} + +func testAccDataSourceSpringCloudService_basic(data acceptance.TestData) string { + config := testAccAzureRMSpringCloudService_basic(data) + return fmt.Sprintf(` +%s + +data "azurerm_spring_cloud_service" "test" { + name = azurerm_spring_cloud_service.test.name + resource_group_name = azurerm_spring_cloud_service.test.resource_group_name +} +`, config) +} diff --git a/azurerm/internal/services/appplatform/tests/resource_arm_spring_cloud_service_test.go b/azurerm/internal/services/appplatform/tests/resource_arm_spring_cloud_service_test.go new file mode 100644 index 000000000000..a9e947eae2a6 --- /dev/null +++ b/azurerm/internal/services/appplatform/tests/resource_arm_spring_cloud_service_test.go @@ -0,0 +1,261 @@ +package tests + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/acceptance" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func TestAccAzureRMSpringCloudService_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_service", "test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.PreCheck(t) }, + Providers: acceptance.SupportedProviders, + CheckDestroy: testCheckAzureRMSpringCloudServiceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSpringCloudService_basic(data), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSpringCloudServiceExists(data.ResourceName), + ), + }, + data.ImportStep(), + }, + }) +} + +func TestAccAzureRMSpringCloudService_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_service", "test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.PreCheck(t) }, + Providers: acceptance.SupportedProviders, + CheckDestroy: testCheckAzureRMSpringCloudServiceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSpringCloudService_basic(data), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSpringCloudServiceExists(data.ResourceName), + ), + }, + data.ImportStep(), + { + Config: testAccAzureRMSpringCloudService_complete(data), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSpringCloudServiceExists(data.ResourceName), + ), + }, + data.ImportStep( + // those field returned by api are "*" + // import state verify ignore those fields + "config_server_git_settings.0.ssh_auth.0.private_key", + "config_server_git_settings.0.ssh_auth.0.host_key", + "config_server_git_settings.0.ssh_auth.0.host_key_algorithm", + "config_server_git_settings.0.repositories.0.http_basic_auth.0.username", + "config_server_git_settings.0.repositories.0.http_basic_auth.0.password", + ), + { + Config: testAccAzureRMSpringCloudService_basic(data), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSpringCloudServiceExists(data.ResourceName), + ), + }, + data.ImportStep(), + }, + }) +} + +func TestAccAzureRMSpringCloudService_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_service", "test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.PreCheck(t) }, + Providers: acceptance.SupportedProviders, + CheckDestroy: testCheckAzureRMSpringCloudServiceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSpringCloudService_complete(data), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSpringCloudServiceExists(data.ResourceName), + resource.TestCheckResourceAttrSet(data.ResourceName, "id"), + ), + }, + data.ImportStep( + // those field returned by api are "*" + // import state verify ignore those fields + "config_server_git_settings.0.ssh_auth.0.private_key", + "config_server_git_settings.0.ssh_auth.0.host_key", + "config_server_git_settings.0.ssh_auth.0.host_key_algorithm", + "config_server_git_settings.0.repositories.0.http_basic_auth.0.username", + "config_server_git_settings.0.repositories.0.http_basic_auth.0.password", + ), + }, + }) +} + +func TestAccAzureRMSpringCloudService_requiresImport(t *testing.T) { + if !features.ShouldResourcesBeImported() { + t.Skip("Skipping since resources aren't required to be imported") + return + } + + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_service", "test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.PreCheck(t) }, + Providers: acceptance.SupportedProviders, + CheckDestroy: testCheckAzureRMSpringCloudServiceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSpringCloudService_basic(data), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSpringCloudServiceExists(data.ResourceName), + ), + }, + data.RequiresImportErrorStep(testAccAzureRMSpringCloudService_requiresImport), + }, + }) +} + +func testCheckAzureRMSpringCloudServiceExists(resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("Spring Cloud not found: %s", resourceName) + } + + name := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + client := acceptance.AzureProvider.Meta().(*clients.Client).AppPlatform.ServicesClient + ctx := acceptance.AzureProvider.Meta().(*clients.Client).StopContext + + if resp, err := client.Get(ctx, resourceGroup, name); err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("Bad: Spring Cloud Service %q (Resource Group %q) does not exist", name, resourceGroup) + } + return fmt.Errorf("Bad: Get on AppPlatform.ServicesClient: %+v", err) + } + + return nil + } +} + +func testCheckAzureRMSpringCloudServiceDestroy(s *terraform.State) error { + client := acceptance.AzureProvider.Meta().(*clients.Client).AppPlatform.ServicesClient + ctx := acceptance.AzureProvider.Meta().(*clients.Client).StopContext + + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_spring_cloud_service" { + continue + } + + name := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + if resp, err := client.Get(ctx, resourceGroup, name); err != nil { + if !utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("Bad: Get on AppPlatform.ServicesClient: %+v", err) + } + } + + return nil + } + + return nil +} + +func testAccAzureRMSpringCloudService_basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-spring-%d" + location = "%s" +} + +resource "azurerm_spring_cloud_service" "test" { + name = "acctest-sc-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +} + +func testAccAzureRMSpringCloudService_complete(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-spring-%d" + location = "%s" +} + +resource "azurerm_spring_cloud_service" "test" { + name = "acctest-sc-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + config_server_git_settings { + uri = "git@bitbucket.org:Azure-Samples/piggymetrics.git" + label = "config" + search_paths = ["dir1", "dir4"] + + ssh_auth { + private_key = file("testdata/private_key") + host_key = file("testdata/host_key") + host_key_algorithm = "ssh-rsa" + strict_host_key_checking_enabled = false + } + + repositories { + name = "repo1" + uri = "https://github.com/Azure-Samples/piggymetrics" + label = "config" + search_paths = ["dir1", "dir2"] + http_basic_auth { + username = "username" + password = "password" + } + } + + repositories { + name = "repo2" + uri = "https://github.com/Azure-Samples/piggymetrics" + label = "config" + search_paths = ["dir1", "dir2"] + } + } + + tags = { + Env = "Test" + version = "1" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +} + +func testAccAzureRMSpringCloudService_requiresImport(data acceptance.TestData) string { + template := testAccAzureRMSpringCloudService_basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_spring_cloud_service" "import" { + name = azurerm_spring_cloud_service.test.name + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} +`, template) +} diff --git a/azurerm/internal/services/appplatform/tests/testdata/host_key b/azurerm/internal/services/appplatform/tests/testdata/host_key new file mode 100644 index 000000000000..ef69bea3cb06 --- /dev/null +++ b/azurerm/internal/services/appplatform/tests/testdata/host_key @@ -0,0 +1 @@ +AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw== \ No newline at end of file diff --git a/azurerm/internal/services/appplatform/tests/testdata/private_key b/azurerm/internal/services/appplatform/tests/testdata/private_key new file mode 100644 index 000000000000..ff05c7642152 --- /dev/null +++ b/azurerm/internal/services/appplatform/tests/testdata/private_key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEAy1EKzv5dJs27bnr3LL7sc4Qybnd/V8DDCdRKXDKTHwFq+OgR +I2dfIqwDU4FnXVi2OM32A88AgGl1R3a6ydVHH1zxWRpTQgCVqd/z/1KoqKDo7TqH +GqKFo8wf1RknN8kHrTETTbLL3F3IjifkFvz1pZP5BK84PBWOSGxrlxwDPMHuPM0y +7LhFw0ZT233JB89JuYMtrVqnbdtL37lMUx3+dqU/H2CeEhnpsyWctQItx4byVQDm +G2nrJrmGNPzFQQi/tEQ2WhZseK+PsAxG0c/i5niX3k8u7Q4niefDp+gk+4pX3cF0 +a3l6C3tKDFRr/HnnXPtlQRoHHCh8P7R3Z25R7A4OJMK03X8IMeoqlovSwk8TVn7w +LCTUI44zkTacBEcY1cfSJ3zEJJWgcLUrC5N151W+fNa+9WAohQ7goWgE2OWxi1lj +aWmLhz5KO72hwNGLqGHVVfyd0Iy6WMhGPKDcQ30gOq+9cLV8KHg4oIsDsdgW8O4S +xu2CJhfhP0aTKAO1WFfEWJg1oNcH76J/hUo0EZKfwutajE9onOvEo/7aeQoOfLoI +dUvjdj3ELo3RcGSsh+JQSM0Ldh4V9yVIrBAj42zAnns4S/FcLOHPf/1OiSsArvbE +8QpXm4+vuLw7hM9Ii9+Ii5xtx7tw2dTI6PSESaZF8XcZpFdotBbRvywNwmECAwEA +AQKCAgATpAmSQ3pGNFul6ZUVKoB3DE8+4qZXmNR+j5Z7X5tcxGtMDkcRj3veQpWz +rG2K0/YOeL8KUSXwQb/Fno+ezc6oFfdurx9Z4eqTVYIhqR+H4rt9p0jD5u1YDHEK +yfpC5lWqgnIl8F7HM/wa13muStOEIk5NCIw7Ka3sCyU9nMQnS2izUPNZcNe0bIfP +TVBtQ7YQiL6R348LCsNCoojgAqbBWWdGpbO/dedgmgKQbdx0SPICCiswfMPtosB3 +P+/iP3EdffVuMHpcEkGkNRtmS1nU/9NT83xKBDMHnG8HOmLQNeYVEwonE74Ze9iE +ZmdkJXaXQeXfKx+CtdqC4PEj+cFKCy6VgR1sgY5MZ6PuyRh2PVzodnDTo3BDkHza +PvSxjdvuFZMf6f2F5WxmuOhQ5eyo+LXLsIXml9K/I6XuQcrpDMEpHz92h00TPnD4 +LZZAkFoxZL9/S/Lo+yXhUEBOfE7B9/jGs+Ht2V1mhsD0oCf+3Yo2NQURKqJTJPMv +HrUcerzlOuCTHSSSG2RBwykYmQ8X1BebqNhsAxrUtgj7LM14DhyuqnG+L/xeIYfz +ujO3OTcwK7sTTaLNLLi1NavCU1/eVDp7bn444qp0sNEf45fkcya+4daeTHX4M7L2 +gMj9TCOw53pdKYpLN1aVOVVBFH2p/sR9ekatgOsOB/6+oBsYAQKCAQEA+tixA0A0 +E0ruyMMwKEVN87QtGJzed8IfmtwqG+VUtinrUhSIKpu8VGs8lX+NA5i3dFTD0WIk +8SVO+Grx0e+wjOYFAF+yZs1HorYNpFNeD4lq3skR/QYXCnWl+DSC0Gb1PULApouV +l0zQ8xhaIV928dkDl/Re+NP6qMenLctx8Kt+PQYUJI33fgdCJt3TsjdI4Bmc65oo +ACm9e2SmOmmZSkGQYKac4sRQmgsViAPwS0ho8DRIe87xhj6mTn2cj1AObZXFWzTC +L67TLQFmdfWDUx7/wdndmX4MCWqppR7xt7+ApnYkiXJjvfb5WJ9SRrfItmsrmWGM +fDKs0/CjofQ+QQKCAQEAz35e738cDr6ZI+W0Y4CKuZ84JQzSAx885PhEihOgn3h7 +M0FsfQCVGbCbtUgHoU9NLn5J2YGQ1sxCpbixLKjLrmOwtUQEX81j0UTmi4+P+zHs +rs3UqQLNR5n1kTTqbxQgfKaT7cDt3kk5rAvhRx/h4NIDhsCL9LNvb6cd/A+t/keZ +VdP7WuFk2cbEZKty1LG9SXQqGuvTZ/+tyf5UeIQ/o8n6+1ojEP1ByXyis2qyuk89 +hMK3oAq1YM//6VBrIC19kf95X6yLik55J4eCrG+0pWjcROkhJTlJQp0eyiRgGNRq +KOL8XhfyvnHOslPJeg0ZxHJ6ixooxl0sIwZdS1q8IQKCAQALkhlALCL6zNcM3awH +/4Jj/miiHQJKBeNNUmCC3uY0bOSU6auKQ5rBTh0CTFrl0pKLxCkwLFXF5dGptc0n +wOWk6itK5B8njMqEH9+rN8k78DvEwQOaZ0CC1ABu3YU3NbiUNdMLG58v1nRA8lud +9HhZGYiH5tbGpYiHZoY4n4zG7DIrgG9HbGEBKDaN8meEbfZnl+bcG0VDFKnP2kms +ohhXC4UsYCMWdrW9FUvN9ViNMG7evZqmU1pitdsX/cVN+wRfW6w508otRuQozEq8 +oDGJkQF9IJ6PKPhHKuteWXoO3r+BbiurR2KAbbb8toSmDG4us+zT62L+i5vbPttd +ahXBAoIBADDLkx/XUI3XHMRoXIeZzwXf/6AW57x8OCHQkK239+oIt1BSbmTnIiks +czGqgsDYmVn5sPxJj/ozhujaCjBqcZvNLd0y5aRx9Ktd/KmNVVrJXtOs6/njAst3 +1VwUiZ0dqpYlxlv/JvFDXyCqmovTX5czTEkANumQ2P/02QRR26UUyWZ5t36jyse8 +Cqtx9ks2kUEY5F34X3rxkbkS6mJ9F0o5UaCSjfSM2k+707dFvEo8IEd8Uxp76jOe +NpxzoP2sNP+EiNKLDTW1RqCZKY3LpzvO8R3zhSvv0N6tfHQlIcQ1D9IVryuhjiBj +OyyMr7DYK9sa4N6dhEFB4ANMl9wEtoECggEBAPTG8mUQPPTFYa+0CrDlZlf8fX3N +xN9RZPdEo+ByTHLu9TJhEoY225MYHhj+0F6WmnEkW0mf9bZVB/qAH+1ekETu1YQW +V/z2DYfpdt02fHj9qGQ4xlJ8c/1VUOiZ4KXggCoNUGVIjJybWZp5YBu/YPQF0IFj +r8DZORtz5dJjwqS1knt+mtTbeUKeJSxhOprHQ7Ykv4RLQTP3eXvvoK+5sPYDwnVl +MXt4X9FWtPYbDHraKLosH6/FDpFmmX0hd+9ebeuLFtmjSaGYm/U6voan7Slam5mL +N0q4hnlJpJcbZykOEyUqwLeKDPnTNcrS9nwfd4QXJH5isSU31bnV0elQ1hE= +-----END RSA PRIVATE KEY----- diff --git a/azurerm/internal/services/appplatform/validate/validation.go b/azurerm/internal/services/appplatform/validate/validation.go new file mode 100644 index 000000000000..d7edf0f86892 --- /dev/null +++ b/azurerm/internal/services/appplatform/validate/validation.go @@ -0,0 +1,47 @@ +package validate + +import ( + "fmt" + "strings" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" +) + +func ValidateSpringCloudServiceName(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + return nil, append(errors, fmt.Errorf("expected type of %s to be string", k)) + } + + // The name attribute rules are : + // 1. can contain only lowercase letters, numbers and hyphens. + // 2. The first character must be a letter. + // 3. The last character must be a letter or number + // 3. The value must be between 4 and 32 characters long + + if len(v) < 4 || len(v) > 32 { + errors = append(errors, fmt.Errorf("%s must be between 4 and 32 characters long", k)) + } else { + if m, _ := validate.RegExHelper(i, k, `^([a-z])([a-z\d-]{0,30})([a-z\d])$`); !m { + errors = append(errors, fmt.Errorf("%s must begin with a letter, end with a letter or number, contain only lowercase letters, numbers and hyphens.", k)) + } + } + + return nil, errors +} + +func ValidateConfigServerURI(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + return nil, append(errors, fmt.Errorf("expected type of %s to be string", k)) + } + + // the config server URI should be started with http://, https://, git@, or ssh:// + if !strings.HasPrefix(v, "http://") && + !strings.HasPrefix(v, "https://") && + !strings.HasPrefix(v, "git@") && + !strings.HasPrefix(v, "ssh://") { + errors = append(errors, fmt.Errorf("%s should be started with http://, https://, git@, or ssh://", k)) + } + return nil, errors +} diff --git a/azurerm/internal/services/appplatform/validate/validation_test.go b/azurerm/internal/services/appplatform/validate/validation_test.go new file mode 100644 index 000000000000..bfb4333d364c --- /dev/null +++ b/azurerm/internal/services/appplatform/validate/validation_test.go @@ -0,0 +1,61 @@ +package validate + +import "testing" + +func TestValidateSpringCloudServiceName(t *testing.T) { + testData := []struct { + input string + expected bool + }{ + { + // empty + input: "", + expected: false, + }, + { + // basic example + input: "ab-c", + expected: true, + }, + { + // can't start with a number + input: "1abc", + expected: false, + }, + { + // can't contain underscore + input: "ab_c", + expected: false, + }, + { + // can't end with hyphen + input: "abc-", + expected: false, + }, + { + // can not short than 4 characters + input: "abc", + expected: false, + }, + { + // 32 chars + input: "abcdefghijklmnopqrstuvwxyzabcdef", + expected: true, + }, + { + // 33 chars + input: "abcdefghijklmnopqrstuvwxyzabcdefg", + expected: false, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q..", v.input) + + _, errors := ValidateSpringCloudServiceName(v.input, "name") + actual := len(errors) == 0 + if v.expected != actual { + t.Fatalf("Expected %t but got %t", v.expected, actual) + } + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/apps.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/apps.go new file mode 100644 index 000000000000..e01eeb81b16b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/apps.go @@ -0,0 +1,585 @@ +package appplatform + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AppsClient is the REST API for Azure Spring Cloud +type AppsClient struct { + BaseClient +} + +// NewAppsClient creates an instance of the AppsClient client. +func NewAppsClient(subscriptionID string) AppsClient { + return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppsClientWithBaseURI creates an instance of the AppsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { + return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new App or update an exiting App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// appResource - parameters for the create or update operation +func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (result AppsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: appResource, + Constraints: []validation.Constraint{{Target: "appResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.InclusiveMaximum, Rule: int64(5), Chain: nil}, + {Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + {Target: "appResource.Properties.PersistentDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.AppsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, appResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithJSON(appResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSender(req *http.Request) (future AppsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete an App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an App and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// syncStatus - indicates whether sync status +func (client AppsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (result AppResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, appName, syncStatus) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(syncStatus) > 0 { + queryParameters["syncStatus"] = autorest.Encode("query", syncStatus) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetResourceUploadURL get an resource upload URL for an App, which may be artifacts or source archive. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client AppsClient) GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result ResourceUploadDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetResourceUploadURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetResourceUploadURLPreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetResourceUploadURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", resp, "Failure sending request") + return + } + + result, err = client.GetResourceUploadURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", resp, "Failure responding to request") + } + + return +} + +// GetResourceUploadURLPreparer prepares the GetResourceUploadURL request. +func (client AppsClient) GetResourceUploadURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetResourceUploadURLSender sends the GetResourceUploadURL request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetResourceUploadURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResourceUploadURLResponder handles the response to the GetResourceUploadURL request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResourceUploadURLResponder(resp *http.Response) (result ResourceUploadDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client AppsClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result AppResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List") + defer func() { + sc := -1 + if result.arc.Response.Response != nil { + sc = result.arc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", resp, "Failure sending request") + return + } + + result.arc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppsClient) ListResponder(resp *http.Response) (result AppResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AppsClient) listNextResults(ctx context.Context, lastResults AppResourceCollection) (result AppResourceCollection, err error) { + req, err := lastResults.appResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.AppsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.AppsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result AppResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, serviceName) + return +} + +// Update operation to update an exiting App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// appResource - parameters for the update operation +func (client AppsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (result AppsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, appResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithJSON(appResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSender(req *http.Request) (future AppsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/bindings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/bindings.go new file mode 100644 index 000000000000..bb105e027b32 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/bindings.go @@ -0,0 +1,488 @@ +package appplatform + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BindingsClient is the REST API for Azure Spring Cloud +type BindingsClient struct { + BaseClient +} + +// NewBindingsClient creates an instance of the BindingsClient client. +func NewBindingsClient(subscriptionID string) BindingsClient { + return NewBindingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBindingsClientWithBaseURI creates an instance of the BindingsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBindingsClientWithBaseURI(baseURI string, subscriptionID string) BindingsClient { + return BindingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Binding or update an exiting Binding. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +// bindingResource - parameters for the create or update operation +func (client BindingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (result BindingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, bindingName, bindingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BindingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", pathParameters), + autorest.WithJSON(bindingResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client BindingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client BindingsClient) CreateOrUpdateResponder(resp *http.Response) (result BindingResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete a Binding. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +func (client BindingsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, appName, bindingName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BindingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BindingsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BindingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a Binding and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +func (client BindingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result BindingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, appName, bindingName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BindingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BindingsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BindingsClient) GetResponder(resp *http.Response) (result BindingResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in an App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client BindingsClient) List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result BindingResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.List") + defer func() { + sc := -1 + if result.brc.Response.Response != nil { + sc = result.brc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.brc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "List", resp, "Failure sending request") + return + } + + result.brc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client BindingsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BindingsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BindingsClient) ListResponder(resp *http.Response) (result BindingResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client BindingsClient) listNextResults(ctx context.Context, lastResults BindingResourceCollection) (result BindingResourceCollection, err error) { + req, err := lastResults.bindingResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BindingsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.BindingsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BindingsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result BindingResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, serviceName, appName) + return +} + +// Update operation to update an exiting Binding. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +// bindingResource - parameters for the update operation +func (client BindingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (result BindingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, bindingName, bindingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BindingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", pathParameters), + autorest.WithJSON(bindingResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BindingsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BindingsClient) UpdateResponder(resp *http.Response) (result BindingResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/client.go new file mode 100644 index 000000000000..57360ab1ed28 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/client.go @@ -0,0 +1,52 @@ +// Package appplatform implements the Azure ARM Appplatform service API version 2019-05-01-preview. +// +// REST API for Azure Spring Cloud +package appplatform + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Appplatform + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Appplatform. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/deployments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/deployments.go new file mode 100644 index 000000000000..db9e2ba8c9af --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/deployments.go @@ -0,0 +1,954 @@ +package appplatform + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DeploymentsClient is the REST API for Azure Spring Cloud +type DeploymentsClient struct { + BaseClient +} + +// NewDeploymentsClient creates an instance of the DeploymentsClient client. +func NewDeploymentsClient(subscriptionID string) DeploymentsClient { + return NewDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeploymentsClientWithBaseURI creates an instance of the DeploymentsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient { + return DeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Deployment or update an exiting Deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// deploymentResource - parameters for the create or update operation +func (client DeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (result DeploymentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentResource, + Constraints: []validation.Constraint{{Target: "deploymentResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.CPU", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.CPU", Name: validation.InclusiveMaximum, Rule: int64(4), Chain: nil}, + {Target: "deploymentResource.Properties.DeploymentSettings.CPU", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "deploymentResource.Properties.DeploymentSettings.MemoryInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.MemoryInGB", Name: validation.InclusiveMaximum, Rule: int64(8), Chain: nil}, + {Target: "deploymentResource.Properties.DeploymentSettings.MemoryInGB", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "deploymentResource.Properties.DeploymentSettings.InstanceCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.InstanceCount", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, + {Target: "deploymentResource.Properties.DeploymentSettings.InstanceCount", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.DeploymentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, deploymentResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(deploymentResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future DeploymentsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete a Deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a Deployment and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DeploymentsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GetResponder(resp *http.Response) (result DeploymentResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLogFileURL get deployment log file URL +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) GetLogFileURL(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result LogFileURLResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetLogFileURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetLogFileURLPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogFileURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", resp, "Failure sending request") + return + } + + result, err = client.GetLogFileURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", resp, "Failure responding to request") + } + + return +} + +// GetLogFileURLPreparer prepares the GetLogFileURL request. +func (client DeploymentsClient) GetLogFileURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogFileURLSender sends the GetLogFileURL request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GetLogFileURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogFileURLResponder handles the response to the GetLogFileURL request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GetLogFileURLResponder(resp *http.Response) (result LogFileURLResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in an App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// version - version of the deployments to be listed +func (client DeploymentsClient) List(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result DeploymentResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.List") + defer func() { + sc := -1 + if result.drc.Response.Response != nil { + sc = result.drc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, appName, version) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.drc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", resp, "Failure sending request") + return + } + + result.drc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DeploymentsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if version != nil && len(version) > 0 { + queryParameters["version"] = version + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ListResponder(resp *http.Response) (result DeploymentResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DeploymentsClient) listNextResults(ctx context.Context, lastResults DeploymentResourceCollection) (result DeploymentResourceCollection, err error) { + req, err := lastResults.deploymentResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result DeploymentResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, serviceName, appName, version) + return +} + +// ListClusterAllDeployments list deployments for a certain service +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// version - version of the deployments to be listed +func (client DeploymentsClient) ListClusterAllDeployments(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result DeploymentResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListClusterAllDeployments") + defer func() { + sc := -1 + if result.drc.Response.Response != nil { + sc = result.drc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listClusterAllDeploymentsNextResults + req, err := client.ListClusterAllDeploymentsPreparer(ctx, resourceGroupName, serviceName, version) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListClusterAllDeployments", nil, "Failure preparing request") + return + } + + resp, err := client.ListClusterAllDeploymentsSender(req) + if err != nil { + result.drc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListClusterAllDeployments", resp, "Failure sending request") + return + } + + result.drc, err = client.ListClusterAllDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListClusterAllDeployments", resp, "Failure responding to request") + } + + return +} + +// ListClusterAllDeploymentsPreparer prepares the ListClusterAllDeployments request. +func (client DeploymentsClient) ListClusterAllDeploymentsPreparer(ctx context.Context, resourceGroupName string, serviceName string, version []string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if version != nil && len(version) > 0 { + queryParameters["version"] = version + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClusterAllDeploymentsSender sends the ListClusterAllDeployments request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ListClusterAllDeploymentsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListClusterAllDeploymentsResponder handles the response to the ListClusterAllDeployments request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ListClusterAllDeploymentsResponder(resp *http.Response) (result DeploymentResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listClusterAllDeploymentsNextResults retrieves the next set of results, if any. +func (client DeploymentsClient) listClusterAllDeploymentsNextResults(ctx context.Context, lastResults DeploymentResourceCollection) (result DeploymentResourceCollection, err error) { + req, err := lastResults.deploymentResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listClusterAllDeploymentsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListClusterAllDeploymentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listClusterAllDeploymentsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListClusterAllDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listClusterAllDeploymentsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListClusterAllDeploymentsComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListClusterAllDeploymentsComplete(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result DeploymentResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListClusterAllDeployments") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListClusterAllDeployments(ctx, resourceGroupName, serviceName, version) + return +} + +// Restart restart the deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Restart(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Restart") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RestartPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Restart", nil, "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client DeploymentsClient) RestartPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) RestartSender(req *http.Request) (future DeploymentsRestartFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start start the deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Start(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Start") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client DeploymentsClient) StartPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) StartSender(req *http.Request) (future DeploymentsStartFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stop the deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Stop(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Stop") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client DeploymentsClient) StopPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) StopSender(req *http.Request) (future DeploymentsStopFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update operation to update an exiting Deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// deploymentResource - parameters for the update operation +func (client DeploymentsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (result DeploymentsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, deploymentResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DeploymentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(deploymentResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) UpdateSender(req *http.Request) (future DeploymentsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) UpdateResponder(resp *http.Response) (result DeploymentResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/models.go new file mode 100644 index 000000000000..cf8d8d68fd8a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/models.go @@ -0,0 +1,1746 @@ +package appplatform + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform" + +// AppResourceProvisioningState enumerates the values for app resource provisioning state. +type AppResourceProvisioningState string + +const ( + // Creating ... + Creating AppResourceProvisioningState = "Creating" + // Failed ... + Failed AppResourceProvisioningState = "Failed" + // Succeeded ... + Succeeded AppResourceProvisioningState = "Succeeded" + // Updating ... + Updating AppResourceProvisioningState = "Updating" +) + +// PossibleAppResourceProvisioningStateValues returns an array of possible values for the AppResourceProvisioningState const type. +func PossibleAppResourceProvisioningStateValues() []AppResourceProvisioningState { + return []AppResourceProvisioningState{Creating, Failed, Succeeded, Updating} +} + +// ConfigServerState enumerates the values for config server state. +type ConfigServerState string + +const ( + // ConfigServerStateDeleted ... + ConfigServerStateDeleted ConfigServerState = "Deleted" + // ConfigServerStateFailed ... + ConfigServerStateFailed ConfigServerState = "Failed" + // ConfigServerStateNotAvailable ... + ConfigServerStateNotAvailable ConfigServerState = "NotAvailable" + // ConfigServerStateSucceeded ... + ConfigServerStateSucceeded ConfigServerState = "Succeeded" + // ConfigServerStateUpdating ... + ConfigServerStateUpdating ConfigServerState = "Updating" +) + +// PossibleConfigServerStateValues returns an array of possible values for the ConfigServerState const type. +func PossibleConfigServerStateValues() []ConfigServerState { + return []ConfigServerState{ConfigServerStateDeleted, ConfigServerStateFailed, ConfigServerStateNotAvailable, ConfigServerStateSucceeded, ConfigServerStateUpdating} +} + +// DeploymentResourceProvisioningState enumerates the values for deployment resource provisioning state. +type DeploymentResourceProvisioningState string + +const ( + // DeploymentResourceProvisioningStateCreating ... + DeploymentResourceProvisioningStateCreating DeploymentResourceProvisioningState = "Creating" + // DeploymentResourceProvisioningStateFailed ... + DeploymentResourceProvisioningStateFailed DeploymentResourceProvisioningState = "Failed" + // DeploymentResourceProvisioningStateSucceeded ... + DeploymentResourceProvisioningStateSucceeded DeploymentResourceProvisioningState = "Succeeded" + // DeploymentResourceProvisioningStateUpdating ... + DeploymentResourceProvisioningStateUpdating DeploymentResourceProvisioningState = "Updating" +) + +// PossibleDeploymentResourceProvisioningStateValues returns an array of possible values for the DeploymentResourceProvisioningState const type. +func PossibleDeploymentResourceProvisioningStateValues() []DeploymentResourceProvisioningState { + return []DeploymentResourceProvisioningState{DeploymentResourceProvisioningStateCreating, DeploymentResourceProvisioningStateFailed, DeploymentResourceProvisioningStateSucceeded, DeploymentResourceProvisioningStateUpdating} +} + +// DeploymentResourceStatus enumerates the values for deployment resource status. +type DeploymentResourceStatus string + +const ( + // DeploymentResourceStatusAllocating ... + DeploymentResourceStatusAllocating DeploymentResourceStatus = "Allocating" + // DeploymentResourceStatusCompiling ... + DeploymentResourceStatusCompiling DeploymentResourceStatus = "Compiling" + // DeploymentResourceStatusFailed ... + DeploymentResourceStatusFailed DeploymentResourceStatus = "Failed" + // DeploymentResourceStatusRunning ... + DeploymentResourceStatusRunning DeploymentResourceStatus = "Running" + // DeploymentResourceStatusStopped ... + DeploymentResourceStatusStopped DeploymentResourceStatus = "Stopped" + // DeploymentResourceStatusUnknown ... + DeploymentResourceStatusUnknown DeploymentResourceStatus = "Unknown" + // DeploymentResourceStatusUpgrading ... + DeploymentResourceStatusUpgrading DeploymentResourceStatus = "Upgrading" +) + +// PossibleDeploymentResourceStatusValues returns an array of possible values for the DeploymentResourceStatus const type. +func PossibleDeploymentResourceStatusValues() []DeploymentResourceStatus { + return []DeploymentResourceStatus{DeploymentResourceStatusAllocating, DeploymentResourceStatusCompiling, DeploymentResourceStatusFailed, DeploymentResourceStatusRunning, DeploymentResourceStatusStopped, DeploymentResourceStatusUnknown, DeploymentResourceStatusUpgrading} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted ... + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMoved ... + ProvisioningStateMoved ProvisioningState = "Moved" + // ProvisioningStateMoveFailed ... + ProvisioningStateMoveFailed ProvisioningState = "MoveFailed" + // ProvisioningStateMoving ... + ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoved, ProvisioningStateMoveFailed, ProvisioningStateMoving, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// RuntimeVersion enumerates the values for runtime version. +type RuntimeVersion string + +const ( + // Java11 ... + Java11 RuntimeVersion = "Java_11" + // Java8 ... + Java8 RuntimeVersion = "Java_8" +) + +// PossibleRuntimeVersionValues returns an array of possible values for the RuntimeVersion const type. +func PossibleRuntimeVersionValues() []RuntimeVersion { + return []RuntimeVersion{Java11, Java8} +} + +// TestKeyType enumerates the values for test key type. +type TestKeyType string + +const ( + // Primary ... + Primary TestKeyType = "Primary" + // Secondary ... + Secondary TestKeyType = "Secondary" +) + +// PossibleTestKeyTypeValues returns an array of possible values for the TestKeyType const type. +func PossibleTestKeyTypeValues() []TestKeyType { + return []TestKeyType{Primary, Secondary} +} + +// TraceProxyState enumerates the values for trace proxy state. +type TraceProxyState string + +const ( + // TraceProxyStateFailed ... + TraceProxyStateFailed TraceProxyState = "Failed" + // TraceProxyStateNotAvailable ... + TraceProxyStateNotAvailable TraceProxyState = "NotAvailable" + // TraceProxyStateSucceeded ... + TraceProxyStateSucceeded TraceProxyState = "Succeeded" + // TraceProxyStateUpdating ... + TraceProxyStateUpdating TraceProxyState = "Updating" +) + +// PossibleTraceProxyStateValues returns an array of possible values for the TraceProxyState const type. +func PossibleTraceProxyStateValues() []TraceProxyState { + return []TraceProxyState{TraceProxyStateFailed, TraceProxyStateNotAvailable, TraceProxyStateSucceeded, TraceProxyStateUpdating} +} + +// UserSourceType enumerates the values for user source type. +type UserSourceType string + +const ( + // Jar ... + Jar UserSourceType = "Jar" + // Source ... + Source UserSourceType = "Source" +) + +// PossibleUserSourceTypeValues returns an array of possible values for the UserSourceType const type. +func PossibleUserSourceTypeValues() []UserSourceType { + return []UserSourceType{Jar, Source} +} + +// AppResource app resource payload +type AppResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the App resource + Properties *AppResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// AppResourceCollection object that includes an array of App resources and a possible link for next set +type AppResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of App resources + Value *[]AppResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// AppResourceCollectionIterator provides access to a complete listing of AppResource values. +type AppResourceCollectionIterator struct { + i int + page AppResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AppResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AppResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AppResourceCollectionIterator) Response() AppResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AppResourceCollectionIterator) Value() AppResource { + if !iter.page.NotDone() { + return AppResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppResourceCollectionIterator type. +func NewAppResourceCollectionIterator(page AppResourceCollectionPage) AppResourceCollectionIterator { + return AppResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arc AppResourceCollection) IsEmpty() bool { + return arc.Value == nil || len(*arc.Value) == 0 +} + +// appResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arc AppResourceCollection) appResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if arc.NextLink == nil || len(to.String(arc.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arc.NextLink))) +} + +// AppResourceCollectionPage contains a page of AppResource values. +type AppResourceCollectionPage struct { + fn func(context.Context, AppResourceCollection) (AppResourceCollection, error) + arc AppResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AppResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.arc) + if err != nil { + return err + } + page.arc = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AppResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppResourceCollectionPage) NotDone() bool { + return !page.arc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppResourceCollectionPage) Response() AppResourceCollection { + return page.arc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppResourceCollectionPage) Values() []AppResource { + if page.arc.IsEmpty() { + return nil + } + return *page.arc.Value +} + +// Creates a new instance of the AppResourceCollectionPage type. +func NewAppResourceCollectionPage(getNextPage func(context.Context, AppResourceCollection) (AppResourceCollection, error)) AppResourceCollectionPage { + return AppResourceCollectionPage{fn: getNextPage} +} + +// AppResourceProperties app resource properties payload +type AppResourceProperties struct { + // Public - Indicates whether the App exposes public endpoint + Public *bool `json:"public,omitempty"` + // URL - READ-ONLY; URL of the App + URL *string `json:"url,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the App. Possible values include: 'Succeeded', 'Failed', 'Creating', 'Updating' + ProvisioningState AppResourceProvisioningState `json:"provisioningState,omitempty"` + // ActiveDeploymentName - Name of the active deployment of the App + ActiveDeploymentName *string `json:"activeDeploymentName,omitempty"` + // CreatedTime - READ-ONLY; Date time when the resource is created + CreatedTime *date.Time `json:"createdTime,omitempty"` + // TemporaryDisk - Temporary disk settings + TemporaryDisk *TemporaryDisk `json:"temporaryDisk,omitempty"` + // PersistentDisk - Persistent disk settings + PersistentDisk *PersistentDisk `json:"persistentDisk,omitempty"` +} + +// AppsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *AppsCreateOrUpdateFuture) Result(client AppsClient) (ar AppResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("appplatform.AppsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { + ar, err = client.CreateOrUpdateResponder(ar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsCreateOrUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type AppsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *AppsUpdateFuture) Result(client AppsClient) (ar AppResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("appplatform.AppsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { + ar, err = client.UpdateResponder(ar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") + } + } + return +} + +// AvailableOperations available operations of the service +type AvailableOperations struct { + autorest.Response `json:"-"` + // Value - Collection of available operation details + Value *[]OperationDetail `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// AvailableOperationsIterator provides access to a complete listing of OperationDetail values. +type AvailableOperationsIterator struct { + i int + page AvailableOperationsPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AvailableOperationsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AvailableOperationsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailableOperationsIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AvailableOperationsIterator) Response() AvailableOperations { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AvailableOperationsIterator) Value() OperationDetail { + if !iter.page.NotDone() { + return OperationDetail{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailableOperationsIterator type. +func NewAvailableOperationsIterator(page AvailableOperationsPage) AvailableOperationsIterator { + return AvailableOperationsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ao AvailableOperations) IsEmpty() bool { + return ao.Value == nil || len(*ao.Value) == 0 +} + +// availableOperationsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ao AvailableOperations) availableOperationsPreparer(ctx context.Context) (*http.Request, error) { + if ao.NextLink == nil || len(to.String(ao.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ao.NextLink))) +} + +// AvailableOperationsPage contains a page of OperationDetail values. +type AvailableOperationsPage struct { + fn func(context.Context, AvailableOperations) (AvailableOperations, error) + ao AvailableOperations +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AvailableOperationsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.ao) + if err != nil { + return err + } + page.ao = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AvailableOperationsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailableOperationsPage) NotDone() bool { + return !page.ao.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailableOperationsPage) Response() AvailableOperations { + return page.ao +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailableOperationsPage) Values() []OperationDetail { + if page.ao.IsEmpty() { + return nil + } + return *page.ao.Value +} + +// Creates a new instance of the AvailableOperationsPage type. +func NewAvailableOperationsPage(getNextPage func(context.Context, AvailableOperations) (AvailableOperations, error)) AvailableOperationsPage { + return AvailableOperationsPage{fn: getNextPage} +} + +// BindingResource binding resource payload +type BindingResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Binding resource + Properties *BindingResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// BindingResourceCollection object that includes an array of Binding resources and a possible link for +// next set +type BindingResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Binding resources + Value *[]BindingResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BindingResourceCollectionIterator provides access to a complete listing of BindingResource values. +type BindingResourceCollectionIterator struct { + i int + page BindingResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BindingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BindingResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BindingResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BindingResourceCollectionIterator) Response() BindingResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BindingResourceCollectionIterator) Value() BindingResource { + if !iter.page.NotDone() { + return BindingResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BindingResourceCollectionIterator type. +func NewBindingResourceCollectionIterator(page BindingResourceCollectionPage) BindingResourceCollectionIterator { + return BindingResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brc BindingResourceCollection) IsEmpty() bool { + return brc.Value == nil || len(*brc.Value) == 0 +} + +// bindingResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brc BindingResourceCollection) bindingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if brc.NextLink == nil || len(to.String(brc.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brc.NextLink))) +} + +// BindingResourceCollectionPage contains a page of BindingResource values. +type BindingResourceCollectionPage struct { + fn func(context.Context, BindingResourceCollection) (BindingResourceCollection, error) + brc BindingResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BindingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.brc) + if err != nil { + return err + } + page.brc = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BindingResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BindingResourceCollectionPage) NotDone() bool { + return !page.brc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BindingResourceCollectionPage) Response() BindingResourceCollection { + return page.brc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BindingResourceCollectionPage) Values() []BindingResource { + if page.brc.IsEmpty() { + return nil + } + return *page.brc.Value +} + +// Creates a new instance of the BindingResourceCollectionPage type. +func NewBindingResourceCollectionPage(getNextPage func(context.Context, BindingResourceCollection) (BindingResourceCollection, error)) BindingResourceCollectionPage { + return BindingResourceCollectionPage{fn: getNextPage} +} + +// BindingResourceProperties binding resource properties payload +type BindingResourceProperties struct { + // ResourceName - The name of the bound resource + ResourceName *string `json:"resourceName,omitempty"` + // ResourceType - The standard Azure resource type of the bound resource + ResourceType *string `json:"resourceType,omitempty"` + // ResourceID - The Azure resource id of the bound resource + ResourceID *string `json:"resourceId,omitempty"` + // Key - The key of the bound resource + Key *string `json:"key,omitempty"` + // BindingParameters - Binding parameters of the Binding resource + BindingParameters map[string]interface{} `json:"bindingParameters"` + // GeneratedProperties - READ-ONLY; The generated Spring Boot property file for this binding. The secret will be deducted. + GeneratedProperties *string `json:"generatedProperties,omitempty"` + // CreatedAt - READ-ONLY; Creation time of the Binding resource + CreatedAt *string `json:"createdAt,omitempty"` + // UpdatedAt - READ-ONLY; Update time of the Binding resource + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +// MarshalJSON is the custom marshaler for BindingResourceProperties. +func (brp BindingResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if brp.ResourceName != nil { + objectMap["resourceName"] = brp.ResourceName + } + if brp.ResourceType != nil { + objectMap["resourceType"] = brp.ResourceType + } + if brp.ResourceID != nil { + objectMap["resourceId"] = brp.ResourceID + } + if brp.Key != nil { + objectMap["key"] = brp.Key + } + if brp.BindingParameters != nil { + objectMap["bindingParameters"] = brp.BindingParameters + } + return json.Marshal(objectMap) +} + +// CloudError an error response from the service. +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// ClusterResourceProperties service properties payload +type ClusterResourceProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the Service. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving', 'ProvisioningStateMoved', 'ProvisioningStateMoveFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ConfigServerProperties - Config server git properties of the Service + ConfigServerProperties *ConfigServerProperties `json:"configServerProperties,omitempty"` + // Trace - Trace properties of the Service + Trace *TraceProperties `json:"trace,omitempty"` + // Version - READ-ONLY; Version of the Service + Version *int32 `json:"version,omitempty"` + // ServiceID - READ-ONLY; ServiceInstanceEntity GUID which uniquely identifies a created resource + ServiceID *string `json:"serviceId,omitempty"` +} + +// ConfigServerGitProperty property of git. +type ConfigServerGitProperty struct { + // Repositories - Repositories of git. + Repositories *[]GitPatternRepository `json:"repositories,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// ConfigServerProperties config server git properties payload +type ConfigServerProperties struct { + // State - READ-ONLY; State of the config server. Possible values include: 'ConfigServerStateNotAvailable', 'ConfigServerStateDeleted', 'ConfigServerStateFailed', 'ConfigServerStateSucceeded', 'ConfigServerStateUpdating' + State ConfigServerState `json:"state,omitempty"` + // Error - Error when apply config server settings. + Error *Error `json:"error,omitempty"` + // ConfigServer - Settings of config server. + ConfigServer *ConfigServerSettings `json:"configServer,omitempty"` +} + +// ConfigServerSettings the settings of config server. +type ConfigServerSettings struct { + // GitProperty - Property of git environment. + GitProperty *ConfigServerGitProperty `json:"gitProperty,omitempty"` +} + +// DeploymentInstance deployment instance payload +type DeploymentInstance struct { + // Name - READ-ONLY; Name of the deployment instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the deployment instance + Status *string `json:"status,omitempty"` + // Reason - READ-ONLY; Failed reason of the deployment instance + Reason *string `json:"reason,omitempty"` + // DiscoveryStatus - READ-ONLY; Discovery status of the deployment instance + DiscoveryStatus *string `json:"discoveryStatus,omitempty"` +} + +// DeploymentResource deployment resource payload +type DeploymentResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Deployment resource + Properties *DeploymentResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// DeploymentResourceCollection object that includes an array of App resources and a possible link for next +// set +type DeploymentResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Deployment resources + Value *[]DeploymentResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeploymentResourceCollectionIterator provides access to a complete listing of DeploymentResource values. +type DeploymentResourceCollectionIterator struct { + i int + page DeploymentResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeploymentResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DeploymentResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeploymentResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeploymentResourceCollectionIterator) Response() DeploymentResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeploymentResourceCollectionIterator) Value() DeploymentResource { + if !iter.page.NotDone() { + return DeploymentResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeploymentResourceCollectionIterator type. +func NewDeploymentResourceCollectionIterator(page DeploymentResourceCollectionPage) DeploymentResourceCollectionIterator { + return DeploymentResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (drc DeploymentResourceCollection) IsEmpty() bool { + return drc.Value == nil || len(*drc.Value) == 0 +} + +// deploymentResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (drc DeploymentResourceCollection) deploymentResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if drc.NextLink == nil || len(to.String(drc.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(drc.NextLink))) +} + +// DeploymentResourceCollectionPage contains a page of DeploymentResource values. +type DeploymentResourceCollectionPage struct { + fn func(context.Context, DeploymentResourceCollection) (DeploymentResourceCollection, error) + drc DeploymentResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeploymentResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.drc) + if err != nil { + return err + } + page.drc = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DeploymentResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeploymentResourceCollectionPage) NotDone() bool { + return !page.drc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeploymentResourceCollectionPage) Response() DeploymentResourceCollection { + return page.drc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeploymentResourceCollectionPage) Values() []DeploymentResource { + if page.drc.IsEmpty() { + return nil + } + return *page.drc.Value +} + +// Creates a new instance of the DeploymentResourceCollectionPage type. +func NewDeploymentResourceCollectionPage(getNextPage func(context.Context, DeploymentResourceCollection) (DeploymentResourceCollection, error)) DeploymentResourceCollectionPage { + return DeploymentResourceCollectionPage{fn: getNextPage} +} + +// DeploymentResourceProperties deployment resource properties payload +type DeploymentResourceProperties struct { + // Source - Uploaded source information of the deployment. + Source *UserSourceInfo `json:"source,omitempty"` + // AppName - READ-ONLY; App name of the deployment + AppName *string `json:"appName,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Deployment. Possible values include: 'DeploymentResourceProvisioningStateCreating', 'DeploymentResourceProvisioningStateUpdating', 'DeploymentResourceProvisioningStateSucceeded', 'DeploymentResourceProvisioningStateFailed' + ProvisioningState DeploymentResourceProvisioningState `json:"provisioningState,omitempty"` + // DeploymentSettings - Deployment settings of the Deployment + DeploymentSettings *DeploymentSettings `json:"deploymentSettings,omitempty"` + // Status - READ-ONLY; Status of the Deployment. Possible values include: 'DeploymentResourceStatusUnknown', 'DeploymentResourceStatusStopped', 'DeploymentResourceStatusRunning', 'DeploymentResourceStatusFailed', 'DeploymentResourceStatusAllocating', 'DeploymentResourceStatusUpgrading', 'DeploymentResourceStatusCompiling' + Status DeploymentResourceStatus `json:"status,omitempty"` + // Active - READ-ONLY; Indicates whether the Deployment is active + Active *bool `json:"active,omitempty"` + // CreatedTime - READ-ONLY; Date time when the resource is created + CreatedTime *date.Time `json:"createdTime,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to the Deployment + Instances *[]DeploymentInstance `json:"instances,omitempty"` +} + +// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) (dr DeploymentResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dr.Response.Response, err = future.GetResult(sender); err == nil && dr.Response.Response.StatusCode != http.StatusNoContent { + dr, err = client.CreateOrUpdateResponder(dr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsCreateOrUpdateFuture", "Result", dr.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentSettings deployment settings payload +type DeploymentSettings struct { + // CPU - Required CPU + CPU *int32 `json:"cpu,omitempty"` + // MemoryInGB - Required Memory size in GB + MemoryInGB *int32 `json:"memoryInGB,omitempty"` + // JvmOptions - JVM parameter + JvmOptions *string `json:"jvmOptions,omitempty"` + // InstanceCount - Instance count + InstanceCount *int32 `json:"instanceCount,omitempty"` + // EnvironmentVariables - Collection of environment variables + EnvironmentVariables map[string]*string `json:"environmentVariables"` + // RuntimeVersion - Runtime version. Possible values include: 'Java8', 'Java11' + RuntimeVersion RuntimeVersion `json:"runtimeVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentSettings. +func (ds DeploymentSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ds.CPU != nil { + objectMap["cpu"] = ds.CPU + } + if ds.MemoryInGB != nil { + objectMap["memoryInGB"] = ds.MemoryInGB + } + if ds.JvmOptions != nil { + objectMap["jvmOptions"] = ds.JvmOptions + } + if ds.InstanceCount != nil { + objectMap["instanceCount"] = ds.InstanceCount + } + if ds.EnvironmentVariables != nil { + objectMap["environmentVariables"] = ds.EnvironmentVariables + } + if ds.RuntimeVersion != "" { + objectMap["runtimeVersion"] = ds.RuntimeVersion + } + return json.Marshal(objectMap) +} + +// DeploymentsRestartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsRestartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DeploymentsRestartFuture) Result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsRestartFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsStartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DeploymentsStartFuture) Result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsStopFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DeploymentsStopFuture) Result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStopFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DeploymentsUpdateFuture) Result(client DeploymentsClient) (dr DeploymentResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dr.Response.Response, err = future.GetResult(sender); err == nil && dr.Response.Response.StatusCode != http.StatusNoContent { + dr, err = client.UpdateResponder(dr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsUpdateFuture", "Result", dr.Response.Response, "Failure responding to request") + } + } + return +} + +// Error the error code compose of code and message. +type Error struct { + // Code - The code of error. + Code *string `json:"code,omitempty"` + // Message - The message of error. + Message *string `json:"message,omitempty"` +} + +// GitPatternRepository git repository property payload +type GitPatternRepository struct { + // Name - Name of the repository + Name *string `json:"name,omitempty"` + // Pattern - Collection of pattern of the repository + Pattern *[]string `json:"pattern,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// LogFileURLResponse log file URL payload +type LogFileURLResponse struct { + autorest.Response `json:"-"` + // URL - URL of the log file + URL *string `json:"url,omitempty"` +} + +// LogSpecification specifications of the Log for Azure Monitoring +type LogSpecification struct { + // Name - Name of the log + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the log + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Blob duration of the log + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// MetricDimension specifications of the Dimension of metrics +type MetricDimension struct { + // Name - Name of the dimension + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the dimension + DisplayName *string `json:"displayName,omitempty"` +} + +// MetricSpecification specifications of the Metrics for Azure Monitoring +type MetricSpecification struct { + // Name - Name of the metric + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the metric + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Localized friendly description of the metric + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - Unit that makes sense for the metric + Unit *string `json:"unit,omitempty"` + // Category - Name of the metric category that the metric belongs to. A metric can only belong to a single category. + Category *string `json:"category,omitempty"` + // AggregationType - Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. + AggregationType *string `json:"aggregationType,omitempty"` + // SupportedAggregationTypes - Supported aggregation types + SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` + // SupportedTimeGrainTypes - Supported time grain types + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + // FillGapWithZero - Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // Dimensions - Dimensions of the metric + Dimensions *[]MetricDimension `json:"dimensions,omitempty"` +} + +// NameAvailability name availability result payload +type NameAvailability struct { + autorest.Response `json:"-"` + // NameAvailable - Indicates whether the name is available + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - Reason why the name is not available + Reason *string `json:"reason,omitempty"` + // Message - Message why the name is not available + Message *string `json:"message,omitempty"` +} + +// NameAvailabilityParameters name availability parameters payload +type NameAvailabilityParameters struct { + // Type - Type of the resource to check name availability + Type *string `json:"type,omitempty"` + // Name - Name to be checked + Name *string `json:"name,omitempty"` +} + +// OperationDetail operation detail payload +type OperationDetail struct { + // Name - Name of the operation + Name *string `json:"name,omitempty"` + // DataAction - Indicates whether the operation is a data action + DataAction *bool `json:"dataAction,omitempty"` + // Display - Display of the operation + Display *OperationDisplay `json:"display,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` + // Properties - Properties of the operation + Properties *OperationProperties `json:"properties,omitempty"` +} + +// OperationDisplay operation display payload +type OperationDisplay struct { + // Provider - Resource provider of the operation + Provider *string `json:"provider,omitempty"` + // Resource - Resource of the operation + Resource *string `json:"resource,omitempty"` + // Operation - Localized friendly name for the operation + Operation *string `json:"operation,omitempty"` + // Description - Localized friendly description for the operation + Description *string `json:"description,omitempty"` +} + +// OperationProperties extra Operation properties +type OperationProperties struct { + // ServiceSpecification - Service specifications of the operation + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// PersistentDisk persistent disk payload +type PersistentDisk struct { + // SizeInGB - Size of the persistent disk in GB + SizeInGB *int32 `json:"sizeInGB,omitempty"` + // UsedInGB - READ-ONLY; Size of the used persistent disk in GB + UsedInGB *int32 `json:"usedInGB,omitempty"` + // MountPath - Mount path of the persistent disk + MountPath *string `json:"mountPath,omitempty"` +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags. +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// RegenerateTestKeyRequestPayload regenerate test key request payload +type RegenerateTestKeyRequestPayload struct { + // KeyType - Type of the test key. Possible values include: 'Primary', 'Secondary' + KeyType TestKeyType `json:"keyType,omitempty"` +} + +// Resource the core properties of ARM resources. +type Resource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// ResourceUploadDefinition resource upload definition payload +type ResourceUploadDefinition struct { + autorest.Response `json:"-"` + // RelativePath - Source relative path + RelativePath *string `json:"relativePath,omitempty"` + // UploadURL - Upload URL + UploadURL *string `json:"uploadUrl,omitempty"` +} + +// ServiceResource service resource +type ServiceResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Service resource + Properties *ClusterResourceProperties `json:"properties,omitempty"` + // Location - The GEO location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceResource. +func (sr ServiceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Properties != nil { + objectMap["properties"] = sr.Properties + } + if sr.Location != nil { + objectMap["location"] = sr.Location + } + if sr.Tags != nil { + objectMap["tags"] = sr.Tags + } + return json.Marshal(objectMap) +} + +// ServiceResourceList object that includes an array of Service resources and a possible link for next set +type ServiceResourceList struct { + autorest.Response `json:"-"` + // Value - Collection of Service resources + Value *[]ServiceResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceResourceListIterator provides access to a complete listing of ServiceResource values. +type ServiceResourceListIterator struct { + i int + page ServiceResourceListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceResourceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServiceResourceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceResourceListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceResourceListIterator) Response() ServiceResourceList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceResourceListIterator) Value() ServiceResource { + if !iter.page.NotDone() { + return ServiceResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceResourceListIterator type. +func NewServiceResourceListIterator(page ServiceResourceListPage) ServiceResourceListIterator { + return ServiceResourceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srl ServiceResourceList) IsEmpty() bool { + return srl.Value == nil || len(*srl.Value) == 0 +} + +// serviceResourceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srl ServiceResourceList) serviceResourceListPreparer(ctx context.Context) (*http.Request, error) { + if srl.NextLink == nil || len(to.String(srl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srl.NextLink))) +} + +// ServiceResourceListPage contains a page of ServiceResource values. +type ServiceResourceListPage struct { + fn func(context.Context, ServiceResourceList) (ServiceResourceList, error) + srl ServiceResourceList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceResourceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.srl) + if err != nil { + return err + } + page.srl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServiceResourceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceResourceListPage) NotDone() bool { + return !page.srl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceResourceListPage) Response() ServiceResourceList { + return page.srl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceResourceListPage) Values() []ServiceResource { + if page.srl.IsEmpty() { + return nil + } + return *page.srl.Value +} + +// Creates a new instance of the ServiceResourceListPage type. +func NewServiceResourceListPage(getNextPage func(context.Context, ServiceResourceList) (ServiceResourceList, error)) ServiceResourceListPage { + return ServiceResourceListPage{fn: getNextPage} +} + +// ServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServicesCreateOrUpdateFuture) Result(client ServicesClient) (sr ServiceResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.CreateOrUpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// ServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServicesDeleteFuture) Result(client ServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServiceSpecification service specification payload +type ServiceSpecification struct { + // LogSpecifications - Specifications of the Log for Azure Monitoring + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` + // MetricSpecifications - Specifications of the Metrics for Azure Monitoring + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ServicesUpdateFuture) Result(client ServicesClient) (sr ServiceResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.UpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// TemporaryDisk temporary disk payload +type TemporaryDisk struct { + // SizeInGB - Size of the temporary disk in GB + SizeInGB *int32 `json:"sizeInGB,omitempty"` + // MountPath - Mount path of the temporary disk + MountPath *string `json:"mountPath,omitempty"` +} + +// TestKeys test keys payload +type TestKeys struct { + autorest.Response `json:"-"` + // PrimaryKey - Primary key + PrimaryKey *string `json:"primaryKey,omitempty"` + // SecondaryKey - Secondary key + SecondaryKey *string `json:"secondaryKey,omitempty"` + // PrimaryTestEndpoint - Primary test endpoint + PrimaryTestEndpoint *string `json:"primaryTestEndpoint,omitempty"` + // SecondaryTestEndpoint - Secondary test endpoint + SecondaryTestEndpoint *string `json:"secondaryTestEndpoint,omitempty"` + // Enabled - Indicates whether the test endpoint feature enabled or not + Enabled *bool `json:"enabled,omitempty"` +} + +// TraceProperties trace properties payload +type TraceProperties struct { + // State - READ-ONLY; State of the trace proxy. Possible values include: 'TraceProxyStateNotAvailable', 'TraceProxyStateFailed', 'TraceProxyStateSucceeded', 'TraceProxyStateUpdating' + State TraceProxyState `json:"state,omitempty"` + // Error - Error when apply trace proxy changes. + Error *Error `json:"error,omitempty"` + // Enabled - Indicates whether enable the tracing functionality + Enabled *bool `json:"enabled,omitempty"` + // AppInsightInstrumentationKey - Target application insight instrumentation key + AppInsightInstrumentationKey *string `json:"appInsightInstrumentationKey,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource. +type TrackedResource struct { + // Location - The GEO location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// UserSourceInfo source information for a deployment +type UserSourceInfo struct { + // Type - Type of the source uploaded. Possible values include: 'Jar', 'Source' + Type UserSourceType `json:"type,omitempty"` + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // ArtifactSelector - Selector for the artifact to be used for the deployment for multi-module projects. This should be + // the relative path to the target module/project. + ArtifactSelector *string `json:"artifactSelector,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/operations.go new file mode 100644 index 000000000000..4d5997f30742 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/operations.go @@ -0,0 +1,147 @@ +package appplatform + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the REST API for Azure Spring Cloud +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available REST API operations of the Microsoft.AppPlatform provider. +func (client OperationsClient) List(ctx context.Context) (result AvailableOperationsPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.ao.Response.Response != nil { + sc = result.ao.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ao.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.ao, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.AppPlatform/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result AvailableOperations, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults AvailableOperations) (result AvailableOperations, err error) { + req, err := lastResults.availableOperationsPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result AvailableOperationsIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/services.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/services.go new file mode 100644 index 000000000000..794a9214a28b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/services.go @@ -0,0 +1,985 @@ +package appplatform + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServicesClient is the REST API for Azure Spring Cloud +type ServicesClient struct { + BaseClient +} + +// NewServicesClient creates an instance of the ServicesClient client. +func NewServicesClient(subscriptionID string) ServicesClient { + return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServicesClientWithBaseURI creates an instance of the ServicesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { + return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks that the resource name is valid and is not already in use. +// Parameters: +// location - the region +// availabilityParameters - parameters supplied to the operation. +func (client ServicesClient) CheckNameAvailability(ctx context.Context, location string, availabilityParameters NameAvailabilityParameters) (result NameAvailability, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: availabilityParameters, + Constraints: []validation.Constraint{{Target: "availabilityParameters.Type", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "availabilityParameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("appplatform.ServicesClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, location, availabilityParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ServicesClient) CheckNameAvailabilityPreparer(ctx context.Context, location string, availabilityParameters NameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", pathParameters), + autorest.WithJSON(availabilityParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result NameAvailability, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create a new Service or update an exiting Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// resource - parameters for the create or update operation +func (client ServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (result ServicesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resource, + Constraints: []validation.Constraint{{Target: "resource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "resource.Properties.ConfigServerProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "resource.Properties.ConfigServerProperties.ConfigServer", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "resource.Properties.ConfigServerProperties.ConfigServer.GitProperty", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "resource.Properties.ConfigServerProperties.ConfigServer.GitProperty.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.ServicesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", pathParameters), + autorest.WithJSON(resource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (future ServicesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string) (result ServicesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) DeleteSender(req *http.Request) (future ServicesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisableTestEndpoint sends the disable test endpoint request. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) DisableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.DisableTestEndpoint") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisableTestEndpointPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "DisableTestEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.DisableTestEndpointSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "DisableTestEndpoint", resp, "Failure sending request") + return + } + + result, err = client.DisableTestEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "DisableTestEndpoint", resp, "Failure responding to request") + } + + return +} + +// DisableTestEndpointPreparer prepares the DisableTestEndpoint request. +func (client ServicesClient) DisableTestEndpointPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableTestEndpointSender sends the DisableTestEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) DisableTestEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableTestEndpointResponder handles the response to the DisableTestEndpoint request. The method always +// closes the http.Response Body. +func (client ServicesClient) DisableTestEndpointResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// EnableTestEndpoint sends the enable test endpoint request. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) EnableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result TestKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.EnableTestEndpoint") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.EnableTestEndpointPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "EnableTestEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.EnableTestEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "EnableTestEndpoint", resp, "Failure sending request") + return + } + + result, err = client.EnableTestEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "EnableTestEndpoint", resp, "Failure responding to request") + } + + return +} + +// EnableTestEndpointPreparer prepares the EnableTestEndpoint request. +func (client ServicesClient) EnableTestEndpointPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableTestEndpointSender sends the EnableTestEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) EnableTestEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// EnableTestEndpointResponder handles the response to the EnableTestEndpoint request. The method always +// closes the http.Response Body. +func (client ServicesClient) EnableTestEndpointResponder(resp *http.Response) (result TestKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get a Service and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServicesClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +func (client ServicesClient) List(ctx context.Context, resourceGroupName string) (result ServiceResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List") + defer func() { + sc := -1 + if result.srl.Response.Response != nil { + sc = result.srl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.srl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "List", resp, "Failure sending request") + return + } + + result.srl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ServicesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListResponder(resp *http.Response) (result ServiceResourceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ServicesClient) listNextResults(ctx context.Context, lastResults ServiceResourceList) (result ServiceResourceList, err error) { + req, err := lastResults.serviceResourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServicesClient) ListComplete(ctx context.Context, resourceGroupName string) (result ServiceResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListBySubscription handles requests to list all resources in a subscription. +func (client ServicesClient) ListBySubscription(ctx context.Context) (result ServiceResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListBySubscription") + defer func() { + sc := -1 + if result.srl.Response.Response != nil { + sc = result.srl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.srl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.srl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ServicesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListBySubscriptionResponder(resp *http.Response) (result ServiceResourceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client ServicesClient) listBySubscriptionNextResults(ctx context.Context, lastResults ServiceResourceList) (result ServiceResourceList, err error) { + req, err := lastResults.serviceResourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServicesClient) ListBySubscriptionComplete(ctx context.Context) (result ServiceResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// ListTestKeys list test keys for a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) ListTestKeys(ctx context.Context, resourceGroupName string, serviceName string) (result TestKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListTestKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListTestKeysPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListTestKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListTestKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListTestKeys", resp, "Failure sending request") + return + } + + result, err = client.ListTestKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListTestKeys", resp, "Failure responding to request") + } + + return +} + +// ListTestKeysPreparer prepares the ListTestKeys request. +func (client ServicesClient) ListTestKeysPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTestKeysSender sends the ListTestKeys request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListTestKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListTestKeysResponder handles the response to the ListTestKeys request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListTestKeysResponder(resp *http.Response) (result TestKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateTestKey regenerate a test key for a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// regenerateTestKeyRequest - parameters for the operation +func (client ServicesClient) RegenerateTestKey(ctx context.Context, resourceGroupName string, serviceName string, regenerateTestKeyRequest RegenerateTestKeyRequestPayload) (result TestKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.RegenerateTestKey") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RegenerateTestKeyPreparer(ctx, resourceGroupName, serviceName, regenerateTestKeyRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "RegenerateTestKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateTestKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "RegenerateTestKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateTestKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "RegenerateTestKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateTestKeyPreparer prepares the RegenerateTestKey request. +func (client ServicesClient) RegenerateTestKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, regenerateTestKeyRequest RegenerateTestKeyRequestPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", pathParameters), + autorest.WithJSON(regenerateTestKeyRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateTestKeySender sends the RegenerateTestKey request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) RegenerateTestKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateTestKeyResponder handles the response to the RegenerateTestKey request. The method always +// closes the http.Response Body. +func (client ServicesClient) RegenerateTestKeyResponder(resp *http.Response) (result TestKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update operation to update an exiting Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// resource - parameters for the update operation +func (client ServicesClient) Update(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (result ServicesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ServicesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", pathParameters), + autorest.WithJSON(resource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) UpdateSender(req *http.Request) (future ServicesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ServicesClient) UpdateResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/version.go new file mode 100644 index 000000000000..ae12ebc2af4d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/version.go @@ -0,0 +1,30 @@ +package appplatform + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + version.Number + " appplatform/2019-05-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 4a743317c760..c54d03cc3beb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -52,6 +52,7 @@ github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/noti github.com/Azure/azure-sdk-for-go/services/policyinsights/mgmt/2019-10-01/policyinsights github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql github.com/Azure/azure-sdk-for-go/services/powerbidedicated/mgmt/2017-10-01/powerbidedicated +github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-09-01-preview/authorization github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2018-07-12/botservice github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders diff --git a/website/allowed-subcategories b/website/allowed-subcategories index 05237313ad8c..d1c2c34478fa 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -1,6 +1,7 @@ API Management Analysis Services App Configuration +App Platform App Service (Web Apps) Application Insights Authorization diff --git a/website/azurerm.erb b/website/azurerm.erb index 78e20de0d572..0cd4a6ae675f 100644 --- a/website/azurerm.erb +++ b/website/azurerm.erb @@ -498,6 +498,10 @@ azurerm_snapshot +