diff --git a/azurerm/data_source_spring_cloud.go b/azurerm/data_source_spring_cloud.go new file mode 100644 index 0000000000000..619222a8933c0 --- /dev/null +++ b/azurerm/data_source_spring_cloud.go @@ -0,0 +1,74 @@ +package azurerm + +import ( + "fmt" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" + + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" + azappplatform "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/appplatform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func dataSourceArmSpringCloud() *schema.Resource { + return &schema.Resource{ + Read: dataSourceArmSpringCloudRead, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: azappplatform.ValidateSpringCloudName, + }, + + "location": azure.SchemaLocationForDataSource(), + + "resource_group_name": azure.SchemaResourceGroupNameForDataSource(), + + "service_id": { + Type: schema.TypeString, + Computed: true, + }, + + "version": { + Type: schema.TypeInt, + Computed: true, + }, + + "tags": tags.SchemaDataSource(), + }, + } +} + +func dataSourceArmSpringCloudRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForRead(meta.(*ArmClient).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) + } + + 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 clusterResourceProperties := resp.Properties; clusterResourceProperties != nil { + d.Set("service_id", clusterResourceProperties.ServiceID) + d.Set("version", int(*clusterResourceProperties.Version)) + } + + return nil +} diff --git a/azurerm/data_source_spring_cloud_config_server.go b/azurerm/data_source_spring_cloud_config_server.go new file mode 100644 index 0000000000000..844ad07642b8c --- /dev/null +++ b/azurerm/data_source_spring_cloud_config_server.go @@ -0,0 +1,168 @@ +package azurerm + +import ( + "fmt" + + "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/timeouts" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func dataSourceArmSpringCloudConfigServer() *schema.Resource { + return &schema.Resource{ + Read: dataSourceArmSpringCloudConfigServerRead, + + Schema: map[string]*schema.Schema{ + "spring_cloud_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azure.ValidateResourceID, + }, + + "uri": { + Type: schema.TypeString, + Computed: true, + }, + "host_key": { + Type: schema.TypeString, + Computed: true, + }, + "host_key_algorithm": { + Type: schema.TypeString, + Computed: true, + }, + "label": { + Type: schema.TypeString, + Computed: true, + }, + "password": { + Type: schema.TypeString, + Computed: true, + Sensitive: true, + }, + "private_key": { + Type: schema.TypeString, + 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, + }, + "host_key": { + Type: schema.TypeString, + Computed: true, + }, + "host_key_algorithm": { + Type: schema.TypeString, + Computed: true, + }, + "label": { + Type: schema.TypeString, + Computed: true, + }, + "password": { + Type: schema.TypeString, + Computed: true, + Sensitive: true, + }, + "pattern": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "private_key": { + Type: schema.TypeString, + Computed: true, + }, + "search_paths": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "strict_host_key_checking": { + Type: schema.TypeBool, + Computed: true, + }, + "username": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "search_paths": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "strict_host_key_checking": { + Type: schema.TypeBool, + Computed: true, + }, + "username": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataSourceArmSpringCloudConfigServerRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForRead(meta.(*ArmClient).StopContext, d) + defer cancel() + + springCloudId := d.Get("spring_cloud_id").(string) + id, err := azure.ParseAzureResourceID(springCloudId) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + springCloudName := id.Path["Spring"] + + resp, err := client.Get(ctx, resourceGroup, springCloudName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("Error: Spring Cloud %q (Resource Group %q) was not found", springCloudName, resourceGroup) + } + return fmt.Errorf("Error reading Spring Cloud %q (Resource Group %q): %+v", springCloudName, resourceGroup, err) + } + + d.SetId(springCloudId) + + if resp.Properties != nil && resp.Properties.ConfigServerProperties != nil && resp.Properties.ConfigServerProperties.ConfigServer != nil { + if props := resp.Properties.ConfigServerProperties.ConfigServer.GitProperty; props != nil { + d.Set("host_key", props.HostKey) + d.Set("host_key_algorithm", props.HostKeyAlgorithm) + d.Set("label", props.Label) + d.Set("password", props.Password) + d.Set("private_key", props.PrivateKey) + d.Set("strict_host_key_checking", props.StrictHostKeyChecking) + d.Set("uri", props.URI) + d.Set("username", props.Username) + d.Set("search_paths", props.SearchPaths) + if err := d.Set("repositories", flattenArmSpringCloudGitPatternRepository(props.Repositories)); err != nil { + return fmt.Errorf("Error setting `repositories`: %+v", err) + } + } + } + + return nil +} diff --git a/azurerm/data_source_spring_cloud_config_server_test.go b/azurerm/data_source_spring_cloud_config_server_test.go new file mode 100644 index 0000000000000..34b8ce3e74842 --- /dev/null +++ b/azurerm/data_source_spring_cloud_config_server_test.go @@ -0,0 +1,57 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" +) + +func TestAccDataSourceAzureRMSpringCloudConfigServer_complete(t *testing.T) { + dataSourceName := "data.azurerm_spring_cloud_config_server.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceSpringCloudConfigServer_complete(ri, location), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(dataSourceName, "id"), + resource.TestCheckResourceAttr(dataSourceName, "uri", "https://github.com/Azure-Samples/piggymetrics"), + resource.TestCheckResourceAttr(dataSourceName, "label", "config"), + resource.TestCheckResourceAttr(dataSourceName, "search_paths.#", "2"), + resource.TestCheckResourceAttr(dataSourceName, "search_paths.0", "dir1"), + resource.TestCheckResourceAttr(dataSourceName, "search_paths.1", "dir2"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.#", "2"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.0.name", "repo1"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.0.uri", "https://github.com/Azure-Samples/piggymetrics"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.0.label", "config"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.0.search_paths.#", "2"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.0.search_paths.0", "dir1"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.0.search_paths.1", "dir2"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.1.name", "repo2"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.1.uri", "https://github.com/Azure-Samples/piggymetrics"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.1.label", "config"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.1.search_paths.#", "2"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.1.search_paths.0", "dir1"), + resource.TestCheckResourceAttr(dataSourceName, "repositories.1.search_paths.1", "dir2"), + ), + }, + }, + }) +} + +func testAccDataSourceSpringCloudConfigServer_complete(rInt int, location string) string { + config := testAccAzureRMSpringCloudConfigServer_complete(rInt, location) + return fmt.Sprintf(` +%s + +data "azurerm_spring_cloud_config_server" "test" { + spring_cloud_id = azurerm_spring_cloud.test.id +} +`, config) +} diff --git a/azurerm/data_source_spring_cloud_test.go b/azurerm/data_source_spring_cloud_test.go new file mode 100644 index 0000000000000..1810411f572b9 --- /dev/null +++ b/azurerm/data_source_spring_cloud_test.go @@ -0,0 +1,45 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" +) + +func TestAccDataSourceAzureRMSpringCloud_complete(t *testing.T) { + dataSourceName := "data.azurerm_spring_cloud.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceSpringCloud_complete(ri, location), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(dataSourceName, "id"), + resource.TestCheckResourceAttrSet(dataSourceName, "service_id"), + resource.TestCheckResourceAttrSet(dataSourceName, "version"), + resource.TestCheckResourceAttr(dataSourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(dataSourceName, "tags.env", "test"), + resource.TestCheckResourceAttr(dataSourceName, "tags.version", "1"), + ), + }, + }, + }) +} + +func testAccDataSourceSpringCloud_complete(rInt int, location string) string { + config := testAccAzureRMSpringCloud_complete(rInt, location) + return fmt.Sprintf(` +%s + +data "azurerm_spring_cloud" "test" { + name = azurerm_spring_cloud.test.name + resource_group_name = azurerm_spring_cloud.test.resource_group_name +} +`, config) +} diff --git a/azurerm/internal/clients/client.go b/azurerm/internal/clients/client.go index 98f5d210aeb0e..f2e518c401cfa 100644 --- a/azurerm/internal/clients/client.go +++ b/azurerm/internal/clients/client.go @@ -8,6 +8,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" @@ -77,6 +78,7 @@ type Client struct { ApiManagement *apiManagement.Client AppConfiguration *appConfiguration.Client AppInsights *applicationInsights.Client + AppPlatform *appPlatform.Client Authorization *authorization.Client Automation *automation.Client Batch *batch.Client @@ -141,6 +143,7 @@ func (client *Client) Build(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/services/appplatform/client/client.go b/azurerm/internal/services/appplatform/client/client.go new file mode 100644 index 0000000000000..b5d83e2157b27 --- /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/registration.go b/azurerm/internal/services/appplatform/registration.go new file mode 100644 index 0000000000000..7480a14e5ef50 --- /dev/null +++ b/azurerm/internal/services/appplatform/registration.go @@ -0,0 +1,22 @@ +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" +} + +// SupportedDataSources returns the supported Data Sources supported by this Service +func (r Registration) SupportedDataSources() map[string]*schema.Resource { + return map[string]*schema.Resource{} +} + +// SupportedResources returns the supported Resources supported by this Service +func (r Registration) SupportedResources() map[string]*schema.Resource { + return map[string]*schema.Resource{} +} diff --git a/azurerm/internal/services/appplatform/validate.go b/azurerm/internal/services/appplatform/validate.go new file mode 100644 index 0000000000000..88a0dfa3f563b --- /dev/null +++ b/azurerm/internal/services/appplatform/validate.go @@ -0,0 +1,47 @@ +package appplatform + +import ( + "fmt" + "strings" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" +) + +func ValidateSpringCloudName(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 can contain only lowercase letters, numbers and hyphens, begin with a letter, end with a letter or number", 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_test.go b/azurerm/internal/services/appplatform/validate_test.go new file mode 100644 index 0000000000000..3bf1e6ce674f7 --- /dev/null +++ b/azurerm/internal/services/appplatform/validate_test.go @@ -0,0 +1,61 @@ +package appplatform + +import "testing" + +func TestValidateSpringCloudName(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 := ValidateSpringCloudName(v.input, "name") + actual := len(errors) == 0 + if v.expected != actual { + t.Fatalf("Expected %t but got %t", v.expected, actual) + } + } +} diff --git a/azurerm/provider.go b/azurerm/provider.go index 526627c17cfce..adf99b8b37124 100644 --- a/azurerm/provider.go +++ b/azurerm/provider.go @@ -136,6 +136,8 @@ func Provider() terraform.ResourceProvider { "azurerm_shared_image_version": dataSourceArmSharedImageVersion(), "azurerm_shared_image": dataSourceArmSharedImage(), "azurerm_snapshot": dataSourceArmSnapshot(), + "azurerm_spring_cloud": dataSourceArmSpringCloud(), + "azurerm_spring_cloud_config_server": dataSourceArmSpringCloudConfigServer(), "azurerm_sql_server": dataSourceSqlServer(), "azurerm_sql_database": dataSourceSqlDatabase(), "azurerm_stream_analytics_job": dataSourceArmStreamAnalyticsJob(), @@ -449,6 +451,8 @@ func Provider() terraform.ResourceProvider { "azurerm_shared_image": resourceArmSharedImage(), "azurerm_signalr_service": resourceArmSignalRService(), "azurerm_snapshot": resourceArmSnapshot(), + "azurerm_spring_cloud": resourceArmSpringCloud(), + "azurerm_spring_cloud_config_server": resourceArmSpringCloudConfigServer(), "azurerm_sql_active_directory_administrator": resourceArmSqlAdministrator(), "azurerm_sql_database": resourceArmSqlDatabase(), "azurerm_sql_elasticpool": resourceArmSqlElasticPool(), diff --git a/azurerm/resource_arm_spring_cloud.go b/azurerm/resource_arm_spring_cloud.go new file mode 100644 index 0000000000000..4f8ae1adc50f0 --- /dev/null +++ b/azurerm/resource_arm_spring_cloud.go @@ -0,0 +1,194 @@ +package azurerm + +import ( + "fmt" + "log" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" + + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform" + "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/helpers/response" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" + azappplatform "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/appplatform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceArmSpringCloud() *schema.Resource { + return &schema.Resource{ + Create: resourceArmSpringCloudCreate, + Read: resourceArmSpringCloudRead, + Update: resourceArmSpringCloudUpdate, + Delete: resourceArmSpringCloudDelete, + + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azappplatform.ValidateSpringCloudName, + }, + + // 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.SchemaResourceGroupNameDiffSuppress(), + + "service_id": { + Type: schema.TypeString, + Computed: true, + }, + + "version": { + Type: schema.TypeInt, + Computed: true, + }, + + "tags": tags.Schema(), + }, + } +} + +func resourceArmSpringCloudCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForCreate(meta.(*ArmClient).StopContext, d) + defer cancel() + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + + if features.ShouldResourcesBeImported() && d.IsNewResource() { + existing, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("Error 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", *existing.ID) + } + } + + location := azure.NormalizeLocation(d.Get("location").(string)) + t := d.Get("tags").(map[string]interface{}) + + resource := appplatform.ServiceResource{ + Location: utils.String(location), + Tags: tags.Expand(t), + } + + future, err := client.CreateOrUpdate(ctx, resourceGroup, name, &resource) + if err != nil { + return fmt.Errorf("Error creating Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("Error waiting for creation of Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + return fmt.Errorf("Error retrieving Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + if resp.ID == nil { + return fmt.Errorf("Cannot read Spring Cloud %q (Resource Group %q) ID", name, resourceGroup) + } + d.SetId(*resp.ID) + + return resourceArmSpringCloudRead(d, meta) +} + +func resourceArmSpringCloudRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForRead(meta.(*ArmClient).StopContext, d) + defer cancel() + + id, err := azure.ParseAzureResourceID(d.Id()) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + name := id.Path["Spring"] + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[INFO] Spring Cloud %q does not exist - removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("Error reading Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + d.Set("name", resp.Name) + d.Set("resource_group_name", resourceGroup) + if location := resp.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } + if clusterResourceProperties := resp.Properties; clusterResourceProperties != nil { + d.Set("service_id", clusterResourceProperties.ServiceID) + d.Set("version", int(*clusterResourceProperties.Version)) + } + + return tags.FlattenAndSet(d, resp.Tags) +} + +func resourceArmSpringCloudUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForUpdate(meta.(*ArmClient).StopContext, d) + defer cancel() + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + t := d.Get("tags").(map[string]interface{}) + + resource := appplatform.ServiceResource{ + Tags: tags.Expand(t), + } + + future, err := client.Update(ctx, resourceGroup, name, &resource) + if err != nil { + return fmt.Errorf("Error updating Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("Error waiting for update of Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + return resourceArmSpringCloudRead(d, meta) +} + +func resourceArmSpringCloudDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForDelete(meta.(*ArmClient).StopContext, d) + defer cancel() + + id, err := azure.ParseAzureResourceID(d.Id()) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + name := id.Path["Spring"] + + future, err := client.Delete(ctx, resourceGroup, name) + if err != nil { + if response.WasNotFound(future.Response()) { + return nil + } + return fmt.Errorf("Error deleting Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + if !response.WasNotFound(future.Response()) { + return fmt.Errorf("Error waiting for deleting Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + } + + return nil +} diff --git a/azurerm/resource_arm_spring_cloud_config_server.go b/azurerm/resource_arm_spring_cloud_config_server.go new file mode 100644 index 0000000000000..f83e444f1ada5 --- /dev/null +++ b/azurerm/resource_arm_spring_cloud_config_server.go @@ -0,0 +1,383 @@ +package azurerm + +import ( + "fmt" + "log" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" + + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform" + "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/helpers/validate" + azappplatform "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/appplatform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceArmSpringCloudConfigServer() *schema.Resource { + return &schema.Resource{ + Create: resourceArmSpringCloudConfigServerCreate, + Read: resourceArmSpringCloudConfigServerRead, + Update: resourceArmSpringCloudConfigServerUpdate, + Delete: resourceArmSpringCloudConfigServerDelete, + + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "spring_cloud_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azure.ValidateResourceID, + }, + + "uri": { + Type: schema.TypeString, + Required: true, + ValidateFunc: azappplatform.ValidateConfigServerURI, + }, + "host_key": { + Type: schema.TypeString, + Optional: true, + }, + "host_key_algorithm": { + Type: schema.TypeString, + Optional: true, + }, + "label": { + Type: schema.TypeString, + Optional: true, + }, + "password": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "private_key": { + Type: schema.TypeString, + Optional: true, + }, + "repositories": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validate.NoEmptyStrings, + }, + "uri": { + Type: schema.TypeString, + Required: true, + ValidateFunc: azappplatform.ValidateConfigServerURI, + }, + "host_key": { + Type: schema.TypeString, + Optional: true, + }, + "host_key_algorithm": { + Type: schema.TypeString, + Optional: true, + }, + "label": { + Type: schema.TypeString, + Optional: true, + }, + "password": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "pattern": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "private_key": { + Type: schema.TypeString, + Optional: true, + }, + "search_paths": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "strict_host_key_checking": { + Type: schema.TypeBool, + Optional: true, + }, + "username": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "search_paths": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "strict_host_key_checking": { + Type: schema.TypeBool, + Optional: true, + }, + "username": { + Type: schema.TypeString, + Optional: true, + }, + }, + } +} + +func resourceArmSpringCloudConfigServerCreate(d *schema.ResourceData, meta interface{}) error { + springCloudId := d.Get("spring_cloud_id").(string) + gitProperty := expandArmSpringCloudConfigServerGitProperty(d) + + if err := modifySpringCloudConfigServer(d, meta, springCloudId, gitProperty); err != nil { + return err + } + + d.SetId(springCloudId) + + return resourceArmSpringCloudConfigServerRead(d, meta) +} + +func resourceArmSpringCloudConfigServerRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForRead(meta.(*ArmClient).StopContext, d) + defer cancel() + + id, err := azure.ParseAzureResourceID(d.Id()) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + name := id.Path["Spring"] + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[INFO] Spring Cloud %q does not exist - removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("Error reading Spring Cloud %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + d.Set("spring_cloud_id", resp.ID) + if resp.Properties != nil && resp.Properties.ConfigServerProperties != nil && resp.Properties.ConfigServerProperties.ConfigServer != nil { + if props := resp.Properties.ConfigServerProperties.ConfigServer.GitProperty; props != nil { + d.Set("host_key", props.HostKey) + d.Set("host_key_algorithm", props.HostKeyAlgorithm) + d.Set("label", props.Label) + d.Set("password", props.Password) + d.Set("private_key", props.PrivateKey) + d.Set("strict_host_key_checking", props.StrictHostKeyChecking) + d.Set("uri", props.URI) + d.Set("username", props.Username) + d.Set("search_paths", props.SearchPaths) + if err := d.Set("repositories", flattenArmSpringCloudGitPatternRepository(props.Repositories)); err != nil { + return fmt.Errorf("Error setting `repositories`: %+v", err) + } + } + } + + return nil +} + +func resourceArmSpringCloudConfigServerUpdate(d *schema.ResourceData, meta interface{}) error { + springCloudId := d.Get("spring_cloud_id").(string) + gitProperty := expandArmSpringCloudConfigServerGitProperty(d) + + if err := modifySpringCloudConfigServer(d, meta, springCloudId, gitProperty); err != nil { + return err + } + + return resourceArmSpringCloudConfigServerRead(d, meta) +} + +func resourceArmSpringCloudConfigServerDelete(d *schema.ResourceData, meta interface{}) error { + return modifySpringCloudConfigServer(d, meta, d.Id(), nil) +} + +func modifySpringCloudConfigServer(d *schema.ResourceData, meta interface{}, springCloudId string, gitProperty *appplatform.ConfigServerGitProperty) error { + client := meta.(*ArmClient).AppPlatform.ServicesClient + ctx, cancel := timeouts.ForUpdate(meta.(*ArmClient).StopContext, d) + defer cancel() + + id, err := azure.ParseAzureResourceID(springCloudId) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + springCloudName := id.Path["Spring"] + + resource := appplatform.ServiceResource{ + Properties: &appplatform.ClusterResourceProperties{ + ConfigServerProperties: &appplatform.ConfigServerProperties{ + ConfigServer: &appplatform.ConfigServerSettings{ + GitProperty: gitProperty, + }, + }, + }, + } + + if resp, err := client.Get(ctx, resourceGroup, springCloudName); err != nil { + return fmt.Errorf("Error reading Spring Cloud %q (Resource Group %q): %+v", springCloudName, resourceGroup, err) + } else { + resource.Tags = resp.Tags + } + + future, err := client.Update(ctx, resourceGroup, springCloudName, &resource) + if err != nil { + return fmt.Errorf("Error setting Spring Cloud %q config server (Resource Group %q): %+v", springCloudName, resourceGroup, err) + } + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("Error waiting for setting of Spring Cloud %q config server (Resource Group %q): %+v", springCloudName, resourceGroup, err) + } + springCloudService, err := future.Result(*client) + if err != nil { + return fmt.Errorf("Error getting result of Spring Cloud %q config server (Resource Group %q): %+v", springCloudName, resourceGroup, err) + } + if springCloudService.Properties != nil && springCloudService.Properties.ConfigServerProperties != nil { + if err := springCloudService.Properties.ConfigServerProperties.Error; err != nil { + return fmt.Errorf("Error setting of Spring Cloud %q config server (Resource Group %q): %+v", springCloudName, resourceGroup, err) + } + } + + return nil +} + +func expandArmSpringCloudConfigServerGitProperty(d *schema.ResourceData) *appplatform.ConfigServerGitProperty { + result := appplatform.ConfigServerGitProperty{} + + if repositories, ok := d.GetOk("repositories"); ok { + result.Repositories = expandArmSpringCloudGitPatternRepository(repositories.([]interface{})) + } + if uri, ok := d.GetOk("uri"); ok { + result.URI = utils.String(uri.(string)) + } + if label, ok := d.GetOk("label"); ok { + result.Label = utils.String(label.(string)) + } + if searchPaths, ok := d.GetOk("search_paths"); ok { + result.SearchPaths = utils.ExpandStringSlice(searchPaths.([]interface{})) + } + if username, ok := d.GetOk("username"); ok { + result.Username = utils.String(username.(string)) + } + if password, ok := d.GetOk("password"); ok { + result.Password = utils.String(password.(string)) + } + if hostKey, ok := d.GetOk("host_key"); ok { + result.HostKey = utils.String(hostKey.(string)) + } + if hostKeyAlgorithm, ok := d.GetOk("host_key_algorithm"); ok { + result.HostKeyAlgorithm = utils.String(hostKeyAlgorithm.(string)) + } + if privateKey, ok := d.GetOk("private_key"); ok { + result.PrivateKey = utils.String(privateKey.(string)) + } + if strictHostKeyChecking, ok := d.GetOk("strict_host_key_checking"); ok { + result.StrictHostKeyChecking = utils.Bool(strictHostKeyChecking.(bool)) + } + + return &result +} + +func expandArmSpringCloudGitPatternRepository(input []interface{}) *[]appplatform.GitPatternRepository { + results := make([]appplatform.GitPatternRepository, 0) + for _, item := range input { + v := item.(map[string]interface{}) + name := v["name"].(string) + pattern := v["pattern"].([]interface{}) + uri := v["uri"].(string) + label := v["label"].(string) + searchPaths := v["search_paths"].([]interface{}) + + result := appplatform.GitPatternRepository{ + Label: utils.String(label), + Name: utils.String(name), + Pattern: utils.ExpandStringSlice(pattern), + SearchPaths: utils.ExpandStringSlice(searchPaths), + URI: utils.String(uri), + } + + if username := v["username"].(string); len(username) > 0 { + result.Username = utils.String(username) + } + if password := v["password"].(string); len(password) > 0 { + result.Password = utils.String(password) + } + if hostKey := v["host_key"].(string); len(hostKey) > 0 { + result.HostKey = utils.String(hostKey) + } + if hostKeyAlgorithm := v["host_key_algorithm"].(string); len(hostKeyAlgorithm) > 0 { + result.HostKeyAlgorithm = utils.String(hostKeyAlgorithm) + } + if privateKey := v["private_key"].(string); len(privateKey) > 0 { + result.PrivateKey = utils.String(privateKey) + } + if strictHostKeyChecking := v["strict_host_key_checking"].(bool); strictHostKeyChecking { + result.StrictHostKeyChecking = utils.Bool(strictHostKeyChecking) + } + + results = append(results, result) + } + return &results +} + +func flattenArmSpringCloudGitPatternRepository(input *[]appplatform.GitPatternRepository) []interface{} { + results := make([]interface{}, 0) + if input == nil { + return results + } + + for _, item := range *input { + v := make(map[string]interface{}) + + if name := item.Name; name != nil { + v["name"] = *name + } + if hostKey := item.HostKey; hostKey != nil { + v["host_key"] = *hostKey + } + if hostKeyAlgorithm := item.HostKeyAlgorithm; hostKeyAlgorithm != nil { + v["host_key_algorithm"] = *hostKeyAlgorithm + } + if label := item.Label; label != nil { + v["label"] = *label + } + if password := item.Password; password != nil { + v["password"] = *password + } + v["pattern"] = utils.FlattenStringSlice(item.Pattern) + if privateKey := item.PrivateKey; privateKey != nil { + v["private_key"] = *privateKey + } + v["search_paths"] = utils.FlattenStringSlice(item.SearchPaths) + if strictHostKeyChecking := item.StrictHostKeyChecking; strictHostKeyChecking != nil { + v["strict_host_key_checking"] = *strictHostKeyChecking + } + if uri := item.URI; uri != nil { + v["uri"] = *uri + } + if username := item.Username; username != nil { + v["username"] = *username + } + + results = append(results, v) + } + + return results +} diff --git a/azurerm/resource_arm_spring_cloud_config_server_test.go b/azurerm/resource_arm_spring_cloud_config_server_test.go new file mode 100644 index 0000000000000..0b0c72aea0f26 --- /dev/null +++ b/azurerm/resource_arm_spring_cloud_config_server_test.go @@ -0,0 +1,176 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" +) + +func TestAccAzureRMSpringCloudConfigServer_basic(t *testing.T) { + resourceName := "azurerm_spring_cloud_config_server.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSpringCloudConfigServer_basic(ri, location), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(resourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "uri", "https://github.com/Azure-Samples/piggymetrics"), + resource.TestCheckResourceAttr(resourceName, "label", "config"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSpringCloudConfigServer_update(t *testing.T) { + resourceName := "azurerm_spring_cloud_config_server.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSpringCloudConfigServer_basic(ri, location), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "uri", "https://github.com/Azure-Samples/piggymetrics"), + resource.TestCheckResourceAttr(resourceName, "label", "config"), + resource.TestCheckResourceAttr(resourceName, "search_paths.#", "0"), + resource.TestCheckResourceAttr(resourceName, "repositories.#", "0"), + ), + }, + { + Config: testAccAzureRMSpringCloudConfigServer_complete(ri, location), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "uri", "https://github.com/Azure-Samples/piggymetrics"), + resource.TestCheckResourceAttr(resourceName, "label", "config"), + resource.TestCheckResourceAttr(resourceName, "search_paths.#", "2"), + resource.TestCheckResourceAttr(resourceName, "search_paths.0", "dir1"), + resource.TestCheckResourceAttr(resourceName, "search_paths.1", "dir2"), + resource.TestCheckResourceAttr(resourceName, "repositories.#", "2"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.name", "repo1"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.uri", "https://github.com/Azure-Samples/piggymetrics"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.label", "config"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.search_paths.#", "2"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.search_paths.0", "dir1"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.search_paths.1", "dir2"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.name", "repo2"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.uri", "https://github.com/Azure-Samples/piggymetrics"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.label", "config"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.search_paths.#", "2"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.search_paths.0", "dir1"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.search_paths.1", "dir2"), + ), + }, + { + Config: testAccAzureRMSpringCloudConfigServer_basic(ri, location), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "search_paths.#", "0"), + resource.TestCheckResourceAttr(resourceName, "repositories.#", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSpringCloudConfigServer_complete(t *testing.T) { + resourceName := "azurerm_spring_cloud_config_server.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSpringCloudDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSpringCloudConfigServer_complete(ri, location), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(resourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "uri", "https://github.com/Azure-Samples/piggymetrics"), + resource.TestCheckResourceAttr(resourceName, "label", "config"), + resource.TestCheckResourceAttr(resourceName, "search_paths.#", "2"), + resource.TestCheckResourceAttr(resourceName, "search_paths.0", "dir1"), + resource.TestCheckResourceAttr(resourceName, "search_paths.1", "dir2"), + resource.TestCheckResourceAttr(resourceName, "repositories.#", "2"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.name", "repo1"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.uri", "https://github.com/Azure-Samples/piggymetrics"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.label", "config"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.search_paths.#", "2"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.search_paths.0", "dir1"), + resource.TestCheckResourceAttr(resourceName, "repositories.0.search_paths.1", "dir2"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.name", "repo2"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.uri", "https://github.com/Azure-Samples/piggymetrics"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.label", "config"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.search_paths.#", "2"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.search_paths.0", "dir1"), + resource.TestCheckResourceAttr(resourceName, "repositories.1.search_paths.1", "dir2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccAzureRMSpringCloudConfigServer_basic(rInt int, location string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_spring_cloud_config_server" "test" { + spring_cloud_id = azurerm_spring_cloud.test.id + + uri = "https://github.com/Azure-Samples/piggymetrics" + label = "config" +} + +`, testAccAzureRMSpringCloud_basic(rInt, location)) +} + +func testAccAzureRMSpringCloudConfigServer_complete(rInt int, location string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_spring_cloud_config_server" "test" { + spring_cloud_id = azurerm_spring_cloud.test.id + uri = "https://github.com/Azure-Samples/piggymetrics" + label = "config" + search_paths = ["dir1", "dir2"] + + repositories { + name = "repo1" + uri = "https://github.com/Azure-Samples/piggymetrics" + label = "config" + search_paths = ["dir1", "dir2"] + } + + repositories { + name = "repo2" + uri = "https://github.com/Azure-Samples/piggymetrics" + label = "config" + search_paths = ["dir1", "dir2"] + } +} +`, testAccAzureRMSpringCloud_basic(rInt, location)) +} diff --git a/azurerm/resource_arm_spring_cloud_test.go b/azurerm/resource_arm_spring_cloud_test.go new file mode 100644 index 0000000000000..98a82bed2fc06 --- /dev/null +++ b/azurerm/resource_arm_spring_cloud_test.go @@ -0,0 +1,204 @@ +package azurerm + +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/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func TestAccAzureRMSpringCloud_basic(t *testing.T) { + resourceName := "azurerm_spring_cloud.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSpringCloudDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSpringCloud_basic(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSpringCloudExists(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "id"), + resource.TestCheckResourceAttrSet(resourceName, "service_id"), + resource.TestCheckResourceAttrSet(resourceName, "version"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.env", "test"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSpringCloud_update(t *testing.T) { + resourceName := "azurerm_spring_cloud.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSpringCloudDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSpringCloud_basic(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSpringCloudExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.env", "test"), + ), + }, + { + Config: testAccAzureRMSpringCloud_complete(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSpringCloudExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.env", "test"), + resource.TestCheckResourceAttr(resourceName, "tags.version", "1"), + ), + }, + { + Config: testAccAzureRMSpringCloud_basic(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSpringCloudExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.env", "test"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMSpringCloud_complete(t *testing.T) { + resourceName := "azurerm_spring_cloud.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMSpringCloudDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMSpringCloud_complete(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMSpringCloudExists(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "id"), + resource.TestCheckResourceAttrSet(resourceName, "service_id"), + resource.TestCheckResourceAttrSet(resourceName, "version"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.env", "test"), + resource.TestCheckResourceAttr(resourceName, "tags.version", "1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testCheckAzureRMSpringCloudExists(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 := testAccProvider.Meta().(*ArmClient).AppPlatform.ServicesClient + ctx := testAccProvider.Meta().(*ArmClient).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 testCheckAzureRMSpringCloudDestroy(s *terraform.State) error { + client := testAccProvider.Meta().(*ArmClient).AppPlatform.ServicesClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_spring_cloud" { + 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 testAccAzureRMSpringCloud_basic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_spring_cloud" "test" { + name = "acctestsc-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + tags = { + env = "test" + } +} + +`, rInt, location, rInt) +} + +func testAccAzureRMSpringCloud_complete(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_spring_cloud" "test" { + name = "acctestsc-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + tags = { + env = "test" + version = "1" + } +} +`, rInt, location, rInt) +} diff --git a/examples/app-platform/spring-cloud/README.md b/examples/app-platform/spring-cloud/README.md new file mode 100644 index 0000000000000..36d398e627374 --- /dev/null +++ b/examples/app-platform/spring-cloud/README.md @@ -0,0 +1,26 @@ +# Example: Azure Spring Cloud Service + +This example provisions a Spring Cloud Service. + +### Notes + +* now Azure Spring Cloud only supports location: `East US`, `Southeast Asia`, `West Europe`, `West US 2`. + +```hcl +resource "azurerm_spring_cloud" "example" { + name = "example" + resource_group = "example" + location = "example" + + tags = { + env = "staging" + } +} + +resource "azurerm_spring_cloud_config_server" "example" { + spring_cloud_id = "${azurerm_spring_cloud.example.id}" + + uri = "https://github.com/Azure-Samples/piggymetrics" + label = "config" +} +``` diff --git a/examples/app-platform/spring-cloud/main.tf b/examples/app-platform/spring-cloud/main.tf new file mode 100644 index 0000000000000..3d657163e3321 --- /dev/null +++ b/examples/app-platform/spring-cloud/main.tf @@ -0,0 +1,22 @@ +resource "azurerm_resource_group" "example" { + name = "${var.prefix}-resources" + location = "${var.location}" +} + +resource "azurerm_spring_cloud" "example" { + name = "${var.prefix}-sc" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + + tags = { + env = "test" + } +} + +resource "azurerm_spring_cloud_config_server" "example" { + spring_cloud_id = "${azurerm_spring_cloud.example.id}" + + uri = "https://github.com/Azure-Samples/piggymetrics" + label = "config" +} + diff --git a/examples/app-platform/spring-cloud/outputs.tf b/examples/app-platform/spring-cloud/outputs.tf new file mode 100644 index 0000000000000..927f6f71142aa --- /dev/null +++ b/examples/app-platform/spring-cloud/outputs.tf @@ -0,0 +1,3 @@ +output "spring_cloud_id" { + value = "${azurerm_spring_cloud.example.id}" +} diff --git a/examples/app-platform/spring-cloud/variables.tf b/examples/app-platform/spring-cloud/variables.tf new file mode 100644 index 0000000000000..23711e25afa7b --- /dev/null +++ b/examples/app-platform/spring-cloud/variables.tf @@ -0,0 +1,7 @@ +variable "prefix" { + description = "The prefix used for all resources in this example" +} + +variable "location" { + description = "The Azure location where all resources in this example should be created" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/appplatformapi/interfaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/appplatformapi/interfaces.go new file mode 100644 index 0000000000000..db69e51e29ce9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform/appplatformapi/interfaces.go @@ -0,0 +1,87 @@ +package appplatformapi + +// 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/azure-sdk-for-go/services/preview/appplatform/mgmt/2019-05-01-preview/appplatform" + "github.com/Azure/go-autorest/autorest" +) + +// ServicesClientAPI contains the set of methods on the ServicesClient type. +type ServicesClientAPI interface { + CheckNameAvailability(ctx context.Context, location string, availabilityParameters appplatform.NameAvailabilityParameters) (result appplatform.NameAvailability, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, resource *appplatform.ServiceResource) (result appplatform.ServicesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServicesDeleteFuture, err error) + DisableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) + EnableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.TestKeys, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServiceResource, err error) + List(ctx context.Context, resourceGroupName string) (result appplatform.ServiceResourceListPage, err error) + ListBySubscription(ctx context.Context) (result appplatform.ServiceResourceListPage, err error) + ListTestKeys(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.TestKeys, err error) + RegenerateTestKey(ctx context.Context, resourceGroupName string, serviceName string, regenerateTestKeyRequest *appplatform.RegenerateTestKeyRequestPayload) (result appplatform.TestKeys, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, resource *appplatform.ServiceResource) (result appplatform.ServicesUpdateFuture, err error) +} + +var _ ServicesClientAPI = (*appplatform.ServicesClient)(nil) + +// AppsClientAPI contains the set of methods on the AppsClient type. +type AppsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource *appplatform.AppResource) (result appplatform.AppsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (result appplatform.AppResource, err error) + GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.ResourceUploadDefinition, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.AppResourceCollectionPage, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource *appplatform.AppResource) (result appplatform.AppsUpdateFuture, err error) +} + +var _ AppsClientAPI = (*appplatform.AppsClient)(nil) + +// BindingsClientAPI contains the set of methods on the BindingsClient type. +type BindingsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource *appplatform.BindingResource) (result appplatform.BindingResource, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result appplatform.BindingResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.BindingResourceCollectionPage, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource *appplatform.BindingResource) (result appplatform.BindingResource, err error) +} + +var _ BindingsClientAPI = (*appplatform.BindingsClient)(nil) + +// DeploymentsClientAPI contains the set of methods on the DeploymentsClient type. +type DeploymentsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource *appplatform.DeploymentResource) (result appplatform.DeploymentsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentResource, err error) + GetLogFileURL(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.LogFileURLResponse, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result appplatform.DeploymentResourceCollectionPage, err error) + ListClusterAllDeployments(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result appplatform.DeploymentResourceCollectionPage, err error) + Restart(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentsRestartFuture, err error) + Start(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentsStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentsStopFuture, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource *appplatform.DeploymentResource) (result appplatform.DeploymentsUpdateFuture, err error) +} + +var _ DeploymentsClientAPI = (*appplatform.DeploymentsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result appplatform.AvailableOperationsPage, err error) +} + +var _ OperationsClientAPI = (*appplatform.OperationsClient)(nil) 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 0000000000000..decc2c25efcc9 --- /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,598 @@ +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. +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", Name: validation.Null, Rule: false, + Chain: []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: 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: 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: 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.WithQueryParameters(queryParameters)) + if appResource != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(appResource)) + } + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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.WithQueryParameters(queryParameters)) + if appResource != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(appResource)) + } + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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 0000000000000..b03a7c6260072 --- /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,498 @@ +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. +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.WithQueryParameters(queryParameters)) + if bindingResource != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(bindingResource)) + } + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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.WithQueryParameters(queryParameters)) + if bindingResource != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(bindingResource)) + } + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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 0000000000000..cf95f5e086bbf --- /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,51 @@ +// 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. +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 0000000000000..a1837b1c1a02a --- /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,971 @@ +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. +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", Name: validation.Null, Rule: false, + Chain: []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: 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: 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: 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.WithQueryParameters(queryParameters)) + if deploymentResource != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(deploymentResource)) + } + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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.WithQueryParameters(queryParameters)) + if deploymentResource != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(deploymentResource)) + } + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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 0000000000000..cf8d8d68fd8a7 --- /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 0000000000000..8bfb2858835f1 --- /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. +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) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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 0000000000000..6f2c3a817fec7 --- /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,1006 @@ +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. +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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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", Name: validation.Null, Rule: false, + Chain: []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.WithQueryParameters(queryParameters)) + if resource != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(resource)) + } + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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.WithQueryParameters(queryParameters)) + if regenerateTestKeyRequest != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(regenerateTestKeyRequest)) + } + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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.WithQueryParameters(queryParameters)) + if resource != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(resource)) + } + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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 0000000000000..ae12ebc2af4de --- /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/website/azurerm.erb b/website/azurerm.erb index c8cdfaa92be9a..ae793148f2515 100644 --- a/website/azurerm.erb +++ b/website/azurerm.erb @@ -402,6 +402,14 @@ azurerm_snapshot +
  • + azurerm_spring_cloud +
  • + +
  • + azurerm_spring_cloud_config_server +
  • +
  • azurerm_sql_database
  • @@ -642,6 +650,19 @@ +
  • + App Platform + +
  • +
  • Authorization Resources