diff --git a/internal/services/servicefabric/client/client.go b/internal/services/servicefabric/client/client.go index b3716b370253..bbc643a90827 100644 --- a/internal/services/servicefabric/client/client.go +++ b/internal/services/servicefabric/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ClustersClient *servicefabric.ClustersClient + ClustersClient *cluster.ClusterClient } func NewClient(o *common.ClientOptions) *Client { - clustersClient := servicefabric.NewClustersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + clustersClient := cluster.NewClusterClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&clustersClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/internal/services/servicefabric/parse/cluster.go b/internal/services/servicefabric/parse/cluster.go deleted file mode 100644 index 53c0c5ea3709..000000000000 --- a/internal/services/servicefabric/parse/cluster.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ClusterId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewClusterID(subscriptionId, resourceGroup, name string) ClusterId { - return ClusterId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ClusterId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Cluster", segmentsStr) -} - -func (id ClusterId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/clusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ClusterID parses a Cluster ID into an ClusterId struct -func ClusterID(input string) (*ClusterId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ClusterId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("clusters"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/servicefabric/parse/cluster_test.go b/internal/services/servicefabric/parse/cluster_test.go deleted file mode 100644 index d5fc66985dfc..000000000000 --- a/internal/services/servicefabric/parse/cluster_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ClusterId{} - -func TestClusterIDFormatter(t *testing.T) { - actual := NewClusterID("12345678-1234-9876-4563-123456789012", "resGroup1", "cluster1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/cluster1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestClusterID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ClusterId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/cluster1", - Expected: &ClusterId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "cluster1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.SERVICEFABRIC/CLUSTERS/CLUSTER1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ClusterID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/servicefabric/resourceids.go b/internal/services/servicefabric/resourceids.go deleted file mode 100644 index db7b44ca1630..000000000000 --- a/internal/services/servicefabric/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package servicefabric - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Cluster -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/cluster1 diff --git a/internal/services/servicefabric/service_fabric_cluster_resource.go b/internal/services/servicefabric/service_fabric_cluster_resource.go index 11621e93e8ae..c129ec062f6a 100644 --- a/internal/services/servicefabric/service_fabric_cluster_resource.go +++ b/internal/services/servicefabric/service_fabric_cluster_resource.go @@ -5,16 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/parse" serviceFabricValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -37,7 +36,7 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ClusterID(id) + _, err := cluster.ParseClusterID(id) return err }), @@ -56,11 +55,11 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(servicefabric.ReliabilityLevelNone), - string(servicefabric.ReliabilityLevelBronze), - string(servicefabric.ReliabilityLevelSilver), - string(servicefabric.ReliabilityLevelGold), - string(servicefabric.ReliabilityLevelPlatinum), + string(cluster.ReliabilityLevelNone), + string(cluster.ReliabilityLevelBronze), + string(cluster.ReliabilityLevelSilver), + string(cluster.ReliabilityLevelGold), + string(cluster.ReliabilityLevelPlatinum), }, false), }, @@ -68,8 +67,8 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(servicefabric.UpgradeModeAutomatic), - string(servicefabric.UpgradeModeManual), + string(cluster.UpgradeModeAutomatic), + string(cluster.UpgradeModeManual), }, false), }, @@ -77,8 +76,8 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(servicefabric.SfZonalUpgradeModeHierarchical), - string(servicefabric.SfZonalUpgradeModeParallel), + string(cluster.SfZonalUpgradeModeHierarchical), + string(cluster.SfZonalUpgradeModeParallel), }, false), }, @@ -86,8 +85,8 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(servicefabric.VmssZonalUpgradeModeHierarchical), - string(servicefabric.VmssZonalUpgradeModeParallel), + string(cluster.VMSSZonalUpgradeModeHierarchical), + string(cluster.VMSSZonalUpgradeModeParallel), }, false), }, @@ -502,11 +501,11 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { "durability_level": { Type: pluginsdk.TypeString, Optional: true, - Default: string(servicefabric.DurabilityLevelBronze), + Default: string(cluster.DurabilityLevelBronze), ValidateFunc: validation.StringInSlice([]string{ - string(servicefabric.DurabilityLevelBronze), - string(servicefabric.DurabilityLevelSilver), - string(servicefabric.DurabilityLevelGold), + string(cluster.DurabilityLevelBronze), + string(cluster.DurabilityLevelSilver), + string(cluster.DurabilityLevelGold), }, false), }, @@ -551,7 +550,7 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "cluster_endpoint": { Type: pluginsdk.TypeString, @@ -567,16 +566,16 @@ func resourceServiceFabricClusterCreateUpdate(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewClusterID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := cluster.NewClusterID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_service_fabric_cluster", id.ID()) } } @@ -600,73 +599,70 @@ func resourceServiceFabricClusterCreateUpdate(d *pluginsdk.ResourceData, meta in nodeTypes := expandServiceFabricClusterNodeTypes(nodeTypesRaw) location := d.Get("location").(string) - reliabilityLevel := d.Get("reliability_level").(string) + reliabilityLevel := cluster.ReliabilityLevel(d.Get("reliability_level").(string)) managementEndpoint := d.Get("management_endpoint").(string) - upgradeMode := d.Get("upgrade_mode").(string) + upgradeMode := cluster.UpgradeMode(d.Get("upgrade_mode").(string)) clusterCodeVersion := d.Get("cluster_code_version").(string) vmImage := d.Get("vm_image").(string) t := d.Get("tags").(map[string]interface{}) - cluster := servicefabric.Cluster{ - Location: utils.String(location), + clusterModel := cluster.Cluster{ + Location: location, Tags: tags.Expand(t), - ClusterProperties: &servicefabric.ClusterProperties{ + Properties: &cluster.ClusterProperties{ AddOnFeatures: addOnFeatures, AzureActiveDirectory: azureActiveDirectory, CertificateCommonNames: expandServiceFabricClusterCertificateCommonNames(d), ReverseProxyCertificateCommonNames: expandServiceFabricClusterReverseProxyCertificateCommonNames(d), DiagnosticsStorageAccountConfig: diagnostics, FabricSettings: fabricSettings, - ManagementEndpoint: utils.String(managementEndpoint), + ManagementEndpoint: managementEndpoint, NodeTypes: nodeTypes, - ReliabilityLevel: servicefabric.ReliabilityLevel(reliabilityLevel), + ReliabilityLevel: &reliabilityLevel, UpgradeDescription: upgradePolicy, - UpgradeMode: servicefabric.UpgradeMode(upgradeMode), - VMImage: utils.String(vmImage), + UpgradeMode: &upgradeMode, + VmImage: utils.String(vmImage), }, } if sfZonalUpgradeMode, ok := d.GetOk("service_fabric_zonal_upgrade_mode"); ok { - cluster.ClusterProperties.SfZonalUpgradeMode = servicefabric.SfZonalUpgradeMode(sfZonalUpgradeMode.(string)) + mode := cluster.SfZonalUpgradeMode(sfZonalUpgradeMode.(string)) + clusterModel.Properties.SfZonalUpgradeMode = &mode } if vmssZonalUpgradeMode, ok := d.GetOk("vmss_zonal_upgrade_mode"); ok { - cluster.ClusterProperties.VmssZonalUpgradeMode = servicefabric.VmssZonalUpgradeMode(vmssZonalUpgradeMode.(string)) + mode := cluster.VMSSZonalUpgradeMode(vmssZonalUpgradeMode.(string)) + clusterModel.Properties.VMSSZonalUpgradeMode = &mode } if certificateRaw, ok := d.GetOk("certificate"); ok { certificate := expandServiceFabricClusterCertificate(certificateRaw.([]interface{})) - cluster.ClusterProperties.Certificate = certificate + clusterModel.Properties.Certificate = certificate } if reverseProxyCertificateRaw, ok := d.GetOk("reverse_proxy_certificate"); ok { reverseProxyCertificate := expandServiceFabricClusterReverseProxyCertificate(reverseProxyCertificateRaw.([]interface{})) - cluster.ClusterProperties.ReverseProxyCertificate = reverseProxyCertificate + clusterModel.Properties.ReverseProxyCertificate = reverseProxyCertificate } if clientCertificateThumbprintRaw, ok := d.GetOk("client_certificate_thumbprint"); ok { clientCertificateThumbprints := expandServiceFabricClusterClientCertificateThumbprints(clientCertificateThumbprintRaw.([]interface{})) - cluster.ClusterProperties.ClientCertificateThumbprints = clientCertificateThumbprints + clusterModel.Properties.ClientCertificateThumbprints = clientCertificateThumbprints } if clientCertificateCommonNamesRaw, ok := d.GetOk("client_certificate_common_name"); ok { clientCertificateCommonNames := expandServiceFabricClusterClientCertificateCommonNames(clientCertificateCommonNamesRaw.([]interface{})) - cluster.ClusterProperties.ClientCertificateCommonNames = clientCertificateCommonNames + clusterModel.Properties.ClientCertificateCommonNames = clientCertificateCommonNames } if clusterCodeVersion != "" { - cluster.ClusterProperties.ClusterCodeVersion = utils.String(clusterCodeVersion) + clusterModel.Properties.ClusterCodeVersion = utils.String(clusterCodeVersion) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, cluster) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, clusterModel); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceServiceFabricClusterRead(d, meta) } @@ -676,98 +672,123 @@ func resourceServiceFabricClusterRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ClusterID(d.Id()) + id, err := cluster.ParseClusterID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[WARN] Service Fabric Cluster %q (Resource Group %q) was not found - removing from state!", id.Name, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[WARN] %s was not found - removing from state!", id.ID()) d.SetId("") return nil } - return fmt.Errorf("retrieving Service Fabric Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id.ID(), err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - - if props := resp.ClusterProperties; props != nil { - d.Set("cluster_code_version", props.ClusterCodeVersion) - d.Set("cluster_endpoint", props.ClusterEndpoint) - d.Set("management_endpoint", props.ManagementEndpoint) - d.Set("reliability_level", string(props.ReliabilityLevel)) - d.Set("vm_image", props.VMImage) - d.Set("upgrade_mode", string(props.UpgradeMode)) - d.Set("service_fabric_zonal_upgrade_mode", string(props.SfZonalUpgradeMode)) - d.Set("vmss_zonal_upgrade_mode", string(props.VmssZonalUpgradeMode)) - - addOnFeatures := flattenServiceFabricClusterAddOnFeatures(props.AddOnFeatures) - if err := d.Set("add_on_features", pluginsdk.NewSet(pluginsdk.HashString, addOnFeatures)); err != nil { - return fmt.Errorf("setting `add_on_features`: %+v", err) - } + d.Set("name", id.ClusterName) + d.Set("resource_group_name", id.ResourceGroupName) - azureActiveDirectory := flattenServiceFabricClusterAzureActiveDirectory(props.AzureActiveDirectory) - if err := d.Set("azure_active_directory", azureActiveDirectory); err != nil { - return fmt.Errorf("setting `azure_active_directory`: %+v", err) - } + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) - certificate := flattenServiceFabricClusterCertificate(props.Certificate) - if err := d.Set("certificate", certificate); err != nil { - return fmt.Errorf("setting `certificate`: %+v", err) - } + if props := model.Properties; props != nil { + d.Set("cluster_code_version", props.ClusterCodeVersion) + d.Set("cluster_endpoint", props.ClusterEndpoint) + d.Set("management_endpoint", props.ManagementEndpoint) + d.Set("vm_image", props.VmImage) - certificateCommonNames := flattenServiceFabricClusterCertificateCommonNames(props.CertificateCommonNames) - if err := d.Set("certificate_common_names", certificateCommonNames); err != nil { - return fmt.Errorf("setting `certificate_common_names`: %+v", err) - } + reliabilityLevel := "" + if props.ReliabilityLevel != nil { + reliabilityLevel = string(*props.ReliabilityLevel) + } + d.Set("reliability_level", reliabilityLevel) - reverseProxyCertificate := flattenServiceFabricClusterReverseProxyCertificate(props.ReverseProxyCertificate) - if err := d.Set("reverse_proxy_certificate", reverseProxyCertificate); err != nil { - return fmt.Errorf("setting `reverse_proxy_certificate`: %+v", err) - } + upgradeMode := "" + if props.UpgradeMode != nil { + upgradeMode = string(*props.UpgradeMode) + } + d.Set("upgrade_mode", upgradeMode) - reverseProxyCertificateCommonNames := flattenServiceFabricClusterCertificateCommonNames(props.ReverseProxyCertificateCommonNames) - if err := d.Set("reverse_proxy_certificate_common_names", reverseProxyCertificateCommonNames); err != nil { - return fmt.Errorf("setting `reverse_proxy_certificate_common_names`: %+v", err) - } + sfZonalMode := "" + if props.SfZonalUpgradeMode != nil { + sfZonalMode = string(*props.SfZonalUpgradeMode) + } + d.Set("service_fabric_zonal_upgrade_mode", sfZonalMode) - clientCertificateThumbprints := flattenServiceFabricClusterClientCertificateThumbprints(props.ClientCertificateThumbprints) - if err := d.Set("client_certificate_thumbprint", clientCertificateThumbprints); err != nil { - return fmt.Errorf("setting `client_certificate_thumbprint`: %+v", err) - } + vmssZonalMode := "" + if props.VMSSZonalUpgradeMode != nil { + vmssZonalMode = string(*props.VMSSZonalUpgradeMode) + } + d.Set("vmss_zonal_upgrade_mode", vmssZonalMode) - clientCertificateCommonNames := flattenServiceFabricClusterClientCertificateCommonNames(props.ClientCertificateCommonNames) - if err := d.Set("client_certificate_common_name", clientCertificateCommonNames); err != nil { - return fmt.Errorf("setting `client_certificate_common_name`: %+v", err) - } + addOnFeatures := flattenServiceFabricClusterAddOnFeatures(props.AddOnFeatures) + if err := d.Set("add_on_features", pluginsdk.NewSet(pluginsdk.HashString, addOnFeatures)); err != nil { + return fmt.Errorf("setting `add_on_features`: %+v", err) + } - diagnostics := flattenServiceFabricClusterDiagnosticsConfig(props.DiagnosticsStorageAccountConfig) - if err := d.Set("diagnostics_config", diagnostics); err != nil { - return fmt.Errorf("setting `diagnostics_config`: %+v", err) - } + azureActiveDirectory := flattenServiceFabricClusterAzureActiveDirectory(props.AzureActiveDirectory) + if err := d.Set("azure_active_directory", azureActiveDirectory); err != nil { + return fmt.Errorf("setting `azure_active_directory`: %+v", err) + } - upgradePolicy := flattenServiceFabricClusterUpgradePolicy(props.UpgradeDescription) - if err := d.Set("upgrade_policy", upgradePolicy); err != nil { - return fmt.Errorf("setting `upgrade_policy`: %+v", err) - } + certificate := flattenServiceFabricClusterCertificate(props.Certificate) + if err := d.Set("certificate", certificate); err != nil { + return fmt.Errorf("setting `certificate`: %+v", err) + } - fabricSettings := flattenServiceFabricClusterFabricSettings(props.FabricSettings) - if err := d.Set("fabric_settings", fabricSettings); err != nil { - return fmt.Errorf("setting `fabric_settings`: %+v", err) - } + certificateCommonNames := flattenServiceFabricClusterCertificateCommonNames(props.CertificateCommonNames) + if err := d.Set("certificate_common_names", certificateCommonNames); err != nil { + return fmt.Errorf("setting `certificate_common_names`: %+v", err) + } + + reverseProxyCertificate := flattenServiceFabricClusterReverseProxyCertificate(props.ReverseProxyCertificate) + if err := d.Set("reverse_proxy_certificate", reverseProxyCertificate); err != nil { + return fmt.Errorf("setting `reverse_proxy_certificate`: %+v", err) + } + + reverseProxyCertificateCommonNames := flattenServiceFabricClusterCertificateCommonNames(props.ReverseProxyCertificateCommonNames) + if err := d.Set("reverse_proxy_certificate_common_names", reverseProxyCertificateCommonNames); err != nil { + return fmt.Errorf("setting `reverse_proxy_certificate_common_names`: %+v", err) + } + + clientCertificateThumbprints := flattenServiceFabricClusterClientCertificateThumbprints(props.ClientCertificateThumbprints) + if err := d.Set("client_certificate_thumbprint", clientCertificateThumbprints); err != nil { + return fmt.Errorf("setting `client_certificate_thumbprint`: %+v", err) + } + + clientCertificateCommonNames := flattenServiceFabricClusterClientCertificateCommonNames(props.ClientCertificateCommonNames) + if err := d.Set("client_certificate_common_name", clientCertificateCommonNames); err != nil { + return fmt.Errorf("setting `client_certificate_common_name`: %+v", err) + } + + diagnostics := flattenServiceFabricClusterDiagnosticsConfig(props.DiagnosticsStorageAccountConfig) + if err := d.Set("diagnostics_config", diagnostics); err != nil { + return fmt.Errorf("setting `diagnostics_config`: %+v", err) + } + + upgradePolicy := flattenServiceFabricClusterUpgradePolicy(props.UpgradeDescription) + if err := d.Set("upgrade_policy", upgradePolicy); err != nil { + return fmt.Errorf("setting `upgrade_policy`: %+v", err) + } - nodeTypes := flattenServiceFabricClusterNodeTypes(props.NodeTypes) - if err := d.Set("node_type", nodeTypes); err != nil { - return fmt.Errorf("setting `node_type`: %+v", err) + fabricSettings := flattenServiceFabricClusterFabricSettings(props.FabricSettings) + if err := d.Set("fabric_settings", fabricSettings); err != nil { + return fmt.Errorf("setting `fabric_settings`: %+v", err) + } + + nodeTypes := flattenServiceFabricClusterNodeTypes(props.NodeTypes) + if err := d.Set("node_type", nodeTypes); err != nil { + return fmt.Errorf("setting `node_type`: %+v", err) + } } + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceServiceFabricClusterDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -775,34 +796,34 @@ func resourceServiceFabricClusterDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ClusterID(d.Id()) + id, err := cluster.ParseClusterID(d.Id()) if err != nil { return err } - log.Printf("[DEBUG] Deleting Service Fabric Cluster %q (Resource Group %q)", id.Name, id.ResourceGroup) + log.Printf("[DEBUG] Deleting %s", id.ID()) - resp, err := client.Delete(ctx, id.ResourceGroup, id.Name) + resp, err := client.Delete(ctx, *id) if err != nil { - if !response.WasNotFound(resp.Response) { - return fmt.Errorf("deleting Service Fabric Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", id.ID(), err) } } return nil } -func expandServiceFabricClusterAddOnFeatures(input []interface{}) *[]string { - output := make([]string, 0) +func expandServiceFabricClusterAddOnFeatures(input []interface{}) *[]cluster.AddOnFeatures { + output := make([]cluster.AddOnFeatures, 0) for _, v := range input { - output = append(output, v.(string)) + output = append(output, cluster.AddOnFeatures(v.(string))) } return &output } -func expandServiceFabricClusterAzureActiveDirectory(input []interface{}) *servicefabric.AzureActiveDirectory { +func expandServiceFabricClusterAzureActiveDirectory(input []interface{}) *cluster.AzureActiveDirectory { if len(input) == 0 { return nil } @@ -813,21 +834,21 @@ func expandServiceFabricClusterAzureActiveDirectory(input []interface{}) *servic clusterApplication := v["cluster_application_id"].(string) clientApplication := v["client_application_id"].(string) - config := servicefabric.AzureActiveDirectory{ - TenantID: utils.String(tenantId), + config := cluster.AzureActiveDirectory{ + TenantId: utils.String(tenantId), ClusterApplication: utils.String(clusterApplication), ClientApplication: utils.String(clientApplication), } return &config } -func flattenServiceFabricClusterAzureActiveDirectory(input *servicefabric.AzureActiveDirectory) []interface{} { +func flattenServiceFabricClusterAzureActiveDirectory(input *cluster.AzureActiveDirectory) []interface{} { results := make([]interface{}, 0) if v := input; v != nil { output := make(map[string]interface{}) - if name := v.TenantID; name != nil { + if name := v.TenantId; name != nil { output["tenant_id"] = *name } @@ -845,19 +866,19 @@ func flattenServiceFabricClusterAzureActiveDirectory(input *servicefabric.AzureA return results } -func flattenServiceFabricClusterAddOnFeatures(input *[]string) []interface{} { +func flattenServiceFabricClusterAddOnFeatures(input *[]cluster.AddOnFeatures) []interface{} { output := make([]interface{}, 0) if input != nil { for _, v := range *input { - output = append(output, v) + output = append(output, string(v)) } } return output } -func expandServiceFabricClusterCertificate(input []interface{}) *servicefabric.CertificateDescription { +func expandServiceFabricClusterCertificate(input []interface{}) *cluster.CertificateDescription { if len(input) == 0 { return nil } @@ -865,11 +886,11 @@ func expandServiceFabricClusterCertificate(input []interface{}) *servicefabric.C v := input[0].(map[string]interface{}) thumbprint := v["thumbprint"].(string) - x509StoreName := v["x509_store_name"].(string) + x509StoreName := cluster.X509StoreName(v["x509_store_name"].(string)) - result := servicefabric.CertificateDescription{ - Thumbprint: utils.String(thumbprint), - X509StoreName: servicefabric.X509StoreName(x509StoreName), + result := cluster.CertificateDescription{ + Thumbprint: thumbprint, + X509StoreName: &x509StoreName, } if thumb, ok := v["thumbprint_secondary"]; ok { @@ -879,28 +900,26 @@ func expandServiceFabricClusterCertificate(input []interface{}) *servicefabric.C return &result } -func flattenServiceFabricClusterCertificate(input *servicefabric.CertificateDescription) []interface{} { +func flattenServiceFabricClusterCertificate(input *cluster.CertificateDescription) []interface{} { results := make([]interface{}, 0) if v := input; v != nil { output := make(map[string]interface{}) - if thumbprint := input.Thumbprint; thumbprint != nil { - output["thumbprint"] = *thumbprint - } + output["thumbprint"] = input.Thumbprint if thumbprint := input.ThumbprintSecondary; thumbprint != nil { output["thumbprint_secondary"] = *thumbprint } - output["x509_store_name"] = string(input.X509StoreName) + output["x509_store_name"] = input.X509StoreName results = append(results, output) } return results } -func expandServiceFabricClusterCertificateCommonNames(d *pluginsdk.ResourceData) *servicefabric.ServerCertificateCommonNames { +func expandServiceFabricClusterCertificateCommonNames(d *pluginsdk.ResourceData) *cluster.ServerCertificateCommonNames { i := d.Get("certificate_common_names").([]interface{}) if len(i) == 0 || i[0] == nil { return nil @@ -908,32 +927,30 @@ func expandServiceFabricClusterCertificateCommonNames(d *pluginsdk.ResourceData) input := i[0].(map[string]interface{}) commonNamesRaw := input["common_names"].(*pluginsdk.Set).List() - commonNames := make([]servicefabric.ServerCertificateCommonName, 0) + commonNames := make([]cluster.ServerCertificateCommonName, 0) for _, commonName := range commonNamesRaw { commonNameDetails := commonName.(map[string]interface{}) - certificateCommonName := commonNameDetails["certificate_common_name"].(string) - certificateIssuerThumbprint := commonNameDetails["certificate_issuer_thumbprint"].(string) - commonName := servicefabric.ServerCertificateCommonName{ - CertificateCommonName: &certificateCommonName, - CertificateIssuerThumbprint: &certificateIssuerThumbprint, + commonName := cluster.ServerCertificateCommonName{ + CertificateCommonName: commonNameDetails["certificate_common_name"].(string), + CertificateIssuerThumbprint: commonNameDetails["certificate_issuer_thumbprint"].(string), } commonNames = append(commonNames, commonName) } - x509StoreName := input["x509_store_name"].(string) + x509StoreName := cluster.X509StoreName(input["x509_store_name"].(string)) - output := servicefabric.ServerCertificateCommonNames{ + output := cluster.ServerCertificateCommonNames{ CommonNames: &commonNames, - X509StoreName: servicefabric.X509StoreName1(x509StoreName), + X509StoreName: &x509StoreName, } return &output } -func expandServiceFabricClusterReverseProxyCertificateCommonNames(d *pluginsdk.ResourceData) *servicefabric.ServerCertificateCommonNames { +func expandServiceFabricClusterReverseProxyCertificateCommonNames(d *pluginsdk.ResourceData) *cluster.ServerCertificateCommonNames { i := d.Get("reverse_proxy_certificate_common_names").([]interface{}) if len(i) == 0 || i[0] == nil { return nil @@ -941,32 +958,30 @@ func expandServiceFabricClusterReverseProxyCertificateCommonNames(d *pluginsdk.R input := i[0].(map[string]interface{}) commonNamesRaw := input["common_names"].(*pluginsdk.Set).List() - commonNames := make([]servicefabric.ServerCertificateCommonName, 0) + commonNames := make([]cluster.ServerCertificateCommonName, 0) for _, commonName := range commonNamesRaw { commonNameDetails := commonName.(map[string]interface{}) - certificateCommonName := commonNameDetails["certificate_common_name"].(string) - certificateIssuerThumbprint := commonNameDetails["certificate_issuer_thumbprint"].(string) - commonName := servicefabric.ServerCertificateCommonName{ - CertificateCommonName: &certificateCommonName, - CertificateIssuerThumbprint: &certificateIssuerThumbprint, + commonName := cluster.ServerCertificateCommonName{ + CertificateCommonName: commonNameDetails["certificate_common_name"].(string), + CertificateIssuerThumbprint: commonNameDetails["certificate_issuer_thumbprint"].(string), } commonNames = append(commonNames, commonName) } - x509StoreName := input["x509_store_name"].(string) + x509StoreName := cluster.X509StoreName(input["x509_store_name"].(string)) - output := servicefabric.ServerCertificateCommonNames{ + output := cluster.ServerCertificateCommonNames{ CommonNames: &commonNames, - X509StoreName: servicefabric.X509StoreName1(x509StoreName), + X509StoreName: &x509StoreName, } return &output } -func flattenServiceFabricClusterCertificateCommonNames(in *servicefabric.ServerCertificateCommonNames) []interface{} { +func flattenServiceFabricClusterCertificateCommonNames(in *cluster.ServerCertificateCommonNames) []interface{} { if in == nil { return []interface{}{} } @@ -978,13 +993,8 @@ func flattenServiceFabricClusterCertificateCommonNames(in *servicefabric.ServerC for _, i := range *commonNames { commonName := make(map[string]interface{}) - if i.CertificateCommonName != nil { - commonName["certificate_common_name"] = *i.CertificateCommonName - } - - if i.CertificateIssuerThumbprint != nil { - commonName["certificate_issuer_thumbprint"] = *i.CertificateIssuerThumbprint - } + commonName["certificate_common_name"] = i.CertificateCommonName + commonName["certificate_issuer_thumbprint"] = i.CertificateIssuerThumbprint common_names = append(common_names, commonName) } @@ -992,24 +1002,23 @@ func flattenServiceFabricClusterCertificateCommonNames(in *servicefabric.ServerC output["common_names"] = common_names } - output["x509_store_name"] = string(in.X509StoreName) + output["x509_store_name"] = in.X509StoreName return []interface{}{output} } -func expandServiceFabricClusterReverseProxyCertificate(input []interface{}) *servicefabric.CertificateDescription { +func expandServiceFabricClusterReverseProxyCertificate(input []interface{}) *cluster.CertificateDescription { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - thumbprint := v["thumbprint"].(string) - x509StoreName := v["x509_store_name"].(string) + x509StoreName := cluster.X509StoreName(v["x509_store_name"].(string)) - result := servicefabric.CertificateDescription{ - Thumbprint: utils.String(thumbprint), - X509StoreName: servicefabric.X509StoreName(x509StoreName), + result := cluster.CertificateDescription{ + Thumbprint: v["thumbprint"].(string), + X509StoreName: &x509StoreName, } if thumb, ok := v["thumbprint_secondary"]; ok { @@ -1019,39 +1028,34 @@ func expandServiceFabricClusterReverseProxyCertificate(input []interface{}) *ser return &result } -func flattenServiceFabricClusterReverseProxyCertificate(input *servicefabric.CertificateDescription) []interface{} { +func flattenServiceFabricClusterReverseProxyCertificate(input *cluster.CertificateDescription) []interface{} { results := make([]interface{}, 0) if v := input; v != nil { output := make(map[string]interface{}) - if thumbprint := input.Thumbprint; thumbprint != nil { - output["thumbprint"] = *thumbprint - } + output["thumbprint"] = input.Thumbprint if thumbprint := input.ThumbprintSecondary; thumbprint != nil { output["thumbprint_secondary"] = *thumbprint } - output["x509_store_name"] = string(input.X509StoreName) + output["x509_store_name"] = input.X509StoreName results = append(results, output) } return results } -func expandServiceFabricClusterClientCertificateThumbprints(input []interface{}) *[]servicefabric.ClientCertificateThumbprint { - results := make([]servicefabric.ClientCertificateThumbprint, 0) +func expandServiceFabricClusterClientCertificateThumbprints(input []interface{}) *[]cluster.ClientCertificateThumbprint { + results := make([]cluster.ClientCertificateThumbprint, 0) for _, v := range input { val := v.(map[string]interface{}) - thumbprint := val["thumbprint"].(string) - isAdmin := val["is_admin"].(bool) - - result := servicefabric.ClientCertificateThumbprint{ - CertificateThumbprint: utils.String(thumbprint), - IsAdmin: utils.Bool(isAdmin), + result := cluster.ClientCertificateThumbprint{ + CertificateThumbprint: val["thumbprint"].(string), + IsAdmin: val["is_admin"].(bool), } results = append(results, result) } @@ -1059,7 +1063,7 @@ func expandServiceFabricClusterClientCertificateThumbprints(input []interface{}) return &results } -func flattenServiceFabricClusterClientCertificateThumbprints(input *[]servicefabric.ClientCertificateThumbprint) []interface{} { +func flattenServiceFabricClusterClientCertificateThumbprints(input *[]cluster.ClientCertificateThumbprint) []interface{} { if input == nil { return []interface{}{} } @@ -1069,13 +1073,8 @@ func flattenServiceFabricClusterClientCertificateThumbprints(input *[]servicefab for _, v := range *input { result := make(map[string]interface{}) - if thumbprint := v.CertificateThumbprint; thumbprint != nil { - result["thumbprint"] = *thumbprint - } - - if isAdmin := v.IsAdmin; isAdmin != nil { - result["is_admin"] = *isAdmin - } + result["thumbprint"] = v.CertificateThumbprint + result["is_admin"] = v.IsAdmin results = append(results, result) } @@ -1083,20 +1082,20 @@ func flattenServiceFabricClusterClientCertificateThumbprints(input *[]servicefab return results } -func expandServiceFabricClusterClientCertificateCommonNames(input []interface{}) *[]servicefabric.ClientCertificateCommonName { - results := make([]servicefabric.ClientCertificateCommonName, 0) +func expandServiceFabricClusterClientCertificateCommonNames(input []interface{}) *[]cluster.ClientCertificateCommonName { + results := make([]cluster.ClientCertificateCommonName, 0) for _, v := range input { val := v.(map[string]interface{}) - certificate_common_name := val["common_name"].(string) - certificate_issuer_thumbprint := val["issuer_thumbprint"].(string) + certificateCommonName := val["common_name"].(string) + certificateIssuerThumbprint := val["issuer_thumbprint"].(string) isAdmin := val["is_admin"].(bool) - result := servicefabric.ClientCertificateCommonName{ - CertificateCommonName: utils.String(certificate_common_name), - CertificateIssuerThumbprint: utils.String(certificate_issuer_thumbprint), - IsAdmin: utils.Bool(isAdmin), + result := cluster.ClientCertificateCommonName{ + CertificateCommonName: certificateCommonName, + CertificateIssuerThumbprint: certificateIssuerThumbprint, + IsAdmin: isAdmin, } results = append(results, result) } @@ -1104,7 +1103,7 @@ func expandServiceFabricClusterClientCertificateCommonNames(input []interface{}) return &results } -func flattenServiceFabricClusterClientCertificateCommonNames(input *[]servicefabric.ClientCertificateCommonName) []interface{} { +func flattenServiceFabricClusterClientCertificateCommonNames(input *[]cluster.ClientCertificateCommonName) []interface{} { if input == nil { return []interface{}{} } @@ -1114,71 +1113,44 @@ func flattenServiceFabricClusterClientCertificateCommonNames(input *[]servicefab for _, v := range *input { result := make(map[string]interface{}) - if certificate_common_name := v.CertificateCommonName; certificate_common_name != nil { - result["common_name"] = *certificate_common_name - } - - if certificate_issuer_thumbprint := v.CertificateIssuerThumbprint; certificate_issuer_thumbprint != nil { - result["issuer_thumbprint"] = *certificate_issuer_thumbprint - } + result["common_name"] = v.CertificateCommonName + result["issuer_thumbprint"] = v.CertificateIssuerThumbprint + result["is_admin"] = v.IsAdmin - if isAdmin := v.IsAdmin; isAdmin != nil { - result["is_admin"] = *isAdmin - } results = append(results, result) } return results } -func expandServiceFabricClusterDiagnosticsConfig(input []interface{}) *servicefabric.DiagnosticsStorageAccountConfig { +func expandServiceFabricClusterDiagnosticsConfig(input []interface{}) *cluster.DiagnosticsStorageAccountConfig { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - storageAccountName := v["storage_account_name"].(string) - protectedAccountKeyName := v["protected_account_key_name"].(string) - blobEndpoint := v["blob_endpoint"].(string) - queueEndpoint := v["queue_endpoint"].(string) - tableEndpoint := v["table_endpoint"].(string) - - config := servicefabric.DiagnosticsStorageAccountConfig{ - StorageAccountName: utils.String(storageAccountName), - ProtectedAccountKeyName: utils.String(protectedAccountKeyName), - BlobEndpoint: utils.String(blobEndpoint), - QueueEndpoint: utils.String(queueEndpoint), - TableEndpoint: utils.String(tableEndpoint), + config := cluster.DiagnosticsStorageAccountConfig{ + StorageAccountName: v["storage_account_name"].(string), + ProtectedAccountKeyName: v["protected_account_key_name"].(string), + BlobEndpoint: v["blob_endpoint"].(string), + QueueEndpoint: v["queue_endpoint"].(string), + TableEndpoint: v["table_endpoint"].(string), } return &config } -func flattenServiceFabricClusterDiagnosticsConfig(input *servicefabric.DiagnosticsStorageAccountConfig) []interface{} { +func flattenServiceFabricClusterDiagnosticsConfig(input *cluster.DiagnosticsStorageAccountConfig) []interface{} { results := make([]interface{}, 0) if v := input; v != nil { output := make(map[string]interface{}) - if name := v.StorageAccountName; name != nil { - output["storage_account_name"] = *name - } - - if name := v.ProtectedAccountKeyName; name != nil { - output["protected_account_key_name"] = *name - } - - if endpoint := v.BlobEndpoint; endpoint != nil { - output["blob_endpoint"] = *endpoint - } - - if endpoint := v.QueueEndpoint; endpoint != nil { - output["queue_endpoint"] = *endpoint - } - - if endpoint := v.TableEndpoint; endpoint != nil { - output["table_endpoint"] = *endpoint - } + output["storage_account_name"] = v.StorageAccountName + output["protected_account_key_name"] = v.ProtectedAccountKeyName + output["blob_endpoint"] = v.BlobEndpoint + output["queue_endpoint"] = v.QueueEndpoint + output["table_endpoint"] = v.TableEndpoint results = append(results, output) } @@ -1186,48 +1158,48 @@ func flattenServiceFabricClusterDiagnosticsConfig(input *servicefabric.Diagnosti return results } -func expandServiceFabricClusterUpgradePolicyDeltaHealthPolicy(input []interface{}) *servicefabric.ClusterUpgradeDeltaHealthPolicy { +func expandServiceFabricClusterUpgradePolicyDeltaHealthPolicy(input []interface{}) *cluster.ClusterUpgradeDeltaHealthPolicy { if len(input) == 0 || input[0] == nil { return nil } - deltaHealthPolicy := &servicefabric.ClusterUpgradeDeltaHealthPolicy{} + deltaHealthPolicy := &cluster.ClusterUpgradeDeltaHealthPolicy{} v := input[0].(map[string]interface{}) - deltaHealthPolicy.MaxPercentDeltaUnhealthyNodes = utils.Int32(int32(v["max_delta_unhealthy_nodes_percent"].(int))) - deltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes = utils.Int32(int32(v["max_upgrade_domain_delta_unhealthy_nodes_percent"].(int))) - deltaHealthPolicy.MaxPercentDeltaUnhealthyApplications = utils.Int32(int32(v["max_delta_unhealthy_applications_percent"].(int))) + deltaHealthPolicy.MaxPercentDeltaUnhealthyNodes = int64(v["max_delta_unhealthy_nodes_percent"].(int)) + deltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes = int64(v["max_upgrade_domain_delta_unhealthy_nodes_percent"].(int)) + deltaHealthPolicy.MaxPercentDeltaUnhealthyApplications = int64(v["max_delta_unhealthy_applications_percent"].(int)) return deltaHealthPolicy } -func expandServiceFabricClusterUpgradePolicyHealthPolicy(input []interface{}) *servicefabric.ClusterHealthPolicy { +func expandServiceFabricClusterUpgradePolicyHealthPolicy(input []interface{}) cluster.ClusterHealthPolicy { + healthPolicy := cluster.ClusterHealthPolicy{} if len(input) == 0 || input[0] == nil { - return nil + return healthPolicy } - healthPolicy := &servicefabric.ClusterHealthPolicy{} v := input[0].(map[string]interface{}) - healthPolicy.MaxPercentUnhealthyApplications = utils.Int32(int32(v["max_unhealthy_applications_percent"].(int))) - healthPolicy.MaxPercentUnhealthyNodes = utils.Int32(int32(v["max_unhealthy_nodes_percent"].(int))) + healthPolicy.MaxPercentUnhealthyApplications = utils.Int64(int64(v["max_unhealthy_applications_percent"].(int))) + healthPolicy.MaxPercentUnhealthyNodes = utils.Int64(int64(v["max_unhealthy_nodes_percent"].(int))) return healthPolicy } -func expandServiceFabricClusterUpgradePolicy(input []interface{}) *servicefabric.ClusterUpgradePolicy { +func expandServiceFabricClusterUpgradePolicy(input []interface{}) *cluster.ClusterUpgradePolicy { if len(input) == 0 || input[0] == nil { return nil } - policy := &servicefabric.ClusterUpgradePolicy{} + policy := &cluster.ClusterUpgradePolicy{} v := input[0].(map[string]interface{}) policy.ForceRestart = utils.Bool(v["force_restart_enabled"].(bool)) - policy.HealthCheckStableDuration = utils.String(v["health_check_stable_duration"].(string)) - policy.UpgradeDomainTimeout = utils.String(v["upgrade_domain_timeout"].(string)) - policy.UpgradeReplicaSetCheckTimeout = utils.String(v["upgrade_replica_set_check_timeout"].(string)) - policy.UpgradeTimeout = utils.String(v["upgrade_timeout"].(string)) - policy.HealthCheckRetryTimeout = utils.String(v["health_check_retry_timeout"].(string)) - policy.HealthCheckWaitDuration = utils.String(v["health_check_wait_duration"].(string)) + policy.HealthCheckStableDuration = v["health_check_stable_duration"].(string) + policy.UpgradeDomainTimeout = v["upgrade_domain_timeout"].(string) + policy.UpgradeReplicaSetCheckTimeout = v["upgrade_replica_set_check_timeout"].(string) + policy.UpgradeTimeout = v["upgrade_timeout"].(string) + policy.HealthCheckRetryTimeout = v["health_check_retry_timeout"].(string) + policy.HealthCheckWaitDuration = v["health_check_wait_duration"].(string) if v["health_policy"] != nil { policy.HealthPolicy = expandServiceFabricClusterUpgradePolicyHealthPolicy(v["health_policy"].([]interface{})) @@ -1239,7 +1211,7 @@ func expandServiceFabricClusterUpgradePolicy(input []interface{}) *servicefabric return policy } -func flattenServiceFabricClusterUpgradePolicy(input *servicefabric.ClusterUpgradePolicy) []interface{} { +func flattenServiceFabricClusterUpgradePolicy(input *cluster.ClusterUpgradePolicy) []interface{} { if input == nil { return []interface{}{} } @@ -1250,29 +1222,12 @@ func flattenServiceFabricClusterUpgradePolicy(input *servicefabric.ClusterUpgrad output["force_restart_enabled"] = *forceRestart } - if healthCheckRetryTimeout := input.HealthCheckRetryTimeout; healthCheckRetryTimeout != nil { - output["health_check_retry_timeout"] = *healthCheckRetryTimeout - } - - if healthCheckStableDuration := input.HealthCheckStableDuration; healthCheckStableDuration != nil { - output["health_check_stable_duration"] = *healthCheckStableDuration - } - - if healthCheckWaitDuration := input.HealthCheckWaitDuration; healthCheckWaitDuration != nil { - output["health_check_wait_duration"] = *healthCheckWaitDuration - } - - if upgradeDomainTimeout := input.UpgradeDomainTimeout; upgradeDomainTimeout != nil { - output["upgrade_domain_timeout"] = *upgradeDomainTimeout - } - - if upgradeReplicaSetCheckTimeout := input.UpgradeReplicaSetCheckTimeout; upgradeReplicaSetCheckTimeout != nil { - output["upgrade_replica_set_check_timeout"] = *upgradeReplicaSetCheckTimeout - } - - if upgradeTimeout := input.UpgradeTimeout; upgradeTimeout != nil { - output["upgrade_timeout"] = *upgradeTimeout - } + output["health_check_retry_timeout"] = input.HealthCheckRetryTimeout + output["health_check_stable_duration"] = input.HealthCheckStableDuration + output["health_check_wait_duration"] = input.HealthCheckWaitDuration + output["upgrade_domain_timeout"] = input.UpgradeDomainTimeout + output["upgrade_replica_set_check_timeout"] = input.UpgradeReplicaSetCheckTimeout + output["upgrade_timeout"] = input.UpgradeTimeout output["health_policy"] = flattenServiceFabricClusterUpgradePolicyHealthPolicy(input.HealthPolicy) output["delta_health_policy"] = flattenServiceFabricClusterUpgradePolicyDeltaHealthPolicy(input.DeltaHealthPolicy) @@ -1280,11 +1235,7 @@ func flattenServiceFabricClusterUpgradePolicy(input *servicefabric.ClusterUpgrad return []interface{}{output} } -func flattenServiceFabricClusterUpgradePolicyHealthPolicy(input *servicefabric.ClusterHealthPolicy) []interface{} { - if input == nil { - return []interface{}{} - } - +func flattenServiceFabricClusterUpgradePolicyHealthPolicy(input cluster.ClusterHealthPolicy) []interface{} { output := make(map[string]interface{}) if input.MaxPercentUnhealthyApplications != nil { @@ -1298,48 +1249,40 @@ func flattenServiceFabricClusterUpgradePolicyHealthPolicy(input *servicefabric.C return []interface{}{output} } -func flattenServiceFabricClusterUpgradePolicyDeltaHealthPolicy(input *servicefabric.ClusterUpgradeDeltaHealthPolicy) []interface{} { +func flattenServiceFabricClusterUpgradePolicyDeltaHealthPolicy(input *cluster.ClusterUpgradeDeltaHealthPolicy) []interface{} { if input == nil { return []interface{}{} } output := make(map[string]interface{}) - if input.MaxPercentDeltaUnhealthyApplications != nil { - output["max_delta_unhealthy_applications_percent"] = input.MaxPercentDeltaUnhealthyApplications - } - - if input.MaxPercentDeltaUnhealthyNodes != nil { - output["max_delta_unhealthy_nodes_percent"] = input.MaxPercentDeltaUnhealthyNodes - } - - if input.MaxPercentUpgradeDomainDeltaUnhealthyNodes != nil { - output["max_upgrade_domain_delta_unhealthy_nodes_percent"] = input.MaxPercentUpgradeDomainDeltaUnhealthyNodes - } + output["max_delta_unhealthy_applications_percent"] = input.MaxPercentDeltaUnhealthyApplications + output["max_delta_unhealthy_nodes_percent"] = input.MaxPercentDeltaUnhealthyNodes + output["max_upgrade_domain_delta_unhealthy_nodes_percent"] = input.MaxPercentUpgradeDomainDeltaUnhealthyNodes return []interface{}{output} } -func expandServiceFabricClusterFabricSettings(input []interface{}) *[]servicefabric.SettingsSectionDescription { - results := make([]servicefabric.SettingsSectionDescription, 0) +func expandServiceFabricClusterFabricSettings(input []interface{}) *[]cluster.SettingsSectionDescription { + results := make([]cluster.SettingsSectionDescription, 0) for _, v := range input { val := v.(map[string]interface{}) name := val["name"].(string) - params := make([]servicefabric.SettingsParameterDescription, 0) + params := make([]cluster.SettingsParameterDescription, 0) paramsRaw := val["parameters"].(map[string]interface{}) for k, v := range paramsRaw { - param := servicefabric.SettingsParameterDescription{ - Name: utils.String(k), - Value: utils.String(v.(string)), + param := cluster.SettingsParameterDescription{ + Name: k, + Value: v.(string), } params = append(params, param) } - result := servicefabric.SettingsSectionDescription{ - Name: utils.String(name), - Parameters: ¶ms, + result := cluster.SettingsSectionDescription{ + Name: name, + Parameters: params, } results = append(results, result) } @@ -1347,7 +1290,7 @@ func expandServiceFabricClusterFabricSettings(input []interface{}) *[]servicefab return &results } -func flattenServiceFabricClusterFabricSettings(input *[]servicefabric.SettingsSectionDescription) []interface{} { +func flattenServiceFabricClusterFabricSettings(input *[]cluster.SettingsSectionDescription) []interface{} { if input == nil { return []interface{}{} } @@ -1357,18 +1300,12 @@ func flattenServiceFabricClusterFabricSettings(input *[]servicefabric.SettingsSe for _, v := range *input { result := make(map[string]interface{}) - if name := v.Name; name != nil { - result["name"] = *name - } + result["name"] = v.Name parameters := make(map[string]interface{}) if paramsRaw := v.Parameters; paramsRaw != nil { - for _, p := range *paramsRaw { - if p.Name == nil || p.Value == nil { - continue - } - - parameters[*p.Name] = *p.Value + for _, p := range paramsRaw { + parameters[p.Name] = p.Value } } result["parameters"] = parameters @@ -1378,26 +1315,21 @@ func flattenServiceFabricClusterFabricSettings(input *[]servicefabric.SettingsSe return results } -func expandServiceFabricClusterNodeTypes(input []interface{}) *[]servicefabric.NodeTypeDescription { - results := make([]servicefabric.NodeTypeDescription, 0) +func expandServiceFabricClusterNodeTypes(input []interface{}) []cluster.NodeTypeDescription { + results := make([]cluster.NodeTypeDescription, 0) for _, v := range input { node := v.(map[string]interface{}) - name := node["name"].(string) - instanceCount := node["instance_count"].(int) - clientEndpointPort := node["client_endpoint_port"].(int) - httpEndpointPort := node["http_endpoint_port"].(int) - isPrimary := node["is_primary"].(bool) - durabilityLevel := node["durability_level"].(string) - - result := servicefabric.NodeTypeDescription{ - Name: utils.String(name), - VMInstanceCount: utils.Int32(int32(instanceCount)), - IsPrimary: utils.Bool(isPrimary), - ClientConnectionEndpointPort: utils.Int32(int32(clientEndpointPort)), - HTTPGatewayEndpointPort: utils.Int32(int32(httpEndpointPort)), - DurabilityLevel: servicefabric.DurabilityLevel(durabilityLevel), + durabilityLevel := cluster.DurabilityLevel(node["durability_level"].(string)) + + result := cluster.NodeTypeDescription{ + Name: node["name"].(string), + VMInstanceCount: int64(node["instance_count"].(int)), + IsPrimary: node["is_primary"].(bool), + ClientConnectionEndpointPort: int64(node["client_endpoint_port"].(int)), + HTTPGatewayEndpointPort: int64(node["http_endpoint_port"].(int)), + DurabilityLevel: &durabilityLevel, } if isStateless, ok := node["is_stateless"]; ok { @@ -1409,37 +1341,34 @@ func expandServiceFabricClusterNodeTypes(input []interface{}) *[]servicefabric.N } if props, ok := node["placement_properties"]; ok { - placementProperties := make(map[string]*string) + placementProperties := make(map[string]string) for key, value := range props.(map[string]interface{}) { - placementProperties[key] = utils.String(value.(string)) + placementProperties[key] = value.(string) } - result.PlacementProperties = placementProperties + result.PlacementProperties = &placementProperties } if caps, ok := node["capacities"]; ok { - capacities := make(map[string]*string) + capacities := make(map[string]string) for key, value := range caps.(map[string]interface{}) { - capacities[key] = utils.String(value.(string)) + capacities[key] = value.(string) } - result.Capacities = capacities + result.Capacities = &capacities } - if v := int32(node["reverse_proxy_endpoint_port"].(int)); v != 0 { - result.ReverseProxyEndpointPort = utils.Int32(v) + if v := int64(node["reverse_proxy_endpoint_port"].(int)); v != 0 { + result.ReverseProxyEndpointPort = utils.Int64(v) } applicationPortsRaw := node["application_ports"].([]interface{}) if len(applicationPortsRaw) > 0 { portsRaw := applicationPortsRaw[0].(map[string]interface{}) - startPort := portsRaw["start_port"].(int) - endPort := portsRaw["end_port"].(int) - - result.ApplicationPorts = &servicefabric.EndpointRangeDescription{ - StartPort: utils.Int32(int32(startPort)), - EndPort: utils.Int32(int32(endPort)), + result.ApplicationPorts = &cluster.EndpointRangeDescription{ + StartPort: int64(portsRaw["start_port"].(int)), + EndPort: int64(portsRaw["end_port"].(int)), } } @@ -1447,57 +1376,40 @@ func expandServiceFabricClusterNodeTypes(input []interface{}) *[]servicefabric.N if len(ephemeralPortsRaw) > 0 { portsRaw := ephemeralPortsRaw[0].(map[string]interface{}) - startPort := portsRaw["start_port"].(int) - endPort := portsRaw["end_port"].(int) - - result.EphemeralPorts = &servicefabric.EndpointRangeDescription{ - StartPort: utils.Int32(int32(startPort)), - EndPort: utils.Int32(int32(endPort)), + result.EphemeralPorts = &cluster.EndpointRangeDescription{ + StartPort: int64(portsRaw["start_port"].(int)), + EndPort: int64(portsRaw["end_port"].(int)), } } results = append(results, result) } - return &results + return results } -func flattenServiceFabricClusterNodeTypes(input *[]servicefabric.NodeTypeDescription) []interface{} { +func flattenServiceFabricClusterNodeTypes(input []cluster.NodeTypeDescription) []interface{} { if input == nil { return []interface{}{} } results := make([]interface{}, 0) - for _, v := range *input { + for _, v := range input { output := make(map[string]interface{}) - if name := v.Name; name != nil { - output["name"] = *name - } + output["name"] = v.Name + output["instance_count"] = v.VMInstanceCount + output["is_primary"] = v.IsPrimary + output["client_endpoint_port"] = v.ClientConnectionEndpointPort + output["http_endpoint_port"] = v.HTTPGatewayEndpointPort if placementProperties := v.PlacementProperties; placementProperties != nil { - output["placement_properties"] = placementProperties + output["placement_properties"] = *placementProperties } if capacities := v.Capacities; capacities != nil { - output["capacities"] = capacities - } - - if count := v.VMInstanceCount; count != nil { - output["instance_count"] = int(*count) - } - - if primary := v.IsPrimary; primary != nil { - output["is_primary"] = *primary - } - - if port := v.ClientConnectionEndpointPort; port != nil { - output["client_endpoint_port"] = *port - } - - if port := v.HTTPGatewayEndpointPort; port != nil { - output["http_endpoint_port"] = *port + output["capacities"] = *capacities } if port := v.ReverseProxyEndpointPort; port != nil { @@ -1512,17 +1424,15 @@ func flattenServiceFabricClusterNodeTypes(input *[]servicefabric.NodeTypeDescrip output["multiple_availability_zones"] = *multipleAvailabilityZones } - output["durability_level"] = string(v.DurabilityLevel) + if durabilityLevel := v.DurabilityLevel; durabilityLevel != nil { + output["durability_level"] = string(*v.DurabilityLevel) + } applicationPorts := make([]interface{}, 0) if ports := v.ApplicationPorts; ports != nil { r := make(map[string]interface{}) - if start := ports.StartPort; start != nil { - r["start_port"] = int(*start) - } - if end := ports.EndPort; end != nil { - r["end_port"] = int(*end) - } + r["start_port"] = int(ports.StartPort) + r["end_port"] = int(ports.EndPort) applicationPorts = append(applicationPorts, r) } output["application_ports"] = applicationPorts @@ -1530,12 +1440,8 @@ func flattenServiceFabricClusterNodeTypes(input *[]servicefabric.NodeTypeDescrip ephemeralPorts := make([]interface{}, 0) if ports := v.EphemeralPorts; ports != nil { r := make(map[string]interface{}) - if start := ports.StartPort; start != nil { - r["start_port"] = int(*start) - } - if end := ports.EndPort; end != nil { - r["end_port"] = int(*end) - } + r["start_port"] = int(ports.StartPort) + r["end_port"] = int(ports.EndPort) ephemeralPorts = append(ephemeralPorts, r) } output["ephemeral_ports"] = ephemeralPorts diff --git a/internal/services/servicefabric/service_fabric_cluster_resource_test.go b/internal/services/servicefabric/service_fabric_cluster_resource_test.go index 3e15ba748a15..cce02f9e1a2a 100644 --- a/internal/services/servicefabric/service_fabric_cluster_resource_test.go +++ b/internal/services/servicefabric/service_fabric_cluster_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -768,16 +769,16 @@ func TestAccAzureRMServiceFabricCluster_zonalUpgradeMode(t *testing.T) { } func (r ServiceFabricClusterResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ClusterID(state.ID) + id, err := cluster.ParseClusterID(state.ID) if err != nil { return nil, err } - resp, err := client.ServiceFabric.ClustersClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.ServiceFabric.ClustersClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } - return nil, fmt.Errorf("retrieving Service Fabric Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", id.ID(), err) } return utils.Bool(true), nil } diff --git a/internal/services/servicefabric/validate/cluster_id.go b/internal/services/servicefabric/validate/cluster_id.go deleted file mode 100644 index 410f3ec62791..000000000000 --- a/internal/services/servicefabric/validate/cluster_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/parse" -) - -func ClusterID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ClusterID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/servicefabric/validate/cluster_id_test.go b/internal/services/servicefabric/validate/cluster_id_test.go deleted file mode 100644 index 43647f3593fb..000000000000 --- a/internal/services/servicefabric/validate/cluster_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestClusterID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/cluster1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.SERVICEFABRIC/CLUSTERS/CLUSTER1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ClusterID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/_meta.json deleted file mode 100644 index 64df01fa2f3d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "51b37b069ecbb9d2fcd300eabd4b10b7911b7d7d", - "readme": "/_/azure-rest-api-specs/specification/servicefabric/resource-manager/readme.md", - "tag": "package-2021-06", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/servicefabric/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applications.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applications.go deleted file mode 100644 index fb84001fe136..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applications.go +++ /dev/null @@ -1,435 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// ApplicationsClient is the service Fabric Management Client -type ApplicationsClient struct { - BaseClient -} - -// NewApplicationsClient creates an instance of the ApplicationsClient client. -func NewApplicationsClient(subscriptionID string) ApplicationsClient { - return NewApplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationsClientWithBaseURI creates an instance of the ApplicationsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient { - return ApplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Service Fabric application resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// parameters - the application resource. -func (client ApplicationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationResource) (result ApplicationsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, applicationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - 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.ServiceFabric/clusters/{clusterName}/applications/{applicationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Service Fabric application resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -func (client ApplicationsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (result ApplicationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}", 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 ApplicationsClient) DeleteSender(req *http.Request) (future ApplicationsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Service Fabric application resource created or in the process of being created in the Service Fabric -// cluster resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -func (client ApplicationsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (result ApplicationResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.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, clusterName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}", 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 ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) GetResponder(resp *http.Response) (result ApplicationResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all application resources created or in the process of being created in the Service Fabric cluster -// resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -func (client ApplicationsClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result ApplicationResourceList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications", 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 ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update a Service Fabric application resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// parameters - the application resource for patch operations. -func (client ApplicationsClient) Update(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationResourceUpdate) (result ApplicationsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, applicationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ApplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationResourceUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - 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.ServiceFabric/clusters/{clusterName}/applications/{applicationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) UpdateSender(req *http.Request) (future ApplicationsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) UpdateResponder(resp *http.Response) (result ApplicationResource, err error) { - err = autorest.Respond( - resp, - 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/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypes.go deleted file mode 100644 index c6f9d26c3667..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypes.go +++ /dev/null @@ -1,349 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// ApplicationTypesClient is the service Fabric Management Client -type ApplicationTypesClient struct { - BaseClient -} - -// NewApplicationTypesClient creates an instance of the ApplicationTypesClient client. -func NewApplicationTypesClient(subscriptionID string) ApplicationTypesClient { - return NewApplicationTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationTypesClientWithBaseURI creates an instance of the ApplicationTypesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewApplicationTypesClientWithBaseURI(baseURI string, subscriptionID string) ApplicationTypesClient { - return ApplicationTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Service Fabric application type name resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -// parameters - the application type name resource. -func (client ApplicationTypesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, parameters ApplicationTypeResource) (result ApplicationTypeResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypesClient.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, clusterName, applicationTypeName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationTypesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, parameters ApplicationTypeResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - 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.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationTypesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationTypesClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationTypeResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Service Fabric application type name resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -func (client ApplicationTypesClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (result ApplicationTypesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, applicationTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationTypesClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}", 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 ApplicationTypesClient) DeleteSender(req *http.Request) (future ApplicationTypesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationTypesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Service Fabric application type name resource created or in the process of being created in the Service -// Fabric cluster resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -func (client ApplicationTypesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (result ApplicationTypeResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypesClient.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, clusterName, applicationTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationTypesClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}", 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 ApplicationTypesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationTypesClient) GetResponder(resp *http.Response) (result ApplicationTypeResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all application type name resources created or in the process of being created in the Service Fabric -// cluster resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -func (client ApplicationTypesClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result ApplicationTypeResourceList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes", 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 ApplicationTypesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationTypesClient) ListResponder(resp *http.Response) (result ApplicationTypeResourceList, err error) { - err = autorest.Respond( - resp, - 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/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypeversions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypeversions.go deleted file mode 100644 index 6159c40d6748..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypeversions.go +++ /dev/null @@ -1,368 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// ApplicationTypeVersionsClient is the service Fabric Management Client -type ApplicationTypeVersionsClient struct { - BaseClient -} - -// NewApplicationTypeVersionsClient creates an instance of the ApplicationTypeVersionsClient client. -func NewApplicationTypeVersionsClient(subscriptionID string) ApplicationTypeVersionsClient { - return NewApplicationTypeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationTypeVersionsClientWithBaseURI creates an instance of the ApplicationTypeVersionsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewApplicationTypeVersionsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationTypeVersionsClient { - return ApplicationTypeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Service Fabric application type version resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -// version - the application type version. -// parameters - the application type version resource. -func (client ApplicationTypeVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string, parameters ApplicationTypeVersionResource) (result ApplicationTypeVersionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypeVersionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ApplicationTypeVersionResourceProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ApplicationTypeVersionResourceProperties.AppPackageURL", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("servicefabric.ApplicationTypeVersionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, applicationTypeName, version, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationTypeVersionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string, parameters ApplicationTypeVersionResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2021-06-01" - 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.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationTypeVersionsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationTypeVersionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationTypeVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationTypeVersionResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Service Fabric application type version resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -// version - the application type version. -func (client ApplicationTypeVersionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string) (result ApplicationTypeVersionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypeVersionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, applicationTypeName, version) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationTypeVersionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}", 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 ApplicationTypeVersionsClient) DeleteSender(req *http.Request) (future ApplicationTypeVersionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationTypeVersionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Service Fabric application type version resource created or in the process of being created in the Service -// Fabric application type name resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -// version - the application type version. -func (client ApplicationTypeVersionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string) (result ApplicationTypeVersionResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypeVersionsClient.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, clusterName, applicationTypeName, version) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationTypeVersionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}", 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 ApplicationTypeVersionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationTypeVersionsClient) GetResponder(resp *http.Response) (result ApplicationTypeVersionResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all application type version resources created or in the process of being created in the Service Fabric -// application type name resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -func (client ApplicationTypeVersionsClient) List(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (result ApplicationTypeVersionResourceList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypeVersionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName, applicationTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationTypeVersionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions", 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 ApplicationTypeVersionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationTypeVersionsClient) ListResponder(resp *http.Response) (result ApplicationTypeVersionResourceList, err error) { - err = autorest.Respond( - resp, - 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/servicefabric/mgmt/2021-06-01/servicefabric/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/client.go deleted file mode 100644 index 24211ad66430..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicefabric/armservicefabric](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicefabric/armservicefabric). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package servicefabric implements the Azure ARM Servicefabric service API version 2021-06-01. -// -// Service Fabric Management Client -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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 Servicefabric - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Servicefabric. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/clusters.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/clusters.go deleted file mode 100644 index f473ad513491..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/clusters.go +++ /dev/null @@ -1,642 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// ClustersClient is the service Fabric Management Client -type ClustersClient struct { - BaseClient -} - -// NewClustersClient creates an instance of the ClustersClient client. -func NewClustersClient(subscriptionID string) ClustersClient { - return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClustersClientWithBaseURI creates an instance of the ClustersClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { - return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Service Fabric cluster resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// parameters - the cluster resource. -func (client ClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster) (result ClustersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ClusterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.Certificate", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.Certificate.Thumbprint", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.StorageAccountName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.ProtectedAccountKeyName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.BlobEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.QueueEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.TableEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.ManagementEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.NodeTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.ReverseProxyCertificate", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.ReverseProxyCertificate.Thumbprint", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ClusterProperties.UpgradeDescription", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeReplicaSetCheckTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckWaitDuration", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckStableDuration", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckRetryTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeDomainTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - }}, - }}, - {Target: "parameters.ClusterProperties.ApplicationTypeVersionsCleanupPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.ApplicationTypeVersionsCleanupPolicy.MaxUnusedVersionsToKeep", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.ApplicationTypeVersionsCleanupPolicy.MaxUnusedVersionsToKeep", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("servicefabric.ClustersClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - 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.ServiceFabric/clusters/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) CreateOrUpdateSender(req *http.Request) (future ClustersCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ClustersClient) CreateOrUpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Service Fabric cluster resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -func (client ClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", 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 ClustersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Service Fabric cluster resource created or in the process of being created in the specified resource -// group. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.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, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", 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 ClustersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all Service Fabric cluster resources created or in the process of being created in the subscription. -func (client ClustersClient) List(ctx context.Context) (result ClusterListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters", 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 ClustersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets all Service Fabric cluster resources created or in the process of being created in the -// resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ClustersClient) ListByResourceGroupPreparer(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 = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUpgradableVersions if a target is not provided, it will get the minimum and maximum versions available from the -// current cluster version. If a target is given, it will provide the required path to get from the current cluster -// version to the target version. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// versionsDescription - the upgrade path description with target version. -func (client ClustersClient) ListUpgradableVersions(ctx context.Context, resourceGroupName string, clusterName string, versionsDescription *UpgradableVersionsDescription) (result UpgradableVersionPathResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListUpgradableVersions") - 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: versionsDescription, - Constraints: []validation.Constraint{{Target: "versionsDescription", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "versionsDescription.TargetVersion", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("servicefabric.ClustersClient", "ListUpgradableVersions", err.Error()) - } - - req, err := client.ListUpgradableVersionsPreparer(ctx, resourceGroupName, clusterName, versionsDescription) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListUpgradableVersions", nil, "Failure preparing request") - return - } - - resp, err := client.ListUpgradableVersionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListUpgradableVersions", resp, "Failure sending request") - return - } - - result, err = client.ListUpgradableVersionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListUpgradableVersions", resp, "Failure responding to request") - return - } - - return -} - -// ListUpgradableVersionsPreparer prepares the ListUpgradableVersions request. -func (client ClustersClient) ListUpgradableVersionsPreparer(ctx context.Context, resourceGroupName string, clusterName string, versionsDescription *UpgradableVersionsDescription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - 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.ServiceFabric/clusters/{clusterName}/listUpgradableVersions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if versionsDescription != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(versionsDescription)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUpgradableVersionsSender sends the ListUpgradableVersions request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListUpgradableVersionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUpgradableVersionsResponder handles the response to the ListUpgradableVersions request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListUpgradableVersionsResponder(resp *http.Response) (result UpgradableVersionPathResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update the configuration of a Service Fabric cluster resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// parameters - the parameters which contains the property value and property name which used to update the -// cluster configuration. -func (client ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdateParameters) (result ClustersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - 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.ServiceFabric/clusters/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) UpdateSender(req *http.Request) (future ClustersUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - 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/servicefabric/mgmt/2021-06-01/servicefabric/clusterversions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/clusterversions.go deleted file mode 100644 index e5af8279b207..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/clusterversions.go +++ /dev/null @@ -1,335 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// ClusterVersionsClient is the service Fabric Management Client -type ClusterVersionsClient struct { - BaseClient -} - -// NewClusterVersionsClient creates an instance of the ClusterVersionsClient client. -func NewClusterVersionsClient(subscriptionID string) ClusterVersionsClient { - return NewClusterVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClusterVersionsClientWithBaseURI creates an instance of the ClusterVersionsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClusterVersionsClientWithBaseURI(baseURI string, subscriptionID string) ClusterVersionsClient { - return ClusterVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets information about an available Service Fabric cluster code version. -// Parameters: -// location - the location for the cluster code versions. This is different from cluster location. -// clusterVersion - the cluster code version. -func (client ClusterVersionsClient) Get(ctx context.Context, location string, clusterVersion string) (result ClusterCodeVersionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterVersionsClient.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, location, clusterVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ClusterVersionsClient) GetPreparer(ctx context.Context, location string, clusterVersion string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterVersion": autorest.Encode("path", clusterVersion), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}", 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 ClusterVersionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ClusterVersionsClient) GetResponder(resp *http.Response) (result ClusterCodeVersionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByEnvironment gets information about an available Service Fabric cluster code version by environment. -// Parameters: -// location - the location for the cluster code versions. This is different from cluster location. -// environment - the operating system of the cluster. The default means all. -// clusterVersion - the cluster code version. -func (client ClusterVersionsClient) GetByEnvironment(ctx context.Context, location string, environment string, clusterVersion string) (result ClusterCodeVersionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterVersionsClient.GetByEnvironment") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByEnvironmentPreparer(ctx, location, environment, clusterVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "GetByEnvironment", nil, "Failure preparing request") - return - } - - resp, err := client.GetByEnvironmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "GetByEnvironment", resp, "Failure sending request") - return - } - - result, err = client.GetByEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "GetByEnvironment", resp, "Failure responding to request") - return - } - - return -} - -// GetByEnvironmentPreparer prepares the GetByEnvironment request. -func (client ClusterVersionsClient) GetByEnvironmentPreparer(ctx context.Context, location string, environment string, clusterVersion string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterVersion": autorest.Encode("path", clusterVersion), - "environment": autorest.Encode("path", environment), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByEnvironmentSender sends the GetByEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client ClusterVersionsClient) GetByEnvironmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByEnvironmentResponder handles the response to the GetByEnvironment request. The method always -// closes the http.Response Body. -func (client ClusterVersionsClient) GetByEnvironmentResponder(resp *http.Response) (result ClusterCodeVersionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all available code versions for Service Fabric cluster resources by location. -// Parameters: -// location - the location for the cluster code versions. This is different from cluster location. -func (client ClusterVersionsClient) List(ctx context.Context, location string) (result ClusterCodeVersionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterVersionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ClusterVersionsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions", 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 ClusterVersionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ClusterVersionsClient) ListResponder(resp *http.Response) (result ClusterCodeVersionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByEnvironment gets all available code versions for Service Fabric cluster resources by environment. -// Parameters: -// location - the location for the cluster code versions. This is different from cluster location. -// environment - the operating system of the cluster. The default means all. -func (client ClusterVersionsClient) ListByEnvironment(ctx context.Context, location string, environment string) (result ClusterCodeVersionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterVersionsClient.ListByEnvironment") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByEnvironmentPreparer(ctx, location, environment) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "ListByEnvironment", nil, "Failure preparing request") - return - } - - resp, err := client.ListByEnvironmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "ListByEnvironment", resp, "Failure sending request") - return - } - - result, err = client.ListByEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "ListByEnvironment", resp, "Failure responding to request") - return - } - - return -} - -// ListByEnvironmentPreparer prepares the ListByEnvironment request. -func (client ClusterVersionsClient) ListByEnvironmentPreparer(ctx context.Context, location string, environment string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "environment": autorest.Encode("path", environment), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByEnvironmentSender sends the ListByEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client ClusterVersionsClient) ListByEnvironmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByEnvironmentResponder handles the response to the ListByEnvironment request. The method always -// closes the http.Response Body. -func (client ClusterVersionsClient) ListByEnvironmentResponder(resp *http.Response) (result ClusterCodeVersionsListResult, err error) { - err = autorest.Respond( - resp, - 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/servicefabric/mgmt/2021-06-01/servicefabric/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/enums.go deleted file mode 100644 index d0728bb16f52..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/enums.go +++ /dev/null @@ -1,584 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ArmServicePackageActivationMode enumerates the values for arm service package activation mode. -type ArmServicePackageActivationMode string - -const ( - // ArmServicePackageActivationModeExclusiveProcess Indicates the application package activation mode will - // use exclusive process. - ArmServicePackageActivationModeExclusiveProcess ArmServicePackageActivationMode = "ExclusiveProcess" - // ArmServicePackageActivationModeSharedProcess Indicates the application package activation mode will use - // shared process. - ArmServicePackageActivationModeSharedProcess ArmServicePackageActivationMode = "SharedProcess" -) - -// PossibleArmServicePackageActivationModeValues returns an array of possible values for the ArmServicePackageActivationMode const type. -func PossibleArmServicePackageActivationModeValues() []ArmServicePackageActivationMode { - return []ArmServicePackageActivationMode{ArmServicePackageActivationModeExclusiveProcess, ArmServicePackageActivationModeSharedProcess} -} - -// ArmUpgradeFailureAction enumerates the values for arm upgrade failure action. -type ArmUpgradeFailureAction string - -const ( - // ArmUpgradeFailureActionManual Indicates that a manual repair will need to be performed by the - // administrator if the upgrade fails. Service Fabric will not proceed to the next upgrade domain - // automatically. - ArmUpgradeFailureActionManual ArmUpgradeFailureAction = "Manual" - // ArmUpgradeFailureActionRollback Indicates that a rollback of the upgrade will be performed by Service - // Fabric if the upgrade fails. - ArmUpgradeFailureActionRollback ArmUpgradeFailureAction = "Rollback" -) - -// PossibleArmUpgradeFailureActionValues returns an array of possible values for the ArmUpgradeFailureAction const type. -func PossibleArmUpgradeFailureActionValues() []ArmUpgradeFailureAction { - return []ArmUpgradeFailureAction{ArmUpgradeFailureActionManual, ArmUpgradeFailureActionRollback} -} - -// ClusterState enumerates the values for cluster state. -type ClusterState string - -const ( - // ClusterStateAutoScale ... - ClusterStateAutoScale ClusterState = "AutoScale" - // ClusterStateBaselineUpgrade ... - ClusterStateBaselineUpgrade ClusterState = "BaselineUpgrade" - // ClusterStateDeploying ... - ClusterStateDeploying ClusterState = "Deploying" - // ClusterStateEnforcingClusterVersion ... - ClusterStateEnforcingClusterVersion ClusterState = "EnforcingClusterVersion" - // ClusterStateReady ... - ClusterStateReady ClusterState = "Ready" - // ClusterStateUpdatingInfrastructure ... - ClusterStateUpdatingInfrastructure ClusterState = "UpdatingInfrastructure" - // ClusterStateUpdatingUserCertificate ... - ClusterStateUpdatingUserCertificate ClusterState = "UpdatingUserCertificate" - // ClusterStateUpdatingUserConfiguration ... - ClusterStateUpdatingUserConfiguration ClusterState = "UpdatingUserConfiguration" - // ClusterStateUpgradeServiceUnreachable ... - ClusterStateUpgradeServiceUnreachable ClusterState = "UpgradeServiceUnreachable" - // ClusterStateWaitingForNodes ... - ClusterStateWaitingForNodes ClusterState = "WaitingForNodes" -) - -// PossibleClusterStateValues returns an array of possible values for the ClusterState const type. -func PossibleClusterStateValues() []ClusterState { - return []ClusterState{ClusterStateAutoScale, ClusterStateBaselineUpgrade, ClusterStateDeploying, ClusterStateEnforcingClusterVersion, ClusterStateReady, ClusterStateUpdatingInfrastructure, ClusterStateUpdatingUserCertificate, ClusterStateUpdatingUserConfiguration, ClusterStateUpgradeServiceUnreachable, ClusterStateWaitingForNodes} -} - -// ClusterUpgradeCadence enumerates the values for cluster upgrade cadence. -type ClusterUpgradeCadence string - -const ( - // ClusterUpgradeCadenceWave0 Cluster upgrade starts immediately after a new version is rolled out. - // Recommended for Test/Dev clusters. - ClusterUpgradeCadenceWave0 ClusterUpgradeCadence = "Wave0" - // ClusterUpgradeCadenceWave1 Cluster upgrade starts 7 days after a new version is rolled out. Recommended - // for Pre-prod clusters. - ClusterUpgradeCadenceWave1 ClusterUpgradeCadence = "Wave1" - // ClusterUpgradeCadenceWave2 Cluster upgrade starts 14 days after a new version is rolled out. Recommended - // for Production clusters. - ClusterUpgradeCadenceWave2 ClusterUpgradeCadence = "Wave2" -) - -// PossibleClusterUpgradeCadenceValues returns an array of possible values for the ClusterUpgradeCadence const type. -func PossibleClusterUpgradeCadenceValues() []ClusterUpgradeCadence { - return []ClusterUpgradeCadence{ClusterUpgradeCadenceWave0, ClusterUpgradeCadenceWave1, ClusterUpgradeCadenceWave2} -} - -// DurabilityLevel enumerates the values for durability level. -type DurabilityLevel string - -const ( - // DurabilityLevelBronze ... - DurabilityLevelBronze DurabilityLevel = "Bronze" - // DurabilityLevelGold ... - DurabilityLevelGold DurabilityLevel = "Gold" - // DurabilityLevelSilver ... - DurabilityLevelSilver DurabilityLevel = "Silver" -) - -// PossibleDurabilityLevelValues returns an array of possible values for the DurabilityLevel const type. -func PossibleDurabilityLevelValues() []DurabilityLevel { - return []DurabilityLevel{DurabilityLevelBronze, DurabilityLevelGold, DurabilityLevelSilver} -} - -// Environment enumerates the values for environment. -type Environment string - -const ( - // EnvironmentLinux ... - EnvironmentLinux Environment = "Linux" - // EnvironmentWindows ... - EnvironmentWindows Environment = "Windows" -) - -// PossibleEnvironmentValues returns an array of possible values for the Environment const type. -func PossibleEnvironmentValues() []Environment { - return []Environment{EnvironmentLinux, EnvironmentWindows} -} - -// ManagedIdentityType enumerates the values for managed identity type. -type ManagedIdentityType string - -const ( - // ManagedIdentityTypeNone Indicates that no identity is associated with the resource. - ManagedIdentityTypeNone ManagedIdentityType = "None" - // ManagedIdentityTypeSystemAssigned Indicates that system assigned identity is associated with the - // resource. - ManagedIdentityTypeSystemAssigned ManagedIdentityType = "SystemAssigned" - // ManagedIdentityTypeSystemAssignedUserAssigned Indicates that both system assigned and user assigned - // identity are associated with the resource. - ManagedIdentityTypeSystemAssignedUserAssigned ManagedIdentityType = "SystemAssigned, UserAssigned" - // ManagedIdentityTypeUserAssigned Indicates that user assigned identity is associated with the resource. - ManagedIdentityTypeUserAssigned ManagedIdentityType = "UserAssigned" -) - -// PossibleManagedIdentityTypeValues returns an array of possible values for the ManagedIdentityType const type. -func PossibleManagedIdentityTypeValues() []ManagedIdentityType { - return []ManagedIdentityType{ManagedIdentityTypeNone, ManagedIdentityTypeSystemAssigned, ManagedIdentityTypeSystemAssignedUserAssigned, ManagedIdentityTypeUserAssigned} -} - -// MoveCost enumerates the values for move cost. -type MoveCost string - -const ( - // MoveCostHigh Specifies the move cost of the service as High. The value is 3. - MoveCostHigh MoveCost = "High" - // MoveCostLow Specifies the move cost of the service as Low. The value is 1. - MoveCostLow MoveCost = "Low" - // MoveCostMedium Specifies the move cost of the service as Medium. The value is 2. - MoveCostMedium MoveCost = "Medium" - // MoveCostZero Zero move cost. This value is zero. - MoveCostZero MoveCost = "Zero" -) - -// PossibleMoveCostValues returns an array of possible values for the MoveCost const type. -func PossibleMoveCostValues() []MoveCost { - return []MoveCost{MoveCostHigh, MoveCostLow, MoveCostMedium, MoveCostZero} -} - -// NotificationChannel enumerates the values for notification channel. -type NotificationChannel string - -const ( - // NotificationChannelEmailSubscription For subscription receivers. In this case, the parameter receivers - // should be a list of roles of the subscription for the cluster (eg. Owner, AccountAdmin, etc) that will - // receive the notifications. - NotificationChannelEmailSubscription NotificationChannel = "EmailSubscription" - // NotificationChannelEmailUser For email user receivers. In this case, the parameter receivers should be a - // list of email addresses that will receive the notifications. - NotificationChannelEmailUser NotificationChannel = "EmailUser" -) - -// PossibleNotificationChannelValues returns an array of possible values for the NotificationChannel const type. -func PossibleNotificationChannelValues() []NotificationChannel { - return []NotificationChannel{NotificationChannelEmailSubscription, NotificationChannelEmailUser} -} - -// NotificationLevel enumerates the values for notification level. -type NotificationLevel string - -const ( - // NotificationLevelAll Receive all notifications. - NotificationLevelAll NotificationLevel = "All" - // NotificationLevelCritical Receive only critical notifications. - NotificationLevelCritical NotificationLevel = "Critical" -) - -// PossibleNotificationLevelValues returns an array of possible values for the NotificationLevel const type. -func PossibleNotificationLevelValues() []NotificationLevel { - return []NotificationLevel{NotificationLevelAll, NotificationLevelCritical} -} - -// PartitionScheme enumerates the values for partition scheme. -type PartitionScheme string - -const ( - // PartitionSchemeInvalid Indicates the partition kind is invalid. All Service Fabric enumerations have the - // invalid type. The value is zero. - PartitionSchemeInvalid PartitionScheme = "Invalid" - // PartitionSchemeNamed Indicates that the partition is based on string names, and is a - // NamedPartitionSchemeDescription object. The value is 3 - PartitionSchemeNamed PartitionScheme = "Named" - // PartitionSchemeSingleton Indicates that the partition is based on string names, and is a - // SingletonPartitionSchemeDescription object, The value is 1. - PartitionSchemeSingleton PartitionScheme = "Singleton" - // PartitionSchemeUniformInt64Range Indicates that the partition is based on Int64 key ranges, and is a - // UniformInt64RangePartitionSchemeDescription object. The value is 2. - PartitionSchemeUniformInt64Range PartitionScheme = "UniformInt64Range" -) - -// PossiblePartitionSchemeValues returns an array of possible values for the PartitionScheme const type. -func PossiblePartitionSchemeValues() []PartitionScheme { - return []PartitionScheme{PartitionSchemeInvalid, PartitionSchemeNamed, PartitionSchemeSingleton, PartitionSchemeUniformInt64Range} -} - -// PartitionSchemeBasicPartitionSchemeDescription enumerates the values for partition scheme basic partition -// scheme description. -type PartitionSchemeBasicPartitionSchemeDescription string - -const ( - // PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed ... - PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed PartitionSchemeBasicPartitionSchemeDescription = "Named" - // PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription ... - PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription PartitionSchemeBasicPartitionSchemeDescription = "PartitionSchemeDescription" - // PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton ... - PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton PartitionSchemeBasicPartitionSchemeDescription = "Singleton" - // PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range ... - PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range PartitionSchemeBasicPartitionSchemeDescription = "UniformInt64Range" -) - -// PossiblePartitionSchemeBasicPartitionSchemeDescriptionValues returns an array of possible values for the PartitionSchemeBasicPartitionSchemeDescription const type. -func PossiblePartitionSchemeBasicPartitionSchemeDescriptionValues() []PartitionSchemeBasicPartitionSchemeDescription { - return []PartitionSchemeBasicPartitionSchemeDescription{PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed, PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription, PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton, PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // 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{ProvisioningStateCanceled, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} -} - -// ReliabilityLevel enumerates the values for reliability level. -type ReliabilityLevel string - -const ( - // ReliabilityLevelBronze ... - ReliabilityLevelBronze ReliabilityLevel = "Bronze" - // ReliabilityLevelGold ... - ReliabilityLevelGold ReliabilityLevel = "Gold" - // ReliabilityLevelNone ... - ReliabilityLevelNone ReliabilityLevel = "None" - // ReliabilityLevelPlatinum ... - ReliabilityLevelPlatinum ReliabilityLevel = "Platinum" - // ReliabilityLevelSilver ... - ReliabilityLevelSilver ReliabilityLevel = "Silver" -) - -// PossibleReliabilityLevelValues returns an array of possible values for the ReliabilityLevel const type. -func PossibleReliabilityLevelValues() []ReliabilityLevel { - return []ReliabilityLevel{ReliabilityLevelBronze, ReliabilityLevelGold, ReliabilityLevelNone, ReliabilityLevelPlatinum, ReliabilityLevelSilver} -} - -// ReliabilityLevel1 enumerates the values for reliability level 1. -type ReliabilityLevel1 string - -const ( - // ReliabilityLevel1Bronze ... - ReliabilityLevel1Bronze ReliabilityLevel1 = "Bronze" - // ReliabilityLevel1Gold ... - ReliabilityLevel1Gold ReliabilityLevel1 = "Gold" - // ReliabilityLevel1None ... - ReliabilityLevel1None ReliabilityLevel1 = "None" - // ReliabilityLevel1Platinum ... - ReliabilityLevel1Platinum ReliabilityLevel1 = "Platinum" - // ReliabilityLevel1Silver ... - ReliabilityLevel1Silver ReliabilityLevel1 = "Silver" -) - -// PossibleReliabilityLevel1Values returns an array of possible values for the ReliabilityLevel1 const type. -func PossibleReliabilityLevel1Values() []ReliabilityLevel1 { - return []ReliabilityLevel1{ReliabilityLevel1Bronze, ReliabilityLevel1Gold, ReliabilityLevel1None, ReliabilityLevel1Platinum, ReliabilityLevel1Silver} -} - -// RollingUpgradeMode enumerates the values for rolling upgrade mode. -type RollingUpgradeMode string - -const ( - // RollingUpgradeModeInvalid Indicates the upgrade mode is invalid. All Service Fabric enumerations have - // the invalid type. The value is zero. - RollingUpgradeModeInvalid RollingUpgradeMode = "Invalid" - // RollingUpgradeModeMonitored The upgrade will stop after completing each upgrade domain and automatically - // monitor health before proceeding. The value is 3 - RollingUpgradeModeMonitored RollingUpgradeMode = "Monitored" - // RollingUpgradeModeUnmonitoredAuto The upgrade will proceed automatically without performing any health - // monitoring. The value is 1 - RollingUpgradeModeUnmonitoredAuto RollingUpgradeMode = "UnmonitoredAuto" - // RollingUpgradeModeUnmonitoredManual The upgrade will stop after completing each upgrade domain, giving - // the opportunity to manually monitor health before proceeding. The value is 2 - RollingUpgradeModeUnmonitoredManual RollingUpgradeMode = "UnmonitoredManual" -) - -// PossibleRollingUpgradeModeValues returns an array of possible values for the RollingUpgradeMode const type. -func PossibleRollingUpgradeModeValues() []RollingUpgradeMode { - return []RollingUpgradeMode{RollingUpgradeModeInvalid, RollingUpgradeModeMonitored, RollingUpgradeModeUnmonitoredAuto, RollingUpgradeModeUnmonitoredManual} -} - -// ServiceCorrelationScheme enumerates the values for service correlation scheme. -type ServiceCorrelationScheme string - -const ( - // ServiceCorrelationSchemeAffinity Indicates that this service has an affinity relationship with another - // service. Provided for backwards compatibility, consider preferring the Aligned or NonAlignedAffinity - // options. The value is 1. - ServiceCorrelationSchemeAffinity ServiceCorrelationScheme = "Affinity" - // ServiceCorrelationSchemeAlignedAffinity Aligned affinity ensures that the primaries of the partitions of - // the affinitized services are collocated on the same nodes. This is the default and is the same as - // selecting the Affinity scheme. The value is 2. - ServiceCorrelationSchemeAlignedAffinity ServiceCorrelationScheme = "AlignedAffinity" - // ServiceCorrelationSchemeInvalid An invalid correlation scheme. Cannot be used. The value is zero. - ServiceCorrelationSchemeInvalid ServiceCorrelationScheme = "Invalid" - // ServiceCorrelationSchemeNonAlignedAffinity Non-Aligned affinity guarantees that all replicas of each - // service will be placed on the same nodes. Unlike Aligned Affinity, this does not guarantee that replicas - // of particular role will be collocated. The value is 3. - ServiceCorrelationSchemeNonAlignedAffinity ServiceCorrelationScheme = "NonAlignedAffinity" -) - -// PossibleServiceCorrelationSchemeValues returns an array of possible values for the ServiceCorrelationScheme const type. -func PossibleServiceCorrelationSchemeValues() []ServiceCorrelationScheme { - return []ServiceCorrelationScheme{ServiceCorrelationSchemeAffinity, ServiceCorrelationSchemeAlignedAffinity, ServiceCorrelationSchemeInvalid, ServiceCorrelationSchemeNonAlignedAffinity} -} - -// ServiceKind enumerates the values for service kind. -type ServiceKind string - -const ( - // ServiceKindInvalid Indicates the service kind is invalid. All Service Fabric enumerations have the - // invalid type. The value is zero. - ServiceKindInvalid ServiceKind = "Invalid" - // ServiceKindStateful Uses Service Fabric to make its state or part of its state highly available and - // reliable. The value is 2. - ServiceKindStateful ServiceKind = "Stateful" - // ServiceKindStateless Does not use Service Fabric to make its state highly available or reliable. The - // value is 1. - ServiceKindStateless ServiceKind = "Stateless" -) - -// PossibleServiceKindValues returns an array of possible values for the ServiceKind const type. -func PossibleServiceKindValues() []ServiceKind { - return []ServiceKind{ServiceKindInvalid, ServiceKindStateful, ServiceKindStateless} -} - -// ServiceKindBasicServiceResourceProperties enumerates the values for service kind basic service resource -// properties. -type ServiceKindBasicServiceResourceProperties string - -const ( - // ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties ... - ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties ServiceKindBasicServiceResourceProperties = "ServiceResourceProperties" - // ServiceKindBasicServiceResourcePropertiesServiceKindStateful ... - ServiceKindBasicServiceResourcePropertiesServiceKindStateful ServiceKindBasicServiceResourceProperties = "Stateful" - // ServiceKindBasicServiceResourcePropertiesServiceKindStateless ... - ServiceKindBasicServiceResourcePropertiesServiceKindStateless ServiceKindBasicServiceResourceProperties = "Stateless" -) - -// PossibleServiceKindBasicServiceResourcePropertiesValues returns an array of possible values for the ServiceKindBasicServiceResourceProperties const type. -func PossibleServiceKindBasicServiceResourcePropertiesValues() []ServiceKindBasicServiceResourceProperties { - return []ServiceKindBasicServiceResourceProperties{ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties, ServiceKindBasicServiceResourcePropertiesServiceKindStateful, ServiceKindBasicServiceResourcePropertiesServiceKindStateless} -} - -// ServiceKindBasicServiceResourceUpdateProperties enumerates the values for service kind basic service -// resource update properties. -type ServiceKindBasicServiceResourceUpdateProperties string - -const ( - // ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties ... - ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties ServiceKindBasicServiceResourceUpdateProperties = "ServiceResourceUpdateProperties" - // ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful ... - ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful ServiceKindBasicServiceResourceUpdateProperties = "Stateful" - // ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless ... - ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless ServiceKindBasicServiceResourceUpdateProperties = "Stateless" -) - -// PossibleServiceKindBasicServiceResourceUpdatePropertiesValues returns an array of possible values for the ServiceKindBasicServiceResourceUpdateProperties const type. -func PossibleServiceKindBasicServiceResourceUpdatePropertiesValues() []ServiceKindBasicServiceResourceUpdateProperties { - return []ServiceKindBasicServiceResourceUpdateProperties{ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties, ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful, ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless} -} - -// ServiceLoadMetricWeight enumerates the values for service load metric weight. -type ServiceLoadMetricWeight string - -const ( - // ServiceLoadMetricWeightHigh Specifies the metric weight of the service load as High. The value is 3. - ServiceLoadMetricWeightHigh ServiceLoadMetricWeight = "High" - // ServiceLoadMetricWeightLow Specifies the metric weight of the service load as Low. The value is 1. - ServiceLoadMetricWeightLow ServiceLoadMetricWeight = "Low" - // ServiceLoadMetricWeightMedium Specifies the metric weight of the service load as Medium. The value is 2. - ServiceLoadMetricWeightMedium ServiceLoadMetricWeight = "Medium" - // ServiceLoadMetricWeightZero Disables resource balancing for this metric. This value is zero. - ServiceLoadMetricWeightZero ServiceLoadMetricWeight = "Zero" -) - -// PossibleServiceLoadMetricWeightValues returns an array of possible values for the ServiceLoadMetricWeight const type. -func PossibleServiceLoadMetricWeightValues() []ServiceLoadMetricWeight { - return []ServiceLoadMetricWeight{ServiceLoadMetricWeightHigh, ServiceLoadMetricWeightLow, ServiceLoadMetricWeightMedium, ServiceLoadMetricWeightZero} -} - -// ServicePlacementPolicyType enumerates the values for service placement policy type. -type ServicePlacementPolicyType string - -const ( - // ServicePlacementPolicyTypeInvalid Indicates the type of the placement policy is invalid. All Service - // Fabric enumerations have the invalid type. The value is zero. - ServicePlacementPolicyTypeInvalid ServicePlacementPolicyType = "Invalid" - // ServicePlacementPolicyTypeInvalidDomain Indicates that the ServicePlacementPolicyDescription is of type - // ServicePlacementInvalidDomainPolicyDescription, which indicates that a particular fault or upgrade - // domain cannot be used for placement of this service. The value is 1. - ServicePlacementPolicyTypeInvalidDomain ServicePlacementPolicyType = "InvalidDomain" - // ServicePlacementPolicyTypeNonPartiallyPlaceService Indicates that the ServicePlacementPolicyDescription - // is of type ServicePlacementNonPartiallyPlaceServicePolicyDescription, which indicates that if possible - // all replicas of a particular partition of the service should be placed atomically. The value is 5. - ServicePlacementPolicyTypeNonPartiallyPlaceService ServicePlacementPolicyType = "NonPartiallyPlaceService" - // ServicePlacementPolicyTypePreferredPrimaryDomain Indicates that the ServicePlacementPolicyDescription is - // of type ServicePlacementPreferPrimaryDomainPolicyDescription, which indicates that if possible the - // Primary replica for the partitions of the service should be located in a particular domain as an - // optimization. The value is 3. - ServicePlacementPolicyTypePreferredPrimaryDomain ServicePlacementPolicyType = "PreferredPrimaryDomain" - // ServicePlacementPolicyTypeRequiredDomain Indicates that the ServicePlacementPolicyDescription is of type - // ServicePlacementRequireDomainDistributionPolicyDescription indicating that the replicas of the service - // must be placed in a specific domain. The value is 2. - ServicePlacementPolicyTypeRequiredDomain ServicePlacementPolicyType = "RequiredDomain" - // ServicePlacementPolicyTypeRequiredDomainDistribution Indicates that the - // ServicePlacementPolicyDescription is of type ServicePlacementRequireDomainDistributionPolicyDescription, - // indicating that the system will disallow placement of any two replicas from the same partition in the - // same domain at any time. The value is 4. - ServicePlacementPolicyTypeRequiredDomainDistribution ServicePlacementPolicyType = "RequiredDomainDistribution" -) - -// PossibleServicePlacementPolicyTypeValues returns an array of possible values for the ServicePlacementPolicyType const type. -func PossibleServicePlacementPolicyTypeValues() []ServicePlacementPolicyType { - return []ServicePlacementPolicyType{ServicePlacementPolicyTypeInvalid, ServicePlacementPolicyTypeInvalidDomain, ServicePlacementPolicyTypeNonPartiallyPlaceService, ServicePlacementPolicyTypePreferredPrimaryDomain, ServicePlacementPolicyTypeRequiredDomain, ServicePlacementPolicyTypeRequiredDomainDistribution} -} - -// SfZonalUpgradeMode enumerates the values for sf zonal upgrade mode. -type SfZonalUpgradeMode string - -const ( - // SfZonalUpgradeModeHierarchical If this value is omitted or set to Hierarchical, VMs are grouped to - // reflect the zonal distribution in up to 15 UDs. Each of the three zones has five UDs. This ensures that - // the zones are updated one at a time, moving to next zone only after completing five UDs within the first - // zone. This update process is safer for the cluster and the user application. - SfZonalUpgradeModeHierarchical SfZonalUpgradeMode = "Hierarchical" - // SfZonalUpgradeModeParallel VMs under the node type are grouped into UDs and ignore the zone info in five - // UDs. This setting causes UDs across all zones to be upgraded at the same time. This deployment mode is - // faster for upgrades, we don't recommend it because it goes against the SDP guidelines, which state that - // the updates should be applied to one zone at a time. - SfZonalUpgradeModeParallel SfZonalUpgradeMode = "Parallel" -) - -// PossibleSfZonalUpgradeModeValues returns an array of possible values for the SfZonalUpgradeMode const type. -func PossibleSfZonalUpgradeModeValues() []SfZonalUpgradeMode { - return []SfZonalUpgradeMode{SfZonalUpgradeModeHierarchical, SfZonalUpgradeModeParallel} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeServicePlacementPolicyDescription ... - TypeServicePlacementPolicyDescription Type = "ServicePlacementPolicyDescription" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeServicePlacementPolicyDescription} -} - -// UpgradeMode enumerates the values for upgrade mode. -type UpgradeMode string - -const ( - // UpgradeModeAutomatic The cluster will be automatically upgraded to the latest Service Fabric runtime - // version, **upgradeWave** will determine when the upgrade starts after the new version becomes available. - UpgradeModeAutomatic UpgradeMode = "Automatic" - // UpgradeModeManual The cluster will not be automatically upgraded to the latest Service Fabric runtime - // version. The cluster is upgraded by setting the **clusterCodeVersion** property in the cluster resource. - UpgradeModeManual UpgradeMode = "Manual" -) - -// PossibleUpgradeModeValues returns an array of possible values for the UpgradeMode const type. -func PossibleUpgradeModeValues() []UpgradeMode { - return []UpgradeMode{UpgradeModeAutomatic, UpgradeModeManual} -} - -// VmssZonalUpgradeMode enumerates the values for vmss zonal upgrade mode. -type VmssZonalUpgradeMode string - -const ( - // VmssZonalUpgradeModeHierarchical VMs are grouped to reflect the zonal distribution in up to 15 UDs. Each - // of the three zones has five UDs. This ensures that the zones are updated one at a time, moving to next - // zone only after completing five UDs within the first zone. - VmssZonalUpgradeModeHierarchical VmssZonalUpgradeMode = "Hierarchical" - // VmssZonalUpgradeModeParallel Updates will happen in all Availability Zones at once for the virtual - // machine scale sets. - VmssZonalUpgradeModeParallel VmssZonalUpgradeMode = "Parallel" -) - -// PossibleVmssZonalUpgradeModeValues returns an array of possible values for the VmssZonalUpgradeMode const type. -func PossibleVmssZonalUpgradeModeValues() []VmssZonalUpgradeMode { - return []VmssZonalUpgradeMode{VmssZonalUpgradeModeHierarchical, VmssZonalUpgradeModeParallel} -} - -// X509StoreName enumerates the values for x509 store name. -type X509StoreName string - -const ( - // X509StoreNameAddressBook ... - X509StoreNameAddressBook X509StoreName = "AddressBook" - // X509StoreNameAuthRoot ... - X509StoreNameAuthRoot X509StoreName = "AuthRoot" - // X509StoreNameCertificateAuthority ... - X509StoreNameCertificateAuthority X509StoreName = "CertificateAuthority" - // X509StoreNameDisallowed ... - X509StoreNameDisallowed X509StoreName = "Disallowed" - // X509StoreNameMy ... - X509StoreNameMy X509StoreName = "My" - // X509StoreNameRoot ... - X509StoreNameRoot X509StoreName = "Root" - // X509StoreNameTrustedPeople ... - X509StoreNameTrustedPeople X509StoreName = "TrustedPeople" - // X509StoreNameTrustedPublisher ... - X509StoreNameTrustedPublisher X509StoreName = "TrustedPublisher" -) - -// PossibleX509StoreNameValues returns an array of possible values for the X509StoreName const type. -func PossibleX509StoreNameValues() []X509StoreName { - return []X509StoreName{X509StoreNameAddressBook, X509StoreNameAuthRoot, X509StoreNameCertificateAuthority, X509StoreNameDisallowed, X509StoreNameMy, X509StoreNameRoot, X509StoreNameTrustedPeople, X509StoreNameTrustedPublisher} -} - -// X509StoreName1 enumerates the values for x509 store name 1. -type X509StoreName1 string - -const ( - // X509StoreName1AddressBook ... - X509StoreName1AddressBook X509StoreName1 = "AddressBook" - // X509StoreName1AuthRoot ... - X509StoreName1AuthRoot X509StoreName1 = "AuthRoot" - // X509StoreName1CertificateAuthority ... - X509StoreName1CertificateAuthority X509StoreName1 = "CertificateAuthority" - // X509StoreName1Disallowed ... - X509StoreName1Disallowed X509StoreName1 = "Disallowed" - // X509StoreName1My ... - X509StoreName1My X509StoreName1 = "My" - // X509StoreName1Root ... - X509StoreName1Root X509StoreName1 = "Root" - // X509StoreName1TrustedPeople ... - X509StoreName1TrustedPeople X509StoreName1 = "TrustedPeople" - // X509StoreName1TrustedPublisher ... - X509StoreName1TrustedPublisher X509StoreName1 = "TrustedPublisher" -) - -// PossibleX509StoreName1Values returns an array of possible values for the X509StoreName1 const type. -func PossibleX509StoreName1Values() []X509StoreName1 { - return []X509StoreName1{X509StoreName1AddressBook, X509StoreName1AuthRoot, X509StoreName1CertificateAuthority, X509StoreName1Disallowed, X509StoreName1My, X509StoreName1Root, X509StoreName1TrustedPeople, X509StoreName1TrustedPublisher} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/models.go deleted file mode 100644 index 145537b3cb61..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/models.go +++ /dev/null @@ -1,4342 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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/servicefabric/mgmt/2021-06-01/servicefabric" - -// ApplicationDeltaHealthPolicy defines a delta health policy used to evaluate the health of an application -// or one of its child entities when upgrading the cluster. -type ApplicationDeltaHealthPolicy struct { - // DefaultServiceTypeDeltaHealthPolicy - The delta health policy used by default to evaluate the health of a service type when upgrading the cluster. - DefaultServiceTypeDeltaHealthPolicy *ServiceTypeDeltaHealthPolicy `json:"defaultServiceTypeDeltaHealthPolicy,omitempty"` - // ServiceTypeDeltaHealthPolicies - The map with service type delta health policy per service type name. The map is empty by default. - ServiceTypeDeltaHealthPolicies map[string]*ServiceTypeDeltaHealthPolicy `json:"serviceTypeDeltaHealthPolicies"` -} - -// MarshalJSON is the custom marshaler for ApplicationDeltaHealthPolicy. -func (adhp ApplicationDeltaHealthPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if adhp.DefaultServiceTypeDeltaHealthPolicy != nil { - objectMap["defaultServiceTypeDeltaHealthPolicy"] = adhp.DefaultServiceTypeDeltaHealthPolicy - } - if adhp.ServiceTypeDeltaHealthPolicies != nil { - objectMap["serviceTypeDeltaHealthPolicies"] = adhp.ServiceTypeDeltaHealthPolicies - } - return json.Marshal(objectMap) -} - -// ApplicationHealthPolicy defines a health policy used to evaluate the health of an application or one of -// its children entities. -type ApplicationHealthPolicy struct { - // DefaultServiceTypeHealthPolicy - The health policy used by default to evaluate the health of a service type. - DefaultServiceTypeHealthPolicy *ServiceTypeHealthPolicy `json:"defaultServiceTypeHealthPolicy,omitempty"` - // ServiceTypeHealthPolicies - The map with service type health policy per service type name. The map is empty by default. - ServiceTypeHealthPolicies map[string]*ServiceTypeHealthPolicy `json:"serviceTypeHealthPolicies"` -} - -// MarshalJSON is the custom marshaler for ApplicationHealthPolicy. -func (ahp ApplicationHealthPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ahp.DefaultServiceTypeHealthPolicy != nil { - objectMap["defaultServiceTypeHealthPolicy"] = ahp.DefaultServiceTypeHealthPolicy - } - if ahp.ServiceTypeHealthPolicies != nil { - objectMap["serviceTypeHealthPolicies"] = ahp.ServiceTypeHealthPolicies - } - return json.Marshal(objectMap) -} - -// ApplicationMetricDescription describes capacity information for a custom resource balancing metric. This -// can be used to limit the total consumption of this metric by the services of this application. -type ApplicationMetricDescription struct { - // Name - The name of the metric. - Name *string `json:"name,omitempty"` - // MaximumCapacity - The maximum node capacity for Service Fabric application. - // This is the maximum Load for an instance of this application on a single node. Even if the capacity of node is greater than this value, Service Fabric will limit the total load of services within the application on each node to this value. - // If set to zero, capacity for this metric is unlimited on each node. - // When creating a new application with application capacity defined, the product of MaximumNodes and this value must always be smaller than or equal to TotalApplicationCapacity. - // When updating existing application with application capacity, the product of MaximumNodes and this value must always be smaller than or equal to TotalApplicationCapacity. - MaximumCapacity *int64 `json:"maximumCapacity,omitempty"` - // ReservationCapacity - The node reservation capacity for Service Fabric application. - // This is the amount of load which is reserved on nodes which have instances of this application. - // If MinimumNodes is specified, then the product of these values will be the capacity reserved in the cluster for the application. - // If set to zero, no capacity is reserved for this metric. - // When setting application capacity or when updating application capacity; this value must be smaller than or equal to MaximumCapacity for each metric. - ReservationCapacity *int64 `json:"reservationCapacity,omitempty"` - // TotalApplicationCapacity - The total metric capacity for Service Fabric application. - // This is the total metric capacity for this application in the cluster. Service Fabric will try to limit the sum of loads of services within the application to this value. - // When creating a new application with application capacity defined, the product of MaximumNodes and MaximumCapacity must always be smaller than or equal to this value. - TotalApplicationCapacity *int64 `json:"totalApplicationCapacity,omitempty"` -} - -// ApplicationResource the application resource. -type ApplicationResource struct { - autorest.Response `json:"-"` - Identity *ManagedIdentity `json:"identity,omitempty"` - *ApplicationResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationResource. -func (ar ApplicationResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Identity != nil { - objectMap["identity"] = ar.Identity - } - if ar.ApplicationResourceProperties != nil { - objectMap["properties"] = ar.ApplicationResourceProperties - } - if ar.Location != nil { - objectMap["location"] = ar.Location - } - if ar.Tags != nil { - objectMap["tags"] = ar.Tags - } - if ar.SystemData != nil { - objectMap["systemData"] = ar.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationResource struct. -func (ar *ApplicationResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity ManagedIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ar.Identity = &identity - } - case "properties": - if v != nil { - var applicationResourceProperties ApplicationResourceProperties - err = json.Unmarshal(*v, &applicationResourceProperties) - if err != nil { - return err - } - ar.ApplicationResourceProperties = &applicationResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ar.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ar.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ar.SystemData = &systemData - } - } - } - - return nil -} - -// ApplicationResourceList the list of application resources. -type ApplicationResourceList struct { - autorest.Response `json:"-"` - Value *[]ApplicationResource `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of application list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationResourceList. -func (arl ApplicationResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arl.Value != nil { - objectMap["value"] = arl.Value - } - return json.Marshal(objectMap) -} - -// ApplicationResourceProperties the application resource properties. -type ApplicationResourceProperties struct { - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response - ProvisioningState *string `json:"provisioningState,omitempty"` - TypeName *string `json:"typeName,omitempty"` - TypeVersion *string `json:"typeVersion,omitempty"` - Parameters map[string]*string `json:"parameters"` - UpgradePolicy *ApplicationUpgradePolicy `json:"upgradePolicy,omitempty"` - // MinimumNodes - The minimum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - MinimumNodes *int64 `json:"minimumNodes,omitempty"` - // MaximumNodes - The maximum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. By default, the value of this property is zero and it means that the services can be placed on any node. - MaximumNodes *int64 `json:"maximumNodes,omitempty"` - // RemoveApplicationCapacity - Remove the current application capacity settings. - RemoveApplicationCapacity *bool `json:"removeApplicationCapacity,omitempty"` - Metrics *[]ApplicationMetricDescription `json:"metrics,omitempty"` - // ManagedIdentities - List of user assigned identities for the application, each mapped to a friendly name. - ManagedIdentities *[]ApplicationUserAssignedIdentity `json:"managedIdentities,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationResourceProperties. -func (arp ApplicationResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.TypeName != nil { - objectMap["typeName"] = arp.TypeName - } - if arp.TypeVersion != nil { - objectMap["typeVersion"] = arp.TypeVersion - } - if arp.Parameters != nil { - objectMap["parameters"] = arp.Parameters - } - if arp.UpgradePolicy != nil { - objectMap["upgradePolicy"] = arp.UpgradePolicy - } - if arp.MinimumNodes != nil { - objectMap["minimumNodes"] = arp.MinimumNodes - } - if arp.MaximumNodes != nil { - objectMap["maximumNodes"] = arp.MaximumNodes - } - if arp.RemoveApplicationCapacity != nil { - objectMap["removeApplicationCapacity"] = arp.RemoveApplicationCapacity - } - if arp.Metrics != nil { - objectMap["metrics"] = arp.Metrics - } - if arp.ManagedIdentities != nil { - objectMap["managedIdentities"] = arp.ManagedIdentities - } - return json.Marshal(objectMap) -} - -// ApplicationResourceUpdate the application resource for patch operations. -type ApplicationResourceUpdate struct { - *ApplicationResourceUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationResourceUpdate. -func (aru ApplicationResourceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aru.ApplicationResourceUpdateProperties != nil { - objectMap["properties"] = aru.ApplicationResourceUpdateProperties - } - if aru.Location != nil { - objectMap["location"] = aru.Location - } - if aru.Tags != nil { - objectMap["tags"] = aru.Tags - } - if aru.SystemData != nil { - objectMap["systemData"] = aru.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationResourceUpdate struct. -func (aru *ApplicationResourceUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationResourceUpdateProperties ApplicationResourceUpdateProperties - err = json.Unmarshal(*v, &applicationResourceUpdateProperties) - if err != nil { - return err - } - aru.ApplicationResourceUpdateProperties = &applicationResourceUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - aru.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - aru.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - aru.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - aru.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - aru.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - aru.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - aru.SystemData = &systemData - } - } - } - - return nil -} - -// ApplicationResourceUpdateProperties the application resource properties for patch operations. -type ApplicationResourceUpdateProperties struct { - TypeVersion *string `json:"typeVersion,omitempty"` - Parameters map[string]*string `json:"parameters"` - UpgradePolicy *ApplicationUpgradePolicy `json:"upgradePolicy,omitempty"` - // MinimumNodes - The minimum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - MinimumNodes *int64 `json:"minimumNodes,omitempty"` - // MaximumNodes - The maximum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. By default, the value of this property is zero and it means that the services can be placed on any node. - MaximumNodes *int64 `json:"maximumNodes,omitempty"` - // RemoveApplicationCapacity - Remove the current application capacity settings. - RemoveApplicationCapacity *bool `json:"removeApplicationCapacity,omitempty"` - Metrics *[]ApplicationMetricDescription `json:"metrics,omitempty"` - // ManagedIdentities - List of user assigned identities for the application, each mapped to a friendly name. - ManagedIdentities *[]ApplicationUserAssignedIdentity `json:"managedIdentities,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationResourceUpdateProperties. -func (arup ApplicationResourceUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arup.TypeVersion != nil { - objectMap["typeVersion"] = arup.TypeVersion - } - if arup.Parameters != nil { - objectMap["parameters"] = arup.Parameters - } - if arup.UpgradePolicy != nil { - objectMap["upgradePolicy"] = arup.UpgradePolicy - } - if arup.MinimumNodes != nil { - objectMap["minimumNodes"] = arup.MinimumNodes - } - if arup.MaximumNodes != nil { - objectMap["maximumNodes"] = arup.MaximumNodes - } - if arup.RemoveApplicationCapacity != nil { - objectMap["removeApplicationCapacity"] = arup.RemoveApplicationCapacity - } - if arup.Metrics != nil { - objectMap["metrics"] = arup.Metrics - } - if arup.ManagedIdentities != nil { - objectMap["managedIdentities"] = arup.ManagedIdentities - } - return json.Marshal(objectMap) -} - -// ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationsClient) (ApplicationResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationsCreateOrUpdateFuture.Result. -func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (ar ApplicationResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationsCreateOrUpdateFuture") - 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, "servicefabric.ApplicationsCreateOrUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ApplicationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationsDeleteFuture.Result. -func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ApplicationsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationsClient) (ApplicationResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationsUpdateFuture.Result. -func (future *ApplicationsUpdateFuture) result(client ApplicationsClient) (ar ApplicationResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationsUpdateFuture") - 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, "servicefabric.ApplicationsUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationTypeResource the application type name resource -type ApplicationTypeResource struct { - autorest.Response `json:"-"` - *ApplicationTypeResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeResource. -func (atr ApplicationTypeResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atr.ApplicationTypeResourceProperties != nil { - objectMap["properties"] = atr.ApplicationTypeResourceProperties - } - if atr.Location != nil { - objectMap["location"] = atr.Location - } - if atr.Tags != nil { - objectMap["tags"] = atr.Tags - } - if atr.SystemData != nil { - objectMap["systemData"] = atr.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationTypeResource struct. -func (atr *ApplicationTypeResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationTypeResourceProperties ApplicationTypeResourceProperties - err = json.Unmarshal(*v, &applicationTypeResourceProperties) - if err != nil { - return err - } - atr.ApplicationTypeResourceProperties = &applicationTypeResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - atr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - atr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - atr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - atr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - atr.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - atr.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - atr.SystemData = &systemData - } - } - } - - return nil -} - -// ApplicationTypeResourceList the list of application type names. -type ApplicationTypeResourceList struct { - autorest.Response `json:"-"` - Value *[]ApplicationTypeResource `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of application type list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeResourceList. -func (atrl ApplicationTypeResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atrl.Value != nil { - objectMap["value"] = atrl.Value - } - return json.Marshal(objectMap) -} - -// ApplicationTypeResourceProperties the application type name properties -type ApplicationTypeResourceProperties struct { - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeResourceProperties. -func (atrp ApplicationTypeResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ApplicationTypesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ApplicationTypesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationTypesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationTypesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationTypesDeleteFuture.Result. -func (future *ApplicationTypesDeleteFuture) result(client ApplicationTypesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationTypesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationTypeVersionResource an application type version resource for the specified application type -// name resource. -type ApplicationTypeVersionResource struct { - autorest.Response `json:"-"` - *ApplicationTypeVersionResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeVersionResource. -func (atvr ApplicationTypeVersionResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atvr.ApplicationTypeVersionResourceProperties != nil { - objectMap["properties"] = atvr.ApplicationTypeVersionResourceProperties - } - if atvr.Location != nil { - objectMap["location"] = atvr.Location - } - if atvr.Tags != nil { - objectMap["tags"] = atvr.Tags - } - if atvr.SystemData != nil { - objectMap["systemData"] = atvr.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationTypeVersionResource struct. -func (atvr *ApplicationTypeVersionResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationTypeVersionResourceProperties ApplicationTypeVersionResourceProperties - err = json.Unmarshal(*v, &applicationTypeVersionResourceProperties) - if err != nil { - return err - } - atvr.ApplicationTypeVersionResourceProperties = &applicationTypeVersionResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - atvr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - atvr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - atvr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - atvr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - atvr.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - atvr.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - atvr.SystemData = &systemData - } - } - } - - return nil -} - -// ApplicationTypeVersionResourceList the list of application type version resources for the specified -// application type name resource. -type ApplicationTypeVersionResourceList struct { - autorest.Response `json:"-"` - Value *[]ApplicationTypeVersionResource `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of application type version list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeVersionResourceList. -func (atvrl ApplicationTypeVersionResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atvrl.Value != nil { - objectMap["value"] = atvrl.Value - } - return json.Marshal(objectMap) -} - -// ApplicationTypeVersionResourceProperties the properties of the application type version resource. -type ApplicationTypeVersionResourceProperties struct { - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response - ProvisioningState *string `json:"provisioningState,omitempty"` - // AppPackageURL - The URL to the application package - AppPackageURL *string `json:"appPackageUrl,omitempty"` - // DefaultParameterList - READ-ONLY - DefaultParameterList map[string]*string `json:"defaultParameterList"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeVersionResourceProperties. -func (atvrp ApplicationTypeVersionResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atvrp.AppPackageURL != nil { - objectMap["appPackageUrl"] = atvrp.AppPackageURL - } - return json.Marshal(objectMap) -} - -// ApplicationTypeVersionsCleanupPolicy ... -type ApplicationTypeVersionsCleanupPolicy struct { - // MaxUnusedVersionsToKeep - Number of unused versions per application type to keep. - MaxUnusedVersionsToKeep *int64 `json:"maxUnusedVersionsToKeep,omitempty"` -} - -// ApplicationTypeVersionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ApplicationTypeVersionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationTypeVersionsClient) (ApplicationTypeVersionResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationTypeVersionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationTypeVersionsCreateOrUpdateFuture.Result. -func (future *ApplicationTypeVersionsCreateOrUpdateFuture) result(client ApplicationTypeVersionsClient) (atvr ApplicationTypeVersionResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - atvr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationTypeVersionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if atvr.Response.Response, err = future.GetResult(sender); err == nil && atvr.Response.Response.StatusCode != http.StatusNoContent { - atvr, err = client.CreateOrUpdateResponder(atvr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsCreateOrUpdateFuture", "Result", atvr.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationTypeVersionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationTypeVersionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationTypeVersionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationTypeVersionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationTypeVersionsDeleteFuture.Result. -func (future *ApplicationTypeVersionsDeleteFuture) result(client ApplicationTypeVersionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationTypeVersionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationUpgradePolicy describes the policy for a monitored application upgrade. -type ApplicationUpgradePolicy struct { - // UpgradeReplicaSetCheckTimeout - The maximum amount of time to block processing of an upgrade domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer). - UpgradeReplicaSetCheckTimeout *string `json:"upgradeReplicaSetCheckTimeout,omitempty"` - ForceRestart *bool `json:"forceRestart,omitempty"` - RollingUpgradeMonitoringPolicy *ArmRollingUpgradeMonitoringPolicy `json:"rollingUpgradeMonitoringPolicy,omitempty"` - ApplicationHealthPolicy *ArmApplicationHealthPolicy `json:"applicationHealthPolicy,omitempty"` - // UpgradeMode - Possible values include: 'RollingUpgradeModeInvalid', 'RollingUpgradeModeUnmonitoredAuto', 'RollingUpgradeModeUnmonitoredManual', 'RollingUpgradeModeMonitored' - UpgradeMode RollingUpgradeMode `json:"upgradeMode,omitempty"` - // RecreateApplication - Determines whether the application should be recreated on update. If value=true, the rest of the upgrade policy parameters are not allowed and it will result in availability loss. - RecreateApplication *bool `json:"recreateApplication,omitempty"` -} - -// ApplicationUserAssignedIdentity ... -type ApplicationUserAssignedIdentity struct { - // Name - The friendly name of user assigned identity. - Name *string `json:"name,omitempty"` - // PrincipalID - The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` -} - -// ArmApplicationHealthPolicy defines a health policy used to evaluate the health of an application or one -// of its children entities. -type ArmApplicationHealthPolicy struct { - // ConsiderWarningAsError - Indicates whether warnings are treated with the same severity as errors. - ConsiderWarningAsError *bool `json:"considerWarningAsError,omitempty"` - // MaxPercentUnhealthyDeployedApplications - The maximum allowed percentage of unhealthy deployed applications. Allowed values are Byte values from zero to 100. - // The percentage represents the maximum tolerated percentage of deployed applications that can be unhealthy before the application is considered in error. - // This is calculated by dividing the number of unhealthy deployed applications over the number of nodes where the application is currently deployed on in the cluster. - // The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage is zero. - MaxPercentUnhealthyDeployedApplications *int32 `json:"maxPercentUnhealthyDeployedApplications,omitempty"` - // DefaultServiceTypeHealthPolicy - The health policy used by default to evaluate the health of a service type. - DefaultServiceTypeHealthPolicy *ArmServiceTypeHealthPolicy `json:"defaultServiceTypeHealthPolicy,omitempty"` - // ServiceTypeHealthPolicyMap - The map with service type health policy per service type name. The map is empty by default. - ServiceTypeHealthPolicyMap map[string]*ArmServiceTypeHealthPolicy `json:"serviceTypeHealthPolicyMap"` -} - -// MarshalJSON is the custom marshaler for ArmApplicationHealthPolicy. -func (aahp ArmApplicationHealthPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aahp.ConsiderWarningAsError != nil { - objectMap["considerWarningAsError"] = aahp.ConsiderWarningAsError - } - if aahp.MaxPercentUnhealthyDeployedApplications != nil { - objectMap["maxPercentUnhealthyDeployedApplications"] = aahp.MaxPercentUnhealthyDeployedApplications - } - if aahp.DefaultServiceTypeHealthPolicy != nil { - objectMap["defaultServiceTypeHealthPolicy"] = aahp.DefaultServiceTypeHealthPolicy - } - if aahp.ServiceTypeHealthPolicyMap != nil { - objectMap["serviceTypeHealthPolicyMap"] = aahp.ServiceTypeHealthPolicyMap - } - return json.Marshal(objectMap) -} - -// ArmRollingUpgradeMonitoringPolicy the policy used for monitoring the application upgrade -type ArmRollingUpgradeMonitoringPolicy struct { - // FailureAction - The activation Mode of the service package. Possible values include: 'ArmUpgradeFailureActionRollback', 'ArmUpgradeFailureActionManual' - FailureAction ArmUpgradeFailureAction `json:"failureAction,omitempty"` - HealthCheckWaitDuration *string `json:"healthCheckWaitDuration,omitempty"` - HealthCheckStableDuration *string `json:"healthCheckStableDuration,omitempty"` - HealthCheckRetryTimeout *string `json:"healthCheckRetryTimeout,omitempty"` - UpgradeTimeout *string `json:"upgradeTimeout,omitempty"` - UpgradeDomainTimeout *string `json:"upgradeDomainTimeout,omitempty"` -} - -// ArmServiceTypeHealthPolicy represents the health policy used to evaluate the health of services -// belonging to a service type. -type ArmServiceTypeHealthPolicy struct { - // MaxPercentUnhealthyServices - The maximum percentage of services allowed to be unhealthy before your application is considered in error. - MaxPercentUnhealthyServices *int32 `json:"maxPercentUnhealthyServices,omitempty"` - // MaxPercentUnhealthyPartitionsPerService - The maximum percentage of partitions per service allowed to be unhealthy before your application is considered in error. - MaxPercentUnhealthyPartitionsPerService *int32 `json:"maxPercentUnhealthyPartitionsPerService,omitempty"` - // MaxPercentUnhealthyReplicasPerPartition - The maximum percentage of replicas per partition allowed to be unhealthy before your application is considered in error. - MaxPercentUnhealthyReplicasPerPartition *int32 `json:"maxPercentUnhealthyReplicasPerPartition,omitempty"` -} - -// AvailableOperationDisplay operation supported by the Service Fabric resource provider -type AvailableOperationDisplay struct { - // Provider - The name of the provider. - Provider *string `json:"provider,omitempty"` - // Resource - The resource on which the operation is performed - Resource *string `json:"resource,omitempty"` - // Operation - The operation that can be performed. - Operation *string `json:"operation,omitempty"` - // Description - Operation description - Description *string `json:"description,omitempty"` -} - -// AzureActiveDirectory the settings to enable AAD authentication on the cluster. -type AzureActiveDirectory struct { - // TenantID - Azure active directory tenant id. - TenantID *string `json:"tenantId,omitempty"` - // ClusterApplication - Azure active directory cluster application id. - ClusterApplication *string `json:"clusterApplication,omitempty"` - // ClientApplication - Azure active directory client application id. - ClientApplication *string `json:"clientApplication,omitempty"` -} - -// CertificateDescription describes the certificate details. -type CertificateDescription struct { - // Thumbprint - Thumbprint of the primary certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // ThumbprintSecondary - Thumbprint of the secondary certificate. - ThumbprintSecondary *string `json:"thumbprintSecondary,omitempty"` - // X509StoreName - Possible values include: 'X509StoreNameAddressBook', 'X509StoreNameAuthRoot', 'X509StoreNameCertificateAuthority', 'X509StoreNameDisallowed', 'X509StoreNameMy', 'X509StoreNameRoot', 'X509StoreNameTrustedPeople', 'X509StoreNameTrustedPublisher' - X509StoreName X509StoreName `json:"x509StoreName,omitempty"` -} - -// ClientCertificateCommonName describes the client certificate details using common name. -type ClientCertificateCommonName struct { - // IsAdmin - Indicates if the client certificate has admin access to the cluster. Non admin clients can perform only read only operations on the cluster. - IsAdmin *bool `json:"isAdmin,omitempty"` - // CertificateCommonName - The common name of the client certificate. - CertificateCommonName *string `json:"certificateCommonName,omitempty"` - // CertificateIssuerThumbprint - The issuer thumbprint of the client certificate. - CertificateIssuerThumbprint *string `json:"certificateIssuerThumbprint,omitempty"` -} - -// ClientCertificateThumbprint describes the client certificate details using thumbprint. -type ClientCertificateThumbprint struct { - // IsAdmin - Indicates if the client certificate has admin access to the cluster. Non admin clients can perform only read only operations on the cluster. - IsAdmin *bool `json:"isAdmin,omitempty"` - // CertificateThumbprint - The thumbprint of the client certificate. - CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` -} - -// Cluster the cluster resource -type Cluster struct { - autorest.Response `json:"-"` - // ClusterProperties - The cluster resource properties - *ClusterProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - Azure resource location. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Cluster. -func (c Cluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.ClusterProperties != nil { - objectMap["properties"] = c.ClusterProperties - } - if c.Location != nil { - objectMap["location"] = c.Location - } - if c.Tags != nil { - objectMap["tags"] = c.Tags - } - if c.SystemData != nil { - objectMap["systemData"] = c.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Cluster struct. -func (c *Cluster) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var clusterProperties ClusterProperties - err = json.Unmarshal(*v, &clusterProperties) - if err != nil { - return err - } - c.ClusterProperties = &clusterProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - c.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - c.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - c.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - c.SystemData = &systemData - } - } - } - - return nil -} - -// ClusterCodeVersionsListResult the list results of the Service Fabric runtime versions. -type ClusterCodeVersionsListResult struct { - autorest.Response `json:"-"` - Value *[]ClusterCodeVersionsResult `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ClusterCodeVersionsResult the result of the Service Fabric runtime versions -type ClusterCodeVersionsResult struct { - // ID - The identification of the result - ID *string `json:"id,omitempty"` - // Name - The name of the result - Name *string `json:"name,omitempty"` - // Type - The result resource type - Type *string `json:"type,omitempty"` - *ClusterVersionDetails `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterCodeVersionsResult. -func (ccvr ClusterCodeVersionsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccvr.ID != nil { - objectMap["id"] = ccvr.ID - } - if ccvr.Name != nil { - objectMap["name"] = ccvr.Name - } - if ccvr.Type != nil { - objectMap["type"] = ccvr.Type - } - if ccvr.ClusterVersionDetails != nil { - objectMap["properties"] = ccvr.ClusterVersionDetails - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ClusterCodeVersionsResult struct. -func (ccvr *ClusterCodeVersionsResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ccvr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ccvr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ccvr.Type = &typeVar - } - case "properties": - if v != nil { - var clusterVersionDetails ClusterVersionDetails - err = json.Unmarshal(*v, &clusterVersionDetails) - if err != nil { - return err - } - ccvr.ClusterVersionDetails = &clusterVersionDetails - } - } - } - - return nil -} - -// ClusterHealthPolicy defines a health policy used to evaluate the health of the cluster or of a cluster -// node. -type ClusterHealthPolicy struct { - // MaxPercentUnhealthyNodes - The maximum allowed percentage of unhealthy nodes before reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. - // The percentage represents the maximum tolerated percentage of nodes that can be unhealthy before the cluster is considered in error. - // If the percentage is respected but there is at least one unhealthy node, the health is evaluated as Warning. - // The percentage is calculated by dividing the number of unhealthy nodes over the total number of nodes in the cluster. - // The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage is zero. - // In large clusters, some nodes will always be down or out for repairs, so this percentage should be configured to tolerate that. - MaxPercentUnhealthyNodes *int32 `json:"maxPercentUnhealthyNodes,omitempty"` - // MaxPercentUnhealthyApplications - The maximum allowed percentage of unhealthy applications before reporting an error. For example, to allow 10% of applications to be unhealthy, this value would be 10. - // The percentage represents the maximum tolerated percentage of applications that can be unhealthy before the cluster is considered in error. - // If the percentage is respected but there is at least one unhealthy application, the health is evaluated as Warning. - // This is calculated by dividing the number of unhealthy applications over the total number of application instances in the cluster, excluding applications of application types that are included in the ApplicationTypeHealthPolicyMap. - // The computation rounds up to tolerate one failure on small numbers of applications. Default percentage is zero. - MaxPercentUnhealthyApplications *int32 `json:"maxPercentUnhealthyApplications,omitempty"` - // ApplicationHealthPolicies - Defines the application health policy map used to evaluate the health of an application or one of its children entities. - ApplicationHealthPolicies map[string]*ApplicationHealthPolicy `json:"applicationHealthPolicies"` -} - -// MarshalJSON is the custom marshaler for ClusterHealthPolicy. -func (chp ClusterHealthPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if chp.MaxPercentUnhealthyNodes != nil { - objectMap["maxPercentUnhealthyNodes"] = chp.MaxPercentUnhealthyNodes - } - if chp.MaxPercentUnhealthyApplications != nil { - objectMap["maxPercentUnhealthyApplications"] = chp.MaxPercentUnhealthyApplications - } - if chp.ApplicationHealthPolicies != nil { - objectMap["applicationHealthPolicies"] = chp.ApplicationHealthPolicies - } - return json.Marshal(objectMap) -} - -// ClusterListResult cluster list results -type ClusterListResult struct { - autorest.Response `json:"-"` - Value *[]Cluster `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ClusterProperties describes the cluster resource properties. -type ClusterProperties struct { - // AddOnFeatures - The list of add-on features to enable in the cluster. - AddOnFeatures *[]string `json:"addOnFeatures,omitempty"` - // AvailableClusterVersions - READ-ONLY; The Service Fabric runtime versions available for this cluster. - AvailableClusterVersions *[]ClusterVersionDetails `json:"availableClusterVersions,omitempty"` - // AzureActiveDirectory - The AAD authentication settings of the cluster. - AzureActiveDirectory *AzureActiveDirectory `json:"azureActiveDirectory,omitempty"` - // Certificate - The certificate to use for securing the cluster. The certificate provided will be used for node to node security within the cluster, SSL certificate for cluster management endpoint and default admin client. - Certificate *CertificateDescription `json:"certificate,omitempty"` - CertificateCommonNames *ServerCertificateCommonNames `json:"certificateCommonNames,omitempty"` - // ClientCertificateCommonNames - The list of client certificates referenced by common name that are allowed to manage the cluster. - ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` - // ClientCertificateThumbprints - The list of client certificates referenced by thumbprint that are allowed to manage the cluster. - ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` - // ClusterCodeVersion - The Service Fabric runtime version of the cluster. This property can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available Service Fabric versions for new clusters use [ClusterVersion API](./ClusterVersion.md). To get the list of available version for existing clusters use **availableClusterVersions**. - ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` - // ClusterEndpoint - READ-ONLY; The Azure Resource Provider endpoint. A system service in the cluster connects to this endpoint. - ClusterEndpoint *string `json:"clusterEndpoint,omitempty"` - // ClusterID - READ-ONLY; A service generated unique identifier for the cluster resource. - ClusterID *string `json:"clusterId,omitempty"` - // ClusterState - READ-ONLY; Possible values include: 'ClusterStateWaitingForNodes', 'ClusterStateDeploying', 'ClusterStateBaselineUpgrade', 'ClusterStateUpdatingUserConfiguration', 'ClusterStateUpdatingUserCertificate', 'ClusterStateUpdatingInfrastructure', 'ClusterStateEnforcingClusterVersion', 'ClusterStateUpgradeServiceUnreachable', 'ClusterStateAutoScale', 'ClusterStateReady' - ClusterState ClusterState `json:"clusterState,omitempty"` - // DiagnosticsStorageAccountConfig - The storage account information for storing Service Fabric diagnostic logs. - DiagnosticsStorageAccountConfig *DiagnosticsStorageAccountConfig `json:"diagnosticsStorageAccountConfig,omitempty"` - // EventStoreServiceEnabled - Indicates if the event store service is enabled. - EventStoreServiceEnabled *bool `json:"eventStoreServiceEnabled,omitempty"` - // FabricSettings - The list of custom fabric settings to configure the cluster. - FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` - // ManagementEndpoint - The http management endpoint of the cluster. - ManagementEndpoint *string `json:"managementEndpoint,omitempty"` - // NodeTypes - The list of node types in the cluster. - NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the cluster resource. Possible values include: 'ProvisioningStateUpdating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ReliabilityLevel - Possible values include: 'ReliabilityLevelNone', 'ReliabilityLevelBronze', 'ReliabilityLevelSilver', 'ReliabilityLevelGold', 'ReliabilityLevelPlatinum' - ReliabilityLevel ReliabilityLevel `json:"reliabilityLevel,omitempty"` - // ReverseProxyCertificate - The server certificate used by reverse proxy. - ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` - ReverseProxyCertificateCommonNames *ServerCertificateCommonNames `json:"reverseProxyCertificateCommonNames,omitempty"` - // UpgradeDescription - The policy to use when upgrading the cluster. - UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` - // UpgradeMode - Possible values include: 'UpgradeModeAutomatic', 'UpgradeModeManual' - UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` - // ApplicationTypeVersionsCleanupPolicy - The policy used to clean up unused versions. - ApplicationTypeVersionsCleanupPolicy *ApplicationTypeVersionsCleanupPolicy `json:"applicationTypeVersionsCleanupPolicy,omitempty"` - // VMImage - The VM image VMSS has been configured with. Generic names such as Windows or Linux can be used. - VMImage *string `json:"vmImage,omitempty"` - // SfZonalUpgradeMode - Possible values include: 'SfZonalUpgradeModeParallel', 'SfZonalUpgradeModeHierarchical' - SfZonalUpgradeMode SfZonalUpgradeMode `json:"sfZonalUpgradeMode,omitempty"` - // VmssZonalUpgradeMode - Possible values include: 'VmssZonalUpgradeModeParallel', 'VmssZonalUpgradeModeHierarchical' - VmssZonalUpgradeMode VmssZonalUpgradeMode `json:"vmssZonalUpgradeMode,omitempty"` - // InfrastructureServiceManager - Indicates if infrastructure service manager is enabled. - InfrastructureServiceManager *bool `json:"infrastructureServiceManager,omitempty"` - // UpgradeWave - Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **upgradeMode** is set to 'Automatic'. Possible values include: 'ClusterUpgradeCadenceWave0', 'ClusterUpgradeCadenceWave1', 'ClusterUpgradeCadenceWave2' - UpgradeWave ClusterUpgradeCadence `json:"upgradeWave,omitempty"` - // UpgradePauseStartTimestampUtc - Indicates the start date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - UpgradePauseStartTimestampUtc *date.Time `json:"upgradePauseStartTimestampUtc,omitempty"` - // UpgradePauseEndTimestampUtc - Indicates the end date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - UpgradePauseEndTimestampUtc *date.Time `json:"upgradePauseEndTimestampUtc,omitempty"` - // WaveUpgradePaused - Boolean to pause automatic runtime version upgrades to the cluster. - WaveUpgradePaused *bool `json:"waveUpgradePaused,omitempty"` - // Notifications - Indicates a list of notification channels for cluster events. - Notifications *[]Notification `json:"notifications,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterProperties. -func (cp ClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.AddOnFeatures != nil { - objectMap["addOnFeatures"] = cp.AddOnFeatures - } - if cp.AzureActiveDirectory != nil { - objectMap["azureActiveDirectory"] = cp.AzureActiveDirectory - } - if cp.Certificate != nil { - objectMap["certificate"] = cp.Certificate - } - if cp.CertificateCommonNames != nil { - objectMap["certificateCommonNames"] = cp.CertificateCommonNames - } - if cp.ClientCertificateCommonNames != nil { - objectMap["clientCertificateCommonNames"] = cp.ClientCertificateCommonNames - } - if cp.ClientCertificateThumbprints != nil { - objectMap["clientCertificateThumbprints"] = cp.ClientCertificateThumbprints - } - if cp.ClusterCodeVersion != nil { - objectMap["clusterCodeVersion"] = cp.ClusterCodeVersion - } - if cp.DiagnosticsStorageAccountConfig != nil { - objectMap["diagnosticsStorageAccountConfig"] = cp.DiagnosticsStorageAccountConfig - } - if cp.EventStoreServiceEnabled != nil { - objectMap["eventStoreServiceEnabled"] = cp.EventStoreServiceEnabled - } - if cp.FabricSettings != nil { - objectMap["fabricSettings"] = cp.FabricSettings - } - if cp.ManagementEndpoint != nil { - objectMap["managementEndpoint"] = cp.ManagementEndpoint - } - if cp.NodeTypes != nil { - objectMap["nodeTypes"] = cp.NodeTypes - } - if cp.ReliabilityLevel != "" { - objectMap["reliabilityLevel"] = cp.ReliabilityLevel - } - if cp.ReverseProxyCertificate != nil { - objectMap["reverseProxyCertificate"] = cp.ReverseProxyCertificate - } - if cp.ReverseProxyCertificateCommonNames != nil { - objectMap["reverseProxyCertificateCommonNames"] = cp.ReverseProxyCertificateCommonNames - } - if cp.UpgradeDescription != nil { - objectMap["upgradeDescription"] = cp.UpgradeDescription - } - if cp.UpgradeMode != "" { - objectMap["upgradeMode"] = cp.UpgradeMode - } - if cp.ApplicationTypeVersionsCleanupPolicy != nil { - objectMap["applicationTypeVersionsCleanupPolicy"] = cp.ApplicationTypeVersionsCleanupPolicy - } - if cp.VMImage != nil { - objectMap["vmImage"] = cp.VMImage - } - if cp.SfZonalUpgradeMode != "" { - objectMap["sfZonalUpgradeMode"] = cp.SfZonalUpgradeMode - } - if cp.VmssZonalUpgradeMode != "" { - objectMap["vmssZonalUpgradeMode"] = cp.VmssZonalUpgradeMode - } - if cp.InfrastructureServiceManager != nil { - objectMap["infrastructureServiceManager"] = cp.InfrastructureServiceManager - } - if cp.UpgradeWave != "" { - objectMap["upgradeWave"] = cp.UpgradeWave - } - if cp.UpgradePauseStartTimestampUtc != nil { - objectMap["upgradePauseStartTimestampUtc"] = cp.UpgradePauseStartTimestampUtc - } - if cp.UpgradePauseEndTimestampUtc != nil { - objectMap["upgradePauseEndTimestampUtc"] = cp.UpgradePauseEndTimestampUtc - } - if cp.WaveUpgradePaused != nil { - objectMap["waveUpgradePaused"] = cp.WaveUpgradePaused - } - if cp.Notifications != nil { - objectMap["notifications"] = cp.Notifications - } - return json.Marshal(objectMap) -} - -// ClusterPropertiesUpdateParameters describes the cluster resource properties that can be updated during -// PATCH operation. -type ClusterPropertiesUpdateParameters struct { - // AddOnFeatures - The list of add-on features to enable in the cluster. - AddOnFeatures *[]string `json:"addOnFeatures,omitempty"` - // Certificate - The certificate to use for securing the cluster. The certificate provided will be used for node to node security within the cluster, SSL certificate for cluster management endpoint and default admin client. - Certificate *CertificateDescription `json:"certificate,omitempty"` - CertificateCommonNames *ServerCertificateCommonNames `json:"certificateCommonNames,omitempty"` - // ClientCertificateCommonNames - The list of client certificates referenced by common name that are allowed to manage the cluster. This will overwrite the existing list. - ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` - // ClientCertificateThumbprints - The list of client certificates referenced by thumbprint that are allowed to manage the cluster. This will overwrite the existing list. - ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` - // ClusterCodeVersion - The Service Fabric runtime version of the cluster. This property can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available Service Fabric versions for new clusters use [ClusterVersion API](./ClusterVersion.md). To get the list of available version for existing clusters use **availableClusterVersions**. - ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` - // EventStoreServiceEnabled - Indicates if the event store service is enabled. - EventStoreServiceEnabled *bool `json:"eventStoreServiceEnabled,omitempty"` - // FabricSettings - The list of custom fabric settings to configure the cluster. This will overwrite the existing list. - FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` - // NodeTypes - The list of node types in the cluster. This will overwrite the existing list. - NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"` - // ReliabilityLevel - Possible values include: 'ReliabilityLevel1None', 'ReliabilityLevel1Bronze', 'ReliabilityLevel1Silver', 'ReliabilityLevel1Gold', 'ReliabilityLevel1Platinum' - ReliabilityLevel ReliabilityLevel1 `json:"reliabilityLevel,omitempty"` - // ReverseProxyCertificate - The server certificate used by reverse proxy. - ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` - // UpgradeDescription - The policy to use when upgrading the cluster. - UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` - // ApplicationTypeVersionsCleanupPolicy - The policy used to clean up unused versions. - ApplicationTypeVersionsCleanupPolicy *ApplicationTypeVersionsCleanupPolicy `json:"applicationTypeVersionsCleanupPolicy,omitempty"` - // UpgradeMode - Possible values include: 'UpgradeModeAutomatic', 'UpgradeModeManual' - UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` - // SfZonalUpgradeMode - Possible values include: 'SfZonalUpgradeModeParallel', 'SfZonalUpgradeModeHierarchical' - SfZonalUpgradeMode SfZonalUpgradeMode `json:"sfZonalUpgradeMode,omitempty"` - // VmssZonalUpgradeMode - Possible values include: 'VmssZonalUpgradeModeParallel', 'VmssZonalUpgradeModeHierarchical' - VmssZonalUpgradeMode VmssZonalUpgradeMode `json:"vmssZonalUpgradeMode,omitempty"` - // InfrastructureServiceManager - Indicates if infrastructure service manager is enabled. - InfrastructureServiceManager *bool `json:"infrastructureServiceManager,omitempty"` - // UpgradeWave - Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **upgradeMode** is set to 'Automatic'. Possible values include: 'ClusterUpgradeCadenceWave0', 'ClusterUpgradeCadenceWave1', 'ClusterUpgradeCadenceWave2' - UpgradeWave ClusterUpgradeCadence `json:"upgradeWave,omitempty"` - // UpgradePauseStartTimestampUtc - The start timestamp to pause runtime version upgrades on the cluster (UTC). - UpgradePauseStartTimestampUtc *date.Time `json:"upgradePauseStartTimestampUtc,omitempty"` - // UpgradePauseEndTimestampUtc - The end timestamp of pause runtime version upgrades on the cluster (UTC). - UpgradePauseEndTimestampUtc *date.Time `json:"upgradePauseEndTimestampUtc,omitempty"` - // WaveUpgradePaused - Boolean to pause automatic runtime version upgrades to the cluster. - WaveUpgradePaused *bool `json:"waveUpgradePaused,omitempty"` - // Notifications - Indicates a list of notification channels for cluster events. - Notifications *[]Notification `json:"notifications,omitempty"` -} - -// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ClustersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (Cluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersCreateOrUpdateFuture.Result. -func (future *ClustersCreateOrUpdateFuture) result(client ClustersClient) (c Cluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ClustersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.CreateOrUpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// ClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ClustersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (Cluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersUpdateFuture.Result. -func (future *ClustersUpdateFuture) result(client ClustersClient) (c Cluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ClustersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.UpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// ClusterUpdateParameters cluster update request -type ClusterUpdateParameters struct { - *ClusterPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - Cluster update parameters - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ClusterUpdateParameters. -func (cup ClusterUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.ClusterPropertiesUpdateParameters != nil { - objectMap["properties"] = cup.ClusterPropertiesUpdateParameters - } - if cup.Tags != nil { - objectMap["tags"] = cup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ClusterUpdateParameters struct. -func (cup *ClusterUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var clusterPropertiesUpdateParameters ClusterPropertiesUpdateParameters - err = json.Unmarshal(*v, &clusterPropertiesUpdateParameters) - if err != nil { - return err - } - cup.ClusterPropertiesUpdateParameters = &clusterPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cup.Tags = tags - } - } - } - - return nil -} - -// ClusterUpgradeDeltaHealthPolicy describes the delta health policies for the cluster upgrade. -type ClusterUpgradeDeltaHealthPolicy struct { - // MaxPercentDeltaUnhealthyNodes - The maximum allowed percentage of nodes health degradation allowed during cluster upgrades. - // The delta is measured between the state of the nodes at the beginning of upgrade and the state of the nodes at the time of the health evaluation. - // The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. - MaxPercentDeltaUnhealthyNodes *int32 `json:"maxPercentDeltaUnhealthyNodes,omitempty"` - // MaxPercentUpgradeDomainDeltaUnhealthyNodes - The maximum allowed percentage of upgrade domain nodes health degradation allowed during cluster upgrades. - // The delta is measured between the state of the upgrade domain nodes at the beginning of upgrade and the state of the upgrade domain nodes at the time of the health evaluation. - // The check is performed after every upgrade domain upgrade completion for all completed upgrade domains to make sure the state of the upgrade domains is within tolerated limits. - MaxPercentUpgradeDomainDeltaUnhealthyNodes *int32 `json:"maxPercentUpgradeDomainDeltaUnhealthyNodes,omitempty"` - // MaxPercentDeltaUnhealthyApplications - The maximum allowed percentage of applications health degradation allowed during cluster upgrades. - // The delta is measured between the state of the applications at the beginning of upgrade and the state of the applications at the time of the health evaluation. - // The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. System services are not included in this. - MaxPercentDeltaUnhealthyApplications *int32 `json:"maxPercentDeltaUnhealthyApplications,omitempty"` - // ApplicationDeltaHealthPolicies - Defines the application delta health policy map used to evaluate the health of an application or one of its child entities when upgrading the cluster. - ApplicationDeltaHealthPolicies map[string]*ApplicationDeltaHealthPolicy `json:"applicationDeltaHealthPolicies"` -} - -// MarshalJSON is the custom marshaler for ClusterUpgradeDeltaHealthPolicy. -func (cudhp ClusterUpgradeDeltaHealthPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cudhp.MaxPercentDeltaUnhealthyNodes != nil { - objectMap["maxPercentDeltaUnhealthyNodes"] = cudhp.MaxPercentDeltaUnhealthyNodes - } - if cudhp.MaxPercentUpgradeDomainDeltaUnhealthyNodes != nil { - objectMap["maxPercentUpgradeDomainDeltaUnhealthyNodes"] = cudhp.MaxPercentUpgradeDomainDeltaUnhealthyNodes - } - if cudhp.MaxPercentDeltaUnhealthyApplications != nil { - objectMap["maxPercentDeltaUnhealthyApplications"] = cudhp.MaxPercentDeltaUnhealthyApplications - } - if cudhp.ApplicationDeltaHealthPolicies != nil { - objectMap["applicationDeltaHealthPolicies"] = cudhp.ApplicationDeltaHealthPolicies - } - return json.Marshal(objectMap) -} - -// ClusterUpgradePolicy describes the policy used when upgrading the cluster. -type ClusterUpgradePolicy struct { - // ForceRestart - If true, then processes are forcefully restarted during upgrade even when the code version has not changed (the upgrade only changes configuration or data). - ForceRestart *bool `json:"forceRestart,omitempty"` - // UpgradeReplicaSetCheckTimeout - The maximum amount of time to block processing of an upgrade domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each upgrade domain. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - UpgradeReplicaSetCheckTimeout *string `json:"upgradeReplicaSetCheckTimeout,omitempty"` - // HealthCheckWaitDuration - The length of time to wait after completing an upgrade domain before performing health checks. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - HealthCheckWaitDuration *string `json:"healthCheckWaitDuration,omitempty"` - // HealthCheckStableDuration - The amount of time that the application or cluster must remain healthy before the upgrade proceeds to the next upgrade domain. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - HealthCheckStableDuration *string `json:"healthCheckStableDuration,omitempty"` - // HealthCheckRetryTimeout - The amount of time to retry health evaluation when the application or cluster is unhealthy before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - HealthCheckRetryTimeout *string `json:"healthCheckRetryTimeout,omitempty"` - // UpgradeTimeout - The amount of time the overall upgrade has to complete before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - UpgradeTimeout *string `json:"upgradeTimeout,omitempty"` - // UpgradeDomainTimeout - The amount of time each upgrade domain has to complete before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - UpgradeDomainTimeout *string `json:"upgradeDomainTimeout,omitempty"` - // HealthPolicy - The cluster health policy used when upgrading the cluster. - HealthPolicy *ClusterHealthPolicy `json:"healthPolicy,omitempty"` - // DeltaHealthPolicy - The cluster delta health policy used when upgrading the cluster. - DeltaHealthPolicy *ClusterUpgradeDeltaHealthPolicy `json:"deltaHealthPolicy,omitempty"` -} - -// ClusterVersionDetails the detail of the Service Fabric runtime version result -type ClusterVersionDetails struct { - // CodeVersion - The Service Fabric runtime version of the cluster. - CodeVersion *string `json:"codeVersion,omitempty"` - // SupportExpiryUtc - The date of expiry of support of the version. - SupportExpiryUtc *string `json:"supportExpiryUtc,omitempty"` - // Environment - Indicates if this version is for Windows or Linux operating system. Possible values include: 'EnvironmentWindows', 'EnvironmentLinux' - Environment Environment `json:"environment,omitempty"` -} - -// DiagnosticsStorageAccountConfig the storage account information for storing Service Fabric diagnostic -// logs. -type DiagnosticsStorageAccountConfig struct { - // StorageAccountName - The Azure storage account name. - StorageAccountName *string `json:"storageAccountName,omitempty"` - // ProtectedAccountKeyName - The protected diagnostics storage key name. - ProtectedAccountKeyName *string `json:"protectedAccountKeyName,omitempty"` - // ProtectedAccountKeyName2 - The secondary protected diagnostics storage key name. If one of the storage account keys is rotated the cluster will fallback to using the other. - ProtectedAccountKeyName2 *string `json:"protectedAccountKeyName2,omitempty"` - // BlobEndpoint - The blob endpoint of the azure storage account. - BlobEndpoint *string `json:"blobEndpoint,omitempty"` - // QueueEndpoint - The queue endpoint of the azure storage account. - QueueEndpoint *string `json:"queueEndpoint,omitempty"` - // TableEndpoint - The table endpoint of the azure storage account. - TableEndpoint *string `json:"tableEndpoint,omitempty"` -} - -// EndpointRangeDescription port range details -type EndpointRangeDescription struct { - // StartPort - Starting port of a range of ports - StartPort *int32 `json:"startPort,omitempty"` - // EndPort - End port of a range of ports - EndPort *int32 `json:"endPort,omitempty"` -} - -// ErrorModel the structure of the error. -type ErrorModel struct { - Error *ErrorModelError `json:"error,omitempty"` -} - -// ErrorModelError the error details. -type ErrorModelError struct { - // Code - The error code. - Code *string `json:"code,omitempty"` - // Message - The error message. - Message *string `json:"message,omitempty"` -} - -// ManagedIdentity describes the managed identities for an Azure resource. -type ManagedIdentity struct { - // PrincipalID - READ-ONLY; The principal id of the managed identity. This property will only be provided for a system assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id of the managed identity. This property will only be provided for a system assigned identity. - TenantID *string `json:"tenantId,omitempty"` - // Type - Possible values include: 'ManagedIdentityTypeSystemAssigned', 'ManagedIdentityTypeUserAssigned', 'ManagedIdentityTypeSystemAssignedUserAssigned', 'ManagedIdentityTypeNone' - Type ManagedIdentityType `json:"type,omitempty"` - UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ManagedIdentity. -func (mi ManagedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mi.Type != "" { - objectMap["type"] = mi.Type - } - if mi.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = mi.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// NamedPartitionSchemeDescription describes the named partition scheme of the service. -type NamedPartitionSchemeDescription struct { - // Count - The number of partitions. - Count *int32 `json:"count,omitempty"` - // Names - Array of size specified by the ‘count’ parameter, for the names of the partitions. - Names *[]string `json:"names,omitempty"` - // PartitionScheme - Possible values include: 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range' - PartitionScheme PartitionSchemeBasicPartitionSchemeDescription `json:"partitionScheme,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) MarshalJSON() ([]byte, error) { - npsd.PartitionScheme = PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed - objectMap := make(map[string]interface{}) - if npsd.Count != nil { - objectMap["count"] = npsd.Count - } - if npsd.Names != nil { - objectMap["names"] = npsd.Names - } - if npsd.PartitionScheme != "" { - objectMap["partitionScheme"] = npsd.PartitionScheme - } - return json.Marshal(objectMap) -} - -// AsNamedPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) AsNamedPartitionSchemeDescription() (*NamedPartitionSchemeDescription, bool) { - return &npsd, true -} - -// AsSingletonPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) AsSingletonPartitionSchemeDescription() (*SingletonPartitionSchemeDescription, bool) { - return nil, false -} - -// AsUniformInt64RangePartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) AsUniformInt64RangePartitionSchemeDescription() (*UniformInt64RangePartitionSchemeDescription, bool) { - return nil, false -} - -// AsPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) AsPartitionSchemeDescription() (*PartitionSchemeDescription, bool) { - return nil, false -} - -// AsBasicPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) AsBasicPartitionSchemeDescription() (BasicPartitionSchemeDescription, bool) { - return &npsd, true -} - -// NodeTypeDescription describes a node type in the cluster, each node type represents sub set of nodes in -// the cluster. -type NodeTypeDescription struct { - // Name - The name of the node type. - Name *string `json:"name,omitempty"` - // PlacementProperties - The placement tags applied to nodes in the node type, which can be used to indicate where certain services (workload) should run. - PlacementProperties map[string]*string `json:"placementProperties"` - // Capacities - The capacity tags applied to the nodes in the node type, the cluster resource manager uses these tags to understand how much resource a node has. - Capacities map[string]*string `json:"capacities"` - // ClientConnectionEndpointPort - The TCP cluster management endpoint port. - ClientConnectionEndpointPort *int32 `json:"clientConnectionEndpointPort,omitempty"` - // HTTPGatewayEndpointPort - The HTTP cluster management endpoint port. - HTTPGatewayEndpointPort *int32 `json:"httpGatewayEndpointPort,omitempty"` - // DurabilityLevel - Possible values include: 'DurabilityLevelBronze', 'DurabilityLevelSilver', 'DurabilityLevelGold' - DurabilityLevel DurabilityLevel `json:"durabilityLevel,omitempty"` - // ApplicationPorts - The range of ports from which cluster assigned port to Service Fabric applications. - ApplicationPorts *EndpointRangeDescription `json:"applicationPorts,omitempty"` - // EphemeralPorts - The range of ephemeral ports that nodes in this node type should be configured with. - EphemeralPorts *EndpointRangeDescription `json:"ephemeralPorts,omitempty"` - // IsPrimary - The node type on which system services will run. Only one node type should be marked as primary. Primary node type cannot be deleted or changed for existing clusters. - IsPrimary *bool `json:"isPrimary,omitempty"` - // VMInstanceCount - VMInstanceCount should be 1 to n, where n indicates the number of VM instances corresponding to this nodeType. VMInstanceCount = 0 can be done only in these scenarios: NodeType is a secondary nodeType. Durability = Bronze or Durability >= Bronze and InfrastructureServiceManager = true. If VMInstanceCount = 0, implies the VMs for this nodeType will not be used for the initial cluster size computation. - VMInstanceCount *int32 `json:"vmInstanceCount,omitempty"` - // ReverseProxyEndpointPort - The endpoint used by reverse proxy. - ReverseProxyEndpointPort *int32 `json:"reverseProxyEndpointPort,omitempty"` - // IsStateless - Indicates if the node type can only host Stateless workloads. - IsStateless *bool `json:"isStateless,omitempty"` - // MultipleAvailabilityZones - Indicates if the node type is enabled to support multiple zones. - MultipleAvailabilityZones *bool `json:"multipleAvailabilityZones,omitempty"` -} - -// MarshalJSON is the custom marshaler for NodeTypeDescription. -func (ntd NodeTypeDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ntd.Name != nil { - objectMap["name"] = ntd.Name - } - if ntd.PlacementProperties != nil { - objectMap["placementProperties"] = ntd.PlacementProperties - } - if ntd.Capacities != nil { - objectMap["capacities"] = ntd.Capacities - } - if ntd.ClientConnectionEndpointPort != nil { - objectMap["clientConnectionEndpointPort"] = ntd.ClientConnectionEndpointPort - } - if ntd.HTTPGatewayEndpointPort != nil { - objectMap["httpGatewayEndpointPort"] = ntd.HTTPGatewayEndpointPort - } - if ntd.DurabilityLevel != "" { - objectMap["durabilityLevel"] = ntd.DurabilityLevel - } - if ntd.ApplicationPorts != nil { - objectMap["applicationPorts"] = ntd.ApplicationPorts - } - if ntd.EphemeralPorts != nil { - objectMap["ephemeralPorts"] = ntd.EphemeralPorts - } - if ntd.IsPrimary != nil { - objectMap["isPrimary"] = ntd.IsPrimary - } - if ntd.VMInstanceCount != nil { - objectMap["vmInstanceCount"] = ntd.VMInstanceCount - } - if ntd.ReverseProxyEndpointPort != nil { - objectMap["reverseProxyEndpointPort"] = ntd.ReverseProxyEndpointPort - } - if ntd.IsStateless != nil { - objectMap["isStateless"] = ntd.IsStateless - } - if ntd.MultipleAvailabilityZones != nil { - objectMap["multipleAvailabilityZones"] = ntd.MultipleAvailabilityZones - } - return json.Marshal(objectMap) -} - -// Notification describes the notification channel for cluster events. -type Notification struct { - // IsEnabled - Indicates if the notification is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // NotificationCategory - The category of notification. - NotificationCategory *string `json:"notificationCategory,omitempty"` - // NotificationLevel - The level of notification. Possible values include: 'NotificationLevelCritical', 'NotificationLevelAll' - NotificationLevel NotificationLevel `json:"notificationLevel,omitempty"` - // NotificationTargets - List of targets that subscribe to the notification. - NotificationTargets *[]NotificationTarget `json:"notificationTargets,omitempty"` -} - -// NotificationTarget describes the notification target properties. -type NotificationTarget struct { - // NotificationChannel - The notification channel indicates the type of receivers subscribed to the notification, either user or subscription. Possible values include: 'NotificationChannelEmailUser', 'NotificationChannelEmailSubscription' - NotificationChannel NotificationChannel `json:"notificationChannel,omitempty"` - // Receivers - List of targets that subscribe to the notification. - Receivers *[]string `json:"receivers,omitempty"` -} - -// OperationListResult describes the result of the request to list Service Fabric resource provider -// operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the Service Fabric resource provider. - Value *[]OperationResult `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if olr.Value != nil { - objectMap["value"] = olr.Value - } - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of OperationResult values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// 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 *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.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 *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) 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 OperationListResultIterator) Response() OperationListResult { - 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 OperationListResultIterator) Value() OperationResult { - if !iter.page.NotDone() { - return OperationResult{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of OperationResult values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// 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 *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - 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 *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []OperationResult { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationResult available operation list result -type OperationResult struct { - // Name - The name of the operation. - Name *string `json:"name,omitempty"` - // IsDataAction - Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` - // Display - The object that represents the operation. - Display *AvailableOperationDisplay `json:"display,omitempty"` - // Origin - Origin result - Origin *string `json:"origin,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// BasicPartitionSchemeDescription describes how the service is partitioned. -type BasicPartitionSchemeDescription interface { - AsNamedPartitionSchemeDescription() (*NamedPartitionSchemeDescription, bool) - AsSingletonPartitionSchemeDescription() (*SingletonPartitionSchemeDescription, bool) - AsUniformInt64RangePartitionSchemeDescription() (*UniformInt64RangePartitionSchemeDescription, bool) - AsPartitionSchemeDescription() (*PartitionSchemeDescription, bool) -} - -// PartitionSchemeDescription describes how the service is partitioned. -type PartitionSchemeDescription struct { - // PartitionScheme - Possible values include: 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range' - PartitionScheme PartitionSchemeBasicPartitionSchemeDescription `json:"partitionScheme,omitempty"` -} - -func unmarshalBasicPartitionSchemeDescription(body []byte) (BasicPartitionSchemeDescription, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["partitionScheme"] { - case string(PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed): - var npsd NamedPartitionSchemeDescription - err := json.Unmarshal(body, &npsd) - return npsd, err - case string(PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton): - var spsd SingletonPartitionSchemeDescription - err := json.Unmarshal(body, &spsd) - return spsd, err - case string(PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range): - var ui6rpsd UniformInt64RangePartitionSchemeDescription - err := json.Unmarshal(body, &ui6rpsd) - return ui6rpsd, err - default: - var psd PartitionSchemeDescription - err := json.Unmarshal(body, &psd) - return psd, err - } -} -func unmarshalBasicPartitionSchemeDescriptionArray(body []byte) ([]BasicPartitionSchemeDescription, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - psdArray := make([]BasicPartitionSchemeDescription, len(rawMessages)) - - for index, rawMessage := range rawMessages { - psd, err := unmarshalBasicPartitionSchemeDescription(*rawMessage) - if err != nil { - return nil, err - } - psdArray[index] = psd - } - return psdArray, nil -} - -// MarshalJSON is the custom marshaler for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) MarshalJSON() ([]byte, error) { - psd.PartitionScheme = PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription - objectMap := make(map[string]interface{}) - if psd.PartitionScheme != "" { - objectMap["partitionScheme"] = psd.PartitionScheme - } - return json.Marshal(objectMap) -} - -// AsNamedPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) AsNamedPartitionSchemeDescription() (*NamedPartitionSchemeDescription, bool) { - return nil, false -} - -// AsSingletonPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) AsSingletonPartitionSchemeDescription() (*SingletonPartitionSchemeDescription, bool) { - return nil, false -} - -// AsUniformInt64RangePartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) AsUniformInt64RangePartitionSchemeDescription() (*UniformInt64RangePartitionSchemeDescription, bool) { - return nil, false -} - -// AsPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) AsPartitionSchemeDescription() (*PartitionSchemeDescription, bool) { - return &psd, true -} - -// AsBasicPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) AsBasicPartitionSchemeDescription() (BasicPartitionSchemeDescription, bool) { - return &psd, true -} - -// ProxyResource the resource model definition for proxy-only resource. -type ProxyResource struct { - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pr.Location != nil { - objectMap["location"] = pr.Location - } - if pr.Tags != nil { - objectMap["tags"] = pr.Tags - } - if pr.SystemData != nil { - objectMap["systemData"] = pr.SystemData - } - return json.Marshal(objectMap) -} - -// Resource the resource model definition. -type Resource struct { - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - Azure resource location. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - if r.SystemData != nil { - objectMap["systemData"] = r.SystemData - } - return json.Marshal(objectMap) -} - -// ServerCertificateCommonName describes the server certificate details using common name. -type ServerCertificateCommonName struct { - // CertificateCommonName - The common name of the server certificate. - CertificateCommonName *string `json:"certificateCommonName,omitempty"` - // CertificateIssuerThumbprint - The issuer thumbprint of the server certificate. - CertificateIssuerThumbprint *string `json:"certificateIssuerThumbprint,omitempty"` -} - -// ServerCertificateCommonNames describes a list of server certificates referenced by common name that are -// used to secure the cluster. -type ServerCertificateCommonNames struct { - // CommonNames - The list of server certificates referenced by common name that are used to secure the cluster. - CommonNames *[]ServerCertificateCommonName `json:"commonNames,omitempty"` - // X509StoreName - Possible values include: 'X509StoreName1AddressBook', 'X509StoreName1AuthRoot', 'X509StoreName1CertificateAuthority', 'X509StoreName1Disallowed', 'X509StoreName1My', 'X509StoreName1Root', 'X509StoreName1TrustedPeople', 'X509StoreName1TrustedPublisher' - X509StoreName X509StoreName1 `json:"x509StoreName,omitempty"` -} - -// ServiceCorrelationDescription creates a particular correlation between services. -type ServiceCorrelationDescription struct { - // Scheme - The ServiceCorrelationScheme which describes the relationship between this service and the service specified via ServiceName. Possible values include: 'ServiceCorrelationSchemeInvalid', 'ServiceCorrelationSchemeAffinity', 'ServiceCorrelationSchemeAlignedAffinity', 'ServiceCorrelationSchemeNonAlignedAffinity' - Scheme ServiceCorrelationScheme `json:"scheme,omitempty"` - // ServiceName - The name of the service that the correlation relationship is established with. - ServiceName *string `json:"serviceName,omitempty"` -} - -// ServiceLoadMetricDescription specifies a metric to load balance a service during runtime. -type ServiceLoadMetricDescription struct { - // Name - The name of the metric. If the service chooses to report load during runtime, the load metric name should match the name that is specified in Name exactly. Note that metric names are case sensitive. - Name *string `json:"name,omitempty"` - // Weight - The service load metric relative weight, compared to other metrics configured for this service, as a number. Possible values include: 'ServiceLoadMetricWeightZero', 'ServiceLoadMetricWeightLow', 'ServiceLoadMetricWeightMedium', 'ServiceLoadMetricWeightHigh' - Weight ServiceLoadMetricWeight `json:"weight,omitempty"` - // PrimaryDefaultLoad - Used only for Stateful services. The default amount of load, as a number, that this service creates for this metric when it is a Primary replica. - PrimaryDefaultLoad *int32 `json:"primaryDefaultLoad,omitempty"` - // SecondaryDefaultLoad - Used only for Stateful services. The default amount of load, as a number, that this service creates for this metric when it is a Secondary replica. - SecondaryDefaultLoad *int32 `json:"secondaryDefaultLoad,omitempty"` - // DefaultLoad - Used only for Stateless services. The default amount of load, as a number, that this service creates for this metric. - DefaultLoad *int32 `json:"defaultLoad,omitempty"` -} - -// BasicServicePlacementPolicyDescription describes the policy to be used for placement of a Service Fabric service. -type BasicServicePlacementPolicyDescription interface { - AsServicePlacementPolicyDescription() (*ServicePlacementPolicyDescription, bool) -} - -// ServicePlacementPolicyDescription describes the policy to be used for placement of a Service Fabric service. -type ServicePlacementPolicyDescription struct { - // Type - Possible values include: 'TypeServicePlacementPolicyDescription' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicServicePlacementPolicyDescription(body []byte) (BasicServicePlacementPolicyDescription, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - default: - var sppd ServicePlacementPolicyDescription - err := json.Unmarshal(body, &sppd) - return sppd, err - } -} -func unmarshalBasicServicePlacementPolicyDescriptionArray(body []byte) ([]BasicServicePlacementPolicyDescription, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - sppdArray := make([]BasicServicePlacementPolicyDescription, len(rawMessages)) - - for index, rawMessage := range rawMessages { - sppd, err := unmarshalBasicServicePlacementPolicyDescription(*rawMessage) - if err != nil { - return nil, err - } - sppdArray[index] = sppd - } - return sppdArray, nil -} - -// MarshalJSON is the custom marshaler for ServicePlacementPolicyDescription. -func (sppd ServicePlacementPolicyDescription) MarshalJSON() ([]byte, error) { - sppd.Type = TypeServicePlacementPolicyDescription - objectMap := make(map[string]interface{}) - if sppd.Type != "" { - objectMap["type"] = sppd.Type - } - return json.Marshal(objectMap) -} - -// AsServicePlacementPolicyDescription is the BasicServicePlacementPolicyDescription implementation for ServicePlacementPolicyDescription. -func (sppd ServicePlacementPolicyDescription) AsServicePlacementPolicyDescription() (*ServicePlacementPolicyDescription, bool) { - return &sppd, true -} - -// AsBasicServicePlacementPolicyDescription is the BasicServicePlacementPolicyDescription implementation for ServicePlacementPolicyDescription. -func (sppd ServicePlacementPolicyDescription) AsBasicServicePlacementPolicyDescription() (BasicServicePlacementPolicyDescription, bool) { - return &sppd, true -} - -// ServiceResource the service resource. -type ServiceResource struct { - autorest.Response `json:"-"` - BasicServiceResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceResource. -func (sr ServiceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = sr.BasicServiceResourceProperties - if sr.Location != nil { - objectMap["location"] = sr.Location - } - if sr.Tags != nil { - objectMap["tags"] = sr.Tags - } - if sr.SystemData != nil { - objectMap["systemData"] = sr.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResource struct. -func (sr *ServiceResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - basicServiceResourceProperties, err := unmarshalBasicServiceResourceProperties(*v) - if err != nil { - return err - } - sr.BasicServiceResourceProperties = basicServiceResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sr.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sr.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sr.SystemData = &systemData - } - } - } - - return nil -} - -// ServiceResourceList the list of service resources. -type ServiceResourceList struct { - autorest.Response `json:"-"` - Value *[]ServiceResource `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of service list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceResourceList. -func (srl ServiceResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srl.Value != nil { - objectMap["value"] = srl.Value - } - return json.Marshal(objectMap) -} - -// BasicServiceResourceProperties the service resource properties. -type BasicServiceResourceProperties interface { - AsStatefulServiceProperties() (*StatefulServiceProperties, bool) - AsStatelessServiceProperties() (*StatelessServiceProperties, bool) - AsServiceResourceProperties() (*ServiceResourceProperties, bool) -} - -// ServiceResourceProperties the service resource properties. -type ServiceResourceProperties struct { - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response - ProvisioningState *string `json:"provisioningState,omitempty"` - // ServiceTypeName - The name of the service type - ServiceTypeName *string `json:"serviceTypeName,omitempty"` - PartitionDescription BasicPartitionSchemeDescription `json:"partitionDescription,omitempty"` - // ServicePackageActivationMode - The activation Mode of the service package. Possible values include: 'ArmServicePackageActivationModeSharedProcess', 'ArmServicePackageActivationModeExclusiveProcess' - ServicePackageActivationMode ArmServicePackageActivationMode `json:"servicePackageActivationMode,omitempty"` - // ServiceDNSName - Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - ServiceDNSName *string `json:"serviceDnsName,omitempty"` - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -func unmarshalBasicServiceResourceProperties(body []byte) (BasicServiceResourceProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["serviceKind"] { - case string(ServiceKindBasicServiceResourcePropertiesServiceKindStateful): - var ssp StatefulServiceProperties - err := json.Unmarshal(body, &ssp) - return ssp, err - case string(ServiceKindBasicServiceResourcePropertiesServiceKindStateless): - var ssp StatelessServiceProperties - err := json.Unmarshal(body, &ssp) - return ssp, err - default: - var srp ServiceResourceProperties - err := json.Unmarshal(body, &srp) - return srp, err - } -} -func unmarshalBasicServiceResourcePropertiesArray(body []byte) ([]BasicServiceResourceProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - srpArray := make([]BasicServiceResourceProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - srp, err := unmarshalBasicServiceResourceProperties(*rawMessage) - if err != nil { - return nil, err - } - srpArray[index] = srp - } - return srpArray, nil -} - -// MarshalJSON is the custom marshaler for ServiceResourceProperties. -func (srp ServiceResourceProperties) MarshalJSON() ([]byte, error) { - srp.ServiceKind = ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties - objectMap := make(map[string]interface{}) - if srp.ServiceTypeName != nil { - objectMap["serviceTypeName"] = srp.ServiceTypeName - } - objectMap["partitionDescription"] = srp.PartitionDescription - if srp.ServicePackageActivationMode != "" { - objectMap["servicePackageActivationMode"] = srp.ServicePackageActivationMode - } - if srp.ServiceDNSName != nil { - objectMap["serviceDnsName"] = srp.ServiceDNSName - } - if srp.ServiceKind != "" { - objectMap["serviceKind"] = srp.ServiceKind - } - if srp.PlacementConstraints != nil { - objectMap["placementConstraints"] = srp.PlacementConstraints - } - if srp.CorrelationScheme != nil { - objectMap["correlationScheme"] = srp.CorrelationScheme - } - if srp.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = srp.ServiceLoadMetrics - } - if srp.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = srp.ServicePlacementPolicies - } - if srp.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = srp.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceProperties is the BasicServiceResourceProperties implementation for ServiceResourceProperties. -func (srp ServiceResourceProperties) AsStatefulServiceProperties() (*StatefulServiceProperties, bool) { - return nil, false -} - -// AsStatelessServiceProperties is the BasicServiceResourceProperties implementation for ServiceResourceProperties. -func (srp ServiceResourceProperties) AsStatelessServiceProperties() (*StatelessServiceProperties, bool) { - return nil, false -} - -// AsServiceResourceProperties is the BasicServiceResourceProperties implementation for ServiceResourceProperties. -func (srp ServiceResourceProperties) AsServiceResourceProperties() (*ServiceResourceProperties, bool) { - return &srp, true -} - -// AsBasicServiceResourceProperties is the BasicServiceResourceProperties implementation for ServiceResourceProperties. -func (srp ServiceResourceProperties) AsBasicServiceResourceProperties() (BasicServiceResourceProperties, bool) { - return &srp, true -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResourceProperties struct. -func (srp *ServiceResourceProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - srp.ProvisioningState = &provisioningState - } - case "serviceTypeName": - if v != nil { - var serviceTypeName string - err = json.Unmarshal(*v, &serviceTypeName) - if err != nil { - return err - } - srp.ServiceTypeName = &serviceTypeName - } - case "partitionDescription": - if v != nil { - partitionDescription, err := unmarshalBasicPartitionSchemeDescription(*v) - if err != nil { - return err - } - srp.PartitionDescription = partitionDescription - } - case "servicePackageActivationMode": - if v != nil { - var servicePackageActivationMode ArmServicePackageActivationMode - err = json.Unmarshal(*v, &servicePackageActivationMode) - if err != nil { - return err - } - srp.ServicePackageActivationMode = servicePackageActivationMode - } - case "serviceDnsName": - if v != nil { - var serviceDNSName string - err = json.Unmarshal(*v, &serviceDNSName) - if err != nil { - return err - } - srp.ServiceDNSName = &serviceDNSName - } - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - srp.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - srp.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - srp.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - srp.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - srp.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - srp.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// ServiceResourcePropertiesBase the common service resource properties. -type ServiceResourcePropertiesBase struct { - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResourcePropertiesBase struct. -func (srpb *ServiceResourcePropertiesBase) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - srpb.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - srpb.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - srpb.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - srpb.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - srpb.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// ServiceResourceUpdate the service resource for patch operations. -type ServiceResourceUpdate struct { - BasicServiceResourceUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceResourceUpdate. -func (sru ServiceResourceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = sru.BasicServiceResourceUpdateProperties - if sru.Location != nil { - objectMap["location"] = sru.Location - } - if sru.Tags != nil { - objectMap["tags"] = sru.Tags - } - if sru.SystemData != nil { - objectMap["systemData"] = sru.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResourceUpdate struct. -func (sru *ServiceResourceUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - basicServiceResourceUpdateProperties, err := unmarshalBasicServiceResourceUpdateProperties(*v) - if err != nil { - return err - } - sru.BasicServiceResourceUpdateProperties = basicServiceResourceUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sru.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sru.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sru.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sru.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sru.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sru.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sru.SystemData = &systemData - } - } - } - - return nil -} - -// BasicServiceResourceUpdateProperties the service resource properties for patch operations. -type BasicServiceResourceUpdateProperties interface { - AsStatefulServiceUpdateProperties() (*StatefulServiceUpdateProperties, bool) - AsStatelessServiceUpdateProperties() (*StatelessServiceUpdateProperties, bool) - AsServiceResourceUpdateProperties() (*ServiceResourceUpdateProperties, bool) -} - -// ServiceResourceUpdateProperties the service resource properties for patch operations. -type ServiceResourceUpdateProperties struct { - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceUpdateProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -func unmarshalBasicServiceResourceUpdateProperties(body []byte) (BasicServiceResourceUpdateProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["serviceKind"] { - case string(ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful): - var ssup StatefulServiceUpdateProperties - err := json.Unmarshal(body, &ssup) - return ssup, err - case string(ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless): - var ssup StatelessServiceUpdateProperties - err := json.Unmarshal(body, &ssup) - return ssup, err - default: - var srup ServiceResourceUpdateProperties - err := json.Unmarshal(body, &srup) - return srup, err - } -} -func unmarshalBasicServiceResourceUpdatePropertiesArray(body []byte) ([]BasicServiceResourceUpdateProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - srupArray := make([]BasicServiceResourceUpdateProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - srup, err := unmarshalBasicServiceResourceUpdateProperties(*rawMessage) - if err != nil { - return nil, err - } - srupArray[index] = srup - } - return srupArray, nil -} - -// MarshalJSON is the custom marshaler for ServiceResourceUpdateProperties. -func (srup ServiceResourceUpdateProperties) MarshalJSON() ([]byte, error) { - srup.ServiceKind = ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties - objectMap := make(map[string]interface{}) - if srup.ServiceKind != "" { - objectMap["serviceKind"] = srup.ServiceKind - } - if srup.PlacementConstraints != nil { - objectMap["placementConstraints"] = srup.PlacementConstraints - } - if srup.CorrelationScheme != nil { - objectMap["correlationScheme"] = srup.CorrelationScheme - } - if srup.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = srup.ServiceLoadMetrics - } - if srup.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = srup.ServicePlacementPolicies - } - if srup.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = srup.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for ServiceResourceUpdateProperties. -func (srup ServiceResourceUpdateProperties) AsStatefulServiceUpdateProperties() (*StatefulServiceUpdateProperties, bool) { - return nil, false -} - -// AsStatelessServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for ServiceResourceUpdateProperties. -func (srup ServiceResourceUpdateProperties) AsStatelessServiceUpdateProperties() (*StatelessServiceUpdateProperties, bool) { - return nil, false -} - -// AsServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for ServiceResourceUpdateProperties. -func (srup ServiceResourceUpdateProperties) AsServiceResourceUpdateProperties() (*ServiceResourceUpdateProperties, bool) { - return &srup, true -} - -// AsBasicServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for ServiceResourceUpdateProperties. -func (srup ServiceResourceUpdateProperties) AsBasicServiceResourceUpdateProperties() (BasicServiceResourceUpdateProperties, bool) { - return &srup, true -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResourceUpdateProperties struct. -func (srup *ServiceResourceUpdateProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceUpdateProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - srup.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - srup.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - srup.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - srup.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - srup.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - srup.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// ServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesCreateOrUpdateFuture.Result. -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, "servicefabric.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.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, "servicefabric.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.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesDeleteFuture.Result. -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, "servicefabric.ServicesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ServicesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesUpdateFuture.Result. -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, "servicefabric.ServicesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.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, "servicefabric.ServicesUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceTypeDeltaHealthPolicy represents the delta health policy used to evaluate the health of services -// belonging to a service type when upgrading the cluster. -type ServiceTypeDeltaHealthPolicy struct { - // MaxPercentDeltaUnhealthyServices - The maximum allowed percentage of services health degradation allowed during cluster upgrades. - // The delta is measured between the state of the services at the beginning of upgrade and the state of the services at the time of the health evaluation. - // The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. - MaxPercentDeltaUnhealthyServices *int32 `json:"maxPercentDeltaUnhealthyServices,omitempty"` -} - -// ServiceTypeHealthPolicy represents the health policy used to evaluate the health of services belonging -// to a service type. -type ServiceTypeHealthPolicy struct { - // MaxPercentUnhealthyServices - The maximum percentage of services allowed to be unhealthy before your application is considered in error. - MaxPercentUnhealthyServices *int32 `json:"maxPercentUnhealthyServices,omitempty"` -} - -// SettingsParameterDescription describes a parameter in fabric settings of the cluster. -type SettingsParameterDescription struct { - // Name - The parameter name of fabric setting. - Name *string `json:"name,omitempty"` - // Value - The parameter value of fabric setting. - Value *string `json:"value,omitempty"` -} - -// SettingsSectionDescription describes a section in the fabric settings of the cluster. -type SettingsSectionDescription struct { - // Name - The section name of the fabric settings. - Name *string `json:"name,omitempty"` - // Parameters - The collection of parameters in the section. - Parameters *[]SettingsParameterDescription `json:"parameters,omitempty"` -} - -// SingletonPartitionSchemeDescription describes the partition scheme of a singleton-partitioned, or -// non-partitioned service. -type SingletonPartitionSchemeDescription struct { - // PartitionScheme - Possible values include: 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range' - PartitionScheme PartitionSchemeBasicPartitionSchemeDescription `json:"partitionScheme,omitempty"` -} - -// MarshalJSON is the custom marshaler for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) MarshalJSON() ([]byte, error) { - spsd.PartitionScheme = PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton - objectMap := make(map[string]interface{}) - if spsd.PartitionScheme != "" { - objectMap["partitionScheme"] = spsd.PartitionScheme - } - return json.Marshal(objectMap) -} - -// AsNamedPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) AsNamedPartitionSchemeDescription() (*NamedPartitionSchemeDescription, bool) { - return nil, false -} - -// AsSingletonPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) AsSingletonPartitionSchemeDescription() (*SingletonPartitionSchemeDescription, bool) { - return &spsd, true -} - -// AsUniformInt64RangePartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) AsUniformInt64RangePartitionSchemeDescription() (*UniformInt64RangePartitionSchemeDescription, bool) { - return nil, false -} - -// AsPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) AsPartitionSchemeDescription() (*PartitionSchemeDescription, bool) { - return nil, false -} - -// AsBasicPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) AsBasicPartitionSchemeDescription() (BasicPartitionSchemeDescription, bool) { - return &spsd, true -} - -// StatefulServiceProperties the properties of a stateful service resource. -type StatefulServiceProperties struct { - // HasPersistedState - A flag indicating whether this is a persistent service which stores states on the local disk. If it is then the value of this property is true, if not it is false. - HasPersistedState *bool `json:"hasPersistedState,omitempty"` - // TargetReplicaSetSize - The target replica set size as a number. - TargetReplicaSetSize *int32 `json:"targetReplicaSetSize,omitempty"` - // MinReplicaSetSize - The minimum replica set size as a number. - MinReplicaSetSize *int32 `json:"minReplicaSetSize,omitempty"` - // ReplicaRestartWaitDuration - The duration between when a replica goes down and when a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - ReplicaRestartWaitDuration *date.Time `json:"replicaRestartWaitDuration,omitempty"` - // QuorumLossWaitDuration - The maximum duration for which a partition is allowed to be in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - QuorumLossWaitDuration *date.Time `json:"quorumLossWaitDuration,omitempty"` - // StandByReplicaKeepDuration - The definition on how long StandBy replicas should be maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - StandByReplicaKeepDuration *date.Time `json:"standByReplicaKeepDuration,omitempty"` - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response - ProvisioningState *string `json:"provisioningState,omitempty"` - // ServiceTypeName - The name of the service type - ServiceTypeName *string `json:"serviceTypeName,omitempty"` - PartitionDescription BasicPartitionSchemeDescription `json:"partitionDescription,omitempty"` - // ServicePackageActivationMode - The activation Mode of the service package. Possible values include: 'ArmServicePackageActivationModeSharedProcess', 'ArmServicePackageActivationModeExclusiveProcess' - ServicePackageActivationMode ArmServicePackageActivationMode `json:"servicePackageActivationMode,omitempty"` - // ServiceDNSName - Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - ServiceDNSName *string `json:"serviceDnsName,omitempty"` - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -// MarshalJSON is the custom marshaler for StatefulServiceProperties. -func (ssp StatefulServiceProperties) MarshalJSON() ([]byte, error) { - ssp.ServiceKind = ServiceKindBasicServiceResourcePropertiesServiceKindStateful - objectMap := make(map[string]interface{}) - if ssp.HasPersistedState != nil { - objectMap["hasPersistedState"] = ssp.HasPersistedState - } - if ssp.TargetReplicaSetSize != nil { - objectMap["targetReplicaSetSize"] = ssp.TargetReplicaSetSize - } - if ssp.MinReplicaSetSize != nil { - objectMap["minReplicaSetSize"] = ssp.MinReplicaSetSize - } - if ssp.ReplicaRestartWaitDuration != nil { - objectMap["replicaRestartWaitDuration"] = ssp.ReplicaRestartWaitDuration - } - if ssp.QuorumLossWaitDuration != nil { - objectMap["quorumLossWaitDuration"] = ssp.QuorumLossWaitDuration - } - if ssp.StandByReplicaKeepDuration != nil { - objectMap["standByReplicaKeepDuration"] = ssp.StandByReplicaKeepDuration - } - if ssp.ServiceTypeName != nil { - objectMap["serviceTypeName"] = ssp.ServiceTypeName - } - objectMap["partitionDescription"] = ssp.PartitionDescription - if ssp.ServicePackageActivationMode != "" { - objectMap["servicePackageActivationMode"] = ssp.ServicePackageActivationMode - } - if ssp.ServiceDNSName != nil { - objectMap["serviceDnsName"] = ssp.ServiceDNSName - } - if ssp.ServiceKind != "" { - objectMap["serviceKind"] = ssp.ServiceKind - } - if ssp.PlacementConstraints != nil { - objectMap["placementConstraints"] = ssp.PlacementConstraints - } - if ssp.CorrelationScheme != nil { - objectMap["correlationScheme"] = ssp.CorrelationScheme - } - if ssp.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = ssp.ServiceLoadMetrics - } - if ssp.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = ssp.ServicePlacementPolicies - } - if ssp.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = ssp.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceProperties is the BasicServiceResourceProperties implementation for StatefulServiceProperties. -func (ssp StatefulServiceProperties) AsStatefulServiceProperties() (*StatefulServiceProperties, bool) { - return &ssp, true -} - -// AsStatelessServiceProperties is the BasicServiceResourceProperties implementation for StatefulServiceProperties. -func (ssp StatefulServiceProperties) AsStatelessServiceProperties() (*StatelessServiceProperties, bool) { - return nil, false -} - -// AsServiceResourceProperties is the BasicServiceResourceProperties implementation for StatefulServiceProperties. -func (ssp StatefulServiceProperties) AsServiceResourceProperties() (*ServiceResourceProperties, bool) { - return nil, false -} - -// AsBasicServiceResourceProperties is the BasicServiceResourceProperties implementation for StatefulServiceProperties. -func (ssp StatefulServiceProperties) AsBasicServiceResourceProperties() (BasicServiceResourceProperties, bool) { - return &ssp, true -} - -// UnmarshalJSON is the custom unmarshaler for StatefulServiceProperties struct. -func (ssp *StatefulServiceProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "hasPersistedState": - if v != nil { - var hasPersistedState bool - err = json.Unmarshal(*v, &hasPersistedState) - if err != nil { - return err - } - ssp.HasPersistedState = &hasPersistedState - } - case "targetReplicaSetSize": - if v != nil { - var targetReplicaSetSize int32 - err = json.Unmarshal(*v, &targetReplicaSetSize) - if err != nil { - return err - } - ssp.TargetReplicaSetSize = &targetReplicaSetSize - } - case "minReplicaSetSize": - if v != nil { - var minReplicaSetSize int32 - err = json.Unmarshal(*v, &minReplicaSetSize) - if err != nil { - return err - } - ssp.MinReplicaSetSize = &minReplicaSetSize - } - case "replicaRestartWaitDuration": - if v != nil { - var replicaRestartWaitDuration date.Time - err = json.Unmarshal(*v, &replicaRestartWaitDuration) - if err != nil { - return err - } - ssp.ReplicaRestartWaitDuration = &replicaRestartWaitDuration - } - case "quorumLossWaitDuration": - if v != nil { - var quorumLossWaitDuration date.Time - err = json.Unmarshal(*v, &quorumLossWaitDuration) - if err != nil { - return err - } - ssp.QuorumLossWaitDuration = &quorumLossWaitDuration - } - case "standByReplicaKeepDuration": - if v != nil { - var standByReplicaKeepDuration date.Time - err = json.Unmarshal(*v, &standByReplicaKeepDuration) - if err != nil { - return err - } - ssp.StandByReplicaKeepDuration = &standByReplicaKeepDuration - } - case "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - ssp.ProvisioningState = &provisioningState - } - case "serviceTypeName": - if v != nil { - var serviceTypeName string - err = json.Unmarshal(*v, &serviceTypeName) - if err != nil { - return err - } - ssp.ServiceTypeName = &serviceTypeName - } - case "partitionDescription": - if v != nil { - partitionDescription, err := unmarshalBasicPartitionSchemeDescription(*v) - if err != nil { - return err - } - ssp.PartitionDescription = partitionDescription - } - case "servicePackageActivationMode": - if v != nil { - var servicePackageActivationMode ArmServicePackageActivationMode - err = json.Unmarshal(*v, &servicePackageActivationMode) - if err != nil { - return err - } - ssp.ServicePackageActivationMode = servicePackageActivationMode - } - case "serviceDnsName": - if v != nil { - var serviceDNSName string - err = json.Unmarshal(*v, &serviceDNSName) - if err != nil { - return err - } - ssp.ServiceDNSName = &serviceDNSName - } - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - ssp.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - ssp.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - ssp.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - ssp.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - ssp.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - ssp.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// StatefulServiceUpdateProperties the properties of a stateful service resource for patch operations. -type StatefulServiceUpdateProperties struct { - // TargetReplicaSetSize - The target replica set size as a number. - TargetReplicaSetSize *int32 `json:"targetReplicaSetSize,omitempty"` - // MinReplicaSetSize - The minimum replica set size as a number. - MinReplicaSetSize *int32 `json:"minReplicaSetSize,omitempty"` - // ReplicaRestartWaitDuration - The duration between when a replica goes down and when a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - ReplicaRestartWaitDuration *date.Time `json:"replicaRestartWaitDuration,omitempty"` - // QuorumLossWaitDuration - The maximum duration for which a partition is allowed to be in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - QuorumLossWaitDuration *date.Time `json:"quorumLossWaitDuration,omitempty"` - // StandByReplicaKeepDuration - The definition on how long StandBy replicas should be maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - StandByReplicaKeepDuration *date.Time `json:"standByReplicaKeepDuration,omitempty"` - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceUpdateProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -// MarshalJSON is the custom marshaler for StatefulServiceUpdateProperties. -func (ssup StatefulServiceUpdateProperties) MarshalJSON() ([]byte, error) { - ssup.ServiceKind = ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful - objectMap := make(map[string]interface{}) - if ssup.TargetReplicaSetSize != nil { - objectMap["targetReplicaSetSize"] = ssup.TargetReplicaSetSize - } - if ssup.MinReplicaSetSize != nil { - objectMap["minReplicaSetSize"] = ssup.MinReplicaSetSize - } - if ssup.ReplicaRestartWaitDuration != nil { - objectMap["replicaRestartWaitDuration"] = ssup.ReplicaRestartWaitDuration - } - if ssup.QuorumLossWaitDuration != nil { - objectMap["quorumLossWaitDuration"] = ssup.QuorumLossWaitDuration - } - if ssup.StandByReplicaKeepDuration != nil { - objectMap["standByReplicaKeepDuration"] = ssup.StandByReplicaKeepDuration - } - if ssup.ServiceKind != "" { - objectMap["serviceKind"] = ssup.ServiceKind - } - if ssup.PlacementConstraints != nil { - objectMap["placementConstraints"] = ssup.PlacementConstraints - } - if ssup.CorrelationScheme != nil { - objectMap["correlationScheme"] = ssup.CorrelationScheme - } - if ssup.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = ssup.ServiceLoadMetrics - } - if ssup.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = ssup.ServicePlacementPolicies - } - if ssup.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = ssup.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatefulServiceUpdateProperties. -func (ssup StatefulServiceUpdateProperties) AsStatefulServiceUpdateProperties() (*StatefulServiceUpdateProperties, bool) { - return &ssup, true -} - -// AsStatelessServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatefulServiceUpdateProperties. -func (ssup StatefulServiceUpdateProperties) AsStatelessServiceUpdateProperties() (*StatelessServiceUpdateProperties, bool) { - return nil, false -} - -// AsServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatefulServiceUpdateProperties. -func (ssup StatefulServiceUpdateProperties) AsServiceResourceUpdateProperties() (*ServiceResourceUpdateProperties, bool) { - return nil, false -} - -// AsBasicServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatefulServiceUpdateProperties. -func (ssup StatefulServiceUpdateProperties) AsBasicServiceResourceUpdateProperties() (BasicServiceResourceUpdateProperties, bool) { - return &ssup, true -} - -// UnmarshalJSON is the custom unmarshaler for StatefulServiceUpdateProperties struct. -func (ssup *StatefulServiceUpdateProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "targetReplicaSetSize": - if v != nil { - var targetReplicaSetSize int32 - err = json.Unmarshal(*v, &targetReplicaSetSize) - if err != nil { - return err - } - ssup.TargetReplicaSetSize = &targetReplicaSetSize - } - case "minReplicaSetSize": - if v != nil { - var minReplicaSetSize int32 - err = json.Unmarshal(*v, &minReplicaSetSize) - if err != nil { - return err - } - ssup.MinReplicaSetSize = &minReplicaSetSize - } - case "replicaRestartWaitDuration": - if v != nil { - var replicaRestartWaitDuration date.Time - err = json.Unmarshal(*v, &replicaRestartWaitDuration) - if err != nil { - return err - } - ssup.ReplicaRestartWaitDuration = &replicaRestartWaitDuration - } - case "quorumLossWaitDuration": - if v != nil { - var quorumLossWaitDuration date.Time - err = json.Unmarshal(*v, &quorumLossWaitDuration) - if err != nil { - return err - } - ssup.QuorumLossWaitDuration = &quorumLossWaitDuration - } - case "standByReplicaKeepDuration": - if v != nil { - var standByReplicaKeepDuration date.Time - err = json.Unmarshal(*v, &standByReplicaKeepDuration) - if err != nil { - return err - } - ssup.StandByReplicaKeepDuration = &standByReplicaKeepDuration - } - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceUpdateProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - ssup.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - ssup.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - ssup.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - ssup.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - ssup.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - ssup.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// StatelessServiceProperties the properties of a stateless service resource. -type StatelessServiceProperties struct { - // InstanceCount - The instance count. - InstanceCount *int32 `json:"instanceCount,omitempty"` - // InstanceCloseDelayDuration - Delay duration for RequestDrain feature to ensures that the endpoint advertised by the stateless instance is removed before the delay starts prior to closing the instance. This delay enables existing requests to drain gracefully before the instance actually goes down (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - InstanceCloseDelayDuration *string `json:"instanceCloseDelayDuration,omitempty"` - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response - ProvisioningState *string `json:"provisioningState,omitempty"` - // ServiceTypeName - The name of the service type - ServiceTypeName *string `json:"serviceTypeName,omitempty"` - PartitionDescription BasicPartitionSchemeDescription `json:"partitionDescription,omitempty"` - // ServicePackageActivationMode - The activation Mode of the service package. Possible values include: 'ArmServicePackageActivationModeSharedProcess', 'ArmServicePackageActivationModeExclusiveProcess' - ServicePackageActivationMode ArmServicePackageActivationMode `json:"servicePackageActivationMode,omitempty"` - // ServiceDNSName - Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - ServiceDNSName *string `json:"serviceDnsName,omitempty"` - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -// MarshalJSON is the custom marshaler for StatelessServiceProperties. -func (ssp StatelessServiceProperties) MarshalJSON() ([]byte, error) { - ssp.ServiceKind = ServiceKindBasicServiceResourcePropertiesServiceKindStateless - objectMap := make(map[string]interface{}) - if ssp.InstanceCount != nil { - objectMap["instanceCount"] = ssp.InstanceCount - } - if ssp.InstanceCloseDelayDuration != nil { - objectMap["instanceCloseDelayDuration"] = ssp.InstanceCloseDelayDuration - } - if ssp.ServiceTypeName != nil { - objectMap["serviceTypeName"] = ssp.ServiceTypeName - } - objectMap["partitionDescription"] = ssp.PartitionDescription - if ssp.ServicePackageActivationMode != "" { - objectMap["servicePackageActivationMode"] = ssp.ServicePackageActivationMode - } - if ssp.ServiceDNSName != nil { - objectMap["serviceDnsName"] = ssp.ServiceDNSName - } - if ssp.ServiceKind != "" { - objectMap["serviceKind"] = ssp.ServiceKind - } - if ssp.PlacementConstraints != nil { - objectMap["placementConstraints"] = ssp.PlacementConstraints - } - if ssp.CorrelationScheme != nil { - objectMap["correlationScheme"] = ssp.CorrelationScheme - } - if ssp.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = ssp.ServiceLoadMetrics - } - if ssp.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = ssp.ServicePlacementPolicies - } - if ssp.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = ssp.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceProperties is the BasicServiceResourceProperties implementation for StatelessServiceProperties. -func (ssp StatelessServiceProperties) AsStatefulServiceProperties() (*StatefulServiceProperties, bool) { - return nil, false -} - -// AsStatelessServiceProperties is the BasicServiceResourceProperties implementation for StatelessServiceProperties. -func (ssp StatelessServiceProperties) AsStatelessServiceProperties() (*StatelessServiceProperties, bool) { - return &ssp, true -} - -// AsServiceResourceProperties is the BasicServiceResourceProperties implementation for StatelessServiceProperties. -func (ssp StatelessServiceProperties) AsServiceResourceProperties() (*ServiceResourceProperties, bool) { - return nil, false -} - -// AsBasicServiceResourceProperties is the BasicServiceResourceProperties implementation for StatelessServiceProperties. -func (ssp StatelessServiceProperties) AsBasicServiceResourceProperties() (BasicServiceResourceProperties, bool) { - return &ssp, true -} - -// UnmarshalJSON is the custom unmarshaler for StatelessServiceProperties struct. -func (ssp *StatelessServiceProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "instanceCount": - if v != nil { - var instanceCount int32 - err = json.Unmarshal(*v, &instanceCount) - if err != nil { - return err - } - ssp.InstanceCount = &instanceCount - } - case "instanceCloseDelayDuration": - if v != nil { - var instanceCloseDelayDuration string - err = json.Unmarshal(*v, &instanceCloseDelayDuration) - if err != nil { - return err - } - ssp.InstanceCloseDelayDuration = &instanceCloseDelayDuration - } - case "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - ssp.ProvisioningState = &provisioningState - } - case "serviceTypeName": - if v != nil { - var serviceTypeName string - err = json.Unmarshal(*v, &serviceTypeName) - if err != nil { - return err - } - ssp.ServiceTypeName = &serviceTypeName - } - case "partitionDescription": - if v != nil { - partitionDescription, err := unmarshalBasicPartitionSchemeDescription(*v) - if err != nil { - return err - } - ssp.PartitionDescription = partitionDescription - } - case "servicePackageActivationMode": - if v != nil { - var servicePackageActivationMode ArmServicePackageActivationMode - err = json.Unmarshal(*v, &servicePackageActivationMode) - if err != nil { - return err - } - ssp.ServicePackageActivationMode = servicePackageActivationMode - } - case "serviceDnsName": - if v != nil { - var serviceDNSName string - err = json.Unmarshal(*v, &serviceDNSName) - if err != nil { - return err - } - ssp.ServiceDNSName = &serviceDNSName - } - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - ssp.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - ssp.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - ssp.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - ssp.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - ssp.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - ssp.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// StatelessServiceUpdateProperties the properties of a stateless service resource for patch operations. -type StatelessServiceUpdateProperties struct { - // InstanceCount - The instance count. - InstanceCount *int32 `json:"instanceCount,omitempty"` - // InstanceCloseDelayDuration - Delay duration for RequestDrain feature to ensures that the endpoint advertised by the stateless instance is removed before the delay starts prior to closing the instance. This delay enables existing requests to drain gracefully before the instance actually goes down (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - InstanceCloseDelayDuration *string `json:"instanceCloseDelayDuration,omitempty"` - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceUpdateProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -// MarshalJSON is the custom marshaler for StatelessServiceUpdateProperties. -func (ssup StatelessServiceUpdateProperties) MarshalJSON() ([]byte, error) { - ssup.ServiceKind = ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless - objectMap := make(map[string]interface{}) - if ssup.InstanceCount != nil { - objectMap["instanceCount"] = ssup.InstanceCount - } - if ssup.InstanceCloseDelayDuration != nil { - objectMap["instanceCloseDelayDuration"] = ssup.InstanceCloseDelayDuration - } - if ssup.ServiceKind != "" { - objectMap["serviceKind"] = ssup.ServiceKind - } - if ssup.PlacementConstraints != nil { - objectMap["placementConstraints"] = ssup.PlacementConstraints - } - if ssup.CorrelationScheme != nil { - objectMap["correlationScheme"] = ssup.CorrelationScheme - } - if ssup.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = ssup.ServiceLoadMetrics - } - if ssup.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = ssup.ServicePlacementPolicies - } - if ssup.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = ssup.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatelessServiceUpdateProperties. -func (ssup StatelessServiceUpdateProperties) AsStatefulServiceUpdateProperties() (*StatefulServiceUpdateProperties, bool) { - return nil, false -} - -// AsStatelessServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatelessServiceUpdateProperties. -func (ssup StatelessServiceUpdateProperties) AsStatelessServiceUpdateProperties() (*StatelessServiceUpdateProperties, bool) { - return &ssup, true -} - -// AsServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatelessServiceUpdateProperties. -func (ssup StatelessServiceUpdateProperties) AsServiceResourceUpdateProperties() (*ServiceResourceUpdateProperties, bool) { - return nil, false -} - -// AsBasicServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatelessServiceUpdateProperties. -func (ssup StatelessServiceUpdateProperties) AsBasicServiceResourceUpdateProperties() (BasicServiceResourceUpdateProperties, bool) { - return &ssup, true -} - -// UnmarshalJSON is the custom unmarshaler for StatelessServiceUpdateProperties struct. -func (ssup *StatelessServiceUpdateProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "instanceCount": - if v != nil { - var instanceCount int32 - err = json.Unmarshal(*v, &instanceCount) - if err != nil { - return err - } - ssup.InstanceCount = &instanceCount - } - case "instanceCloseDelayDuration": - if v != nil { - var instanceCloseDelayDuration string - err = json.Unmarshal(*v, &instanceCloseDelayDuration) - if err != nil { - return err - } - ssup.InstanceCloseDelayDuration = &instanceCloseDelayDuration - } - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceUpdateProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - ssup.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - ssup.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - ssup.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - ssup.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - ssup.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - ssup.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. - CreatedByType *string `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. - LastModifiedByType *string `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC). - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// UniformInt64RangePartitionSchemeDescription describes a partitioning scheme where an integer range is -// allocated evenly across a number of partitions. -type UniformInt64RangePartitionSchemeDescription struct { - // Count - The number of partitions. - Count *int32 `json:"count,omitempty"` - // LowKey - String indicating the lower bound of the partition key range that - // should be split between the partition ‘count’ - LowKey *string `json:"lowKey,omitempty"` - // HighKey - String indicating the upper bound of the partition key range that - // should be split between the partition ‘count’ - HighKey *string `json:"highKey,omitempty"` - // PartitionScheme - Possible values include: 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range' - PartitionScheme PartitionSchemeBasicPartitionSchemeDescription `json:"partitionScheme,omitempty"` -} - -// MarshalJSON is the custom marshaler for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) MarshalJSON() ([]byte, error) { - ui6rpsd.PartitionScheme = PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range - objectMap := make(map[string]interface{}) - if ui6rpsd.Count != nil { - objectMap["count"] = ui6rpsd.Count - } - if ui6rpsd.LowKey != nil { - objectMap["lowKey"] = ui6rpsd.LowKey - } - if ui6rpsd.HighKey != nil { - objectMap["highKey"] = ui6rpsd.HighKey - } - if ui6rpsd.PartitionScheme != "" { - objectMap["partitionScheme"] = ui6rpsd.PartitionScheme - } - return json.Marshal(objectMap) -} - -// AsNamedPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) AsNamedPartitionSchemeDescription() (*NamedPartitionSchemeDescription, bool) { - return nil, false -} - -// AsSingletonPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) AsSingletonPartitionSchemeDescription() (*SingletonPartitionSchemeDescription, bool) { - return nil, false -} - -// AsUniformInt64RangePartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) AsUniformInt64RangePartitionSchemeDescription() (*UniformInt64RangePartitionSchemeDescription, bool) { - return &ui6rpsd, true -} - -// AsPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) AsPartitionSchemeDescription() (*PartitionSchemeDescription, bool) { - return nil, false -} - -// AsBasicPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) AsBasicPartitionSchemeDescription() (BasicPartitionSchemeDescription, bool) { - return &ui6rpsd, true -} - -// UpgradableVersionPathResult the list of intermediate cluster code versions for an upgrade or downgrade. -// Or minimum and maximum upgradable version if no target was given -type UpgradableVersionPathResult struct { - autorest.Response `json:"-"` - SupportedPath *[]string `json:"supportedPath,omitempty"` -} - -// UpgradableVersionsDescription ... -type UpgradableVersionsDescription struct { - // TargetVersion - The target code version. - TargetVersion *string `json:"targetVersion,omitempty"` -} - -// UserAssignedIdentity ... -type UserAssignedIdentity struct { - // PrincipalID - READ-ONLY; The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserAssignedIdentity. -func (uai UserAssignedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/operations.go deleted file mode 100644 index a87fedac4662..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/operations.go +++ /dev/null @@ -1,141 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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 service Fabric Management Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get the list of available Service Fabric resource provider API operations. -// Parameters: -// APIVersion - the version of the Service Fabric resource provider API -func (client OperationsClient) List(ctx context.Context, APIVersion string) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, APIVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context, APIVersion string) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ServiceFabric/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - 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 OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabric.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, "servicefabric.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.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, APIVersion string) (result OperationListResultIterator, 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, APIVersion) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/services.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/services.go deleted file mode 100644 index 6293c4b06fd7..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/services.go +++ /dev/null @@ -1,445 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// ServicesClient is the service Fabric Management Client -type ServicesClient struct { - BaseClient -} - -// NewServicesClient creates an instance of the ServicesClient client. -func NewServicesClient(subscriptionID string) ServicesClient { - return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServicesClientWithBaseURI creates an instance of the ServicesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { - return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Service Fabric service resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// serviceName - the name of the service resource in the format of {applicationName}~{serviceName}. -// parameters - the service resource. -func (client ServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string, parameters ServiceResource) (result ServicesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, applicationName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string, parameters ServiceResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - 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.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (future ServicesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Service Fabric service resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// serviceName - the name of the service resource in the format of {applicationName}~{serviceName}. -func (client ServicesClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string) (result ServicesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, applicationName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) DeleteSender(req *http.Request) (future ServicesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Service Fabric service resource created or in the process of being created in the Service Fabric -// application resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// serviceName - the name of the service resource in the format of {applicationName}~{serviceName}. -func (client ServicesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, applicationName 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, clusterName, applicationName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.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, "servicefabric.ServicesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServicesClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all service resources created or in the process of being created in the Service Fabric application -// resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -func (client ServicesClient) List(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (result ServiceResourceList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServicesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServicesClient) ListResponder(resp *http.Response) (result ServiceResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update a Service Fabric service resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// serviceName - the name of the service resource in the format of {applicationName}~{serviceName}. -// parameters - the service resource for patch operations. -func (client ServicesClient) Update(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string, parameters ServiceResourceUpdate) (result ServicesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, applicationName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServicesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string, parameters ServiceResourceUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - 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.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) UpdateSender(req *http.Request) (future ServicesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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/servicefabric/mgmt/2021-06-01/servicefabric/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/version.go deleted file mode 100644 index abc4358c603f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package servicefabric - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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() + " servicefabric/2021-06-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/README.md new file mode 100644 index 000000000000..f58ab0ab2905 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/README.md @@ -0,0 +1,118 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster` Documentation + +The `cluster` SDK allows for interaction with the Azure Resource Manager Service `servicefabric` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster" +``` + + +### Client Initialization + +```go +client := cluster.NewClusterClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ClusterClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := cluster.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := cluster.Cluster{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClusterClient.Delete` + +```go +ctx := context.TODO() +id := cluster.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClusterClient.Get` + +```go +ctx := context.TODO() +id := cluster.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClusterClient.List` + +```go +ctx := context.TODO() +id := cluster.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClusterClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := cluster.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClusterClient.Update` + +```go +ctx := context.TODO() +id := cluster.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := cluster.ClusterUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/client.go new file mode 100644 index 000000000000..d3c96cfed0b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/client.go @@ -0,0 +1,18 @@ +package cluster + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterClient struct { + Client autorest.Client + baseUri string +} + +func NewClusterClientWithBaseURI(endpoint string) ClusterClient { + return ClusterClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/constants.go new file mode 100644 index 000000000000..235df43148d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/constants.go @@ -0,0 +1,464 @@ +package cluster + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddOnFeatures string + +const ( + AddOnFeaturesBackupRestoreService AddOnFeatures = "BackupRestoreService" + AddOnFeaturesDnsService AddOnFeatures = "DnsService" + AddOnFeaturesRepairManager AddOnFeatures = "RepairManager" + AddOnFeaturesResourceMonitorService AddOnFeatures = "ResourceMonitorService" +) + +func PossibleValuesForAddOnFeatures() []string { + return []string{ + string(AddOnFeaturesBackupRestoreService), + string(AddOnFeaturesDnsService), + string(AddOnFeaturesRepairManager), + string(AddOnFeaturesResourceMonitorService), + } +} + +func parseAddOnFeatures(input string) (*AddOnFeatures, error) { + vals := map[string]AddOnFeatures{ + "backuprestoreservice": AddOnFeaturesBackupRestoreService, + "dnsservice": AddOnFeaturesDnsService, + "repairmanager": AddOnFeaturesRepairManager, + "resourcemonitorservice": AddOnFeaturesResourceMonitorService, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AddOnFeatures(input) + return &out, nil +} + +type ClusterState string + +const ( + ClusterStateAutoScale ClusterState = "AutoScale" + ClusterStateBaselineUpgrade ClusterState = "BaselineUpgrade" + ClusterStateDeploying ClusterState = "Deploying" + ClusterStateEnforcingClusterVersion ClusterState = "EnforcingClusterVersion" + ClusterStateReady ClusterState = "Ready" + ClusterStateUpdatingInfrastructure ClusterState = "UpdatingInfrastructure" + ClusterStateUpdatingUserCertificate ClusterState = "UpdatingUserCertificate" + ClusterStateUpdatingUserConfiguration ClusterState = "UpdatingUserConfiguration" + ClusterStateUpgradeServiceUnreachable ClusterState = "UpgradeServiceUnreachable" + ClusterStateWaitingForNodes ClusterState = "WaitingForNodes" +) + +func PossibleValuesForClusterState() []string { + return []string{ + string(ClusterStateAutoScale), + string(ClusterStateBaselineUpgrade), + string(ClusterStateDeploying), + string(ClusterStateEnforcingClusterVersion), + string(ClusterStateReady), + string(ClusterStateUpdatingInfrastructure), + string(ClusterStateUpdatingUserCertificate), + string(ClusterStateUpdatingUserConfiguration), + string(ClusterStateUpgradeServiceUnreachable), + string(ClusterStateWaitingForNodes), + } +} + +func parseClusterState(input string) (*ClusterState, error) { + vals := map[string]ClusterState{ + "autoscale": ClusterStateAutoScale, + "baselineupgrade": ClusterStateBaselineUpgrade, + "deploying": ClusterStateDeploying, + "enforcingclusterversion": ClusterStateEnforcingClusterVersion, + "ready": ClusterStateReady, + "updatinginfrastructure": ClusterStateUpdatingInfrastructure, + "updatingusercertificate": ClusterStateUpdatingUserCertificate, + "updatinguserconfiguration": ClusterStateUpdatingUserConfiguration, + "upgradeserviceunreachable": ClusterStateUpgradeServiceUnreachable, + "waitingfornodes": ClusterStateWaitingForNodes, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterState(input) + return &out, nil +} + +type ClusterUpgradeCadence string + +const ( + ClusterUpgradeCadenceWaveOne ClusterUpgradeCadence = "Wave1" + ClusterUpgradeCadenceWaveTwo ClusterUpgradeCadence = "Wave2" + ClusterUpgradeCadenceWaveZero ClusterUpgradeCadence = "Wave0" +) + +func PossibleValuesForClusterUpgradeCadence() []string { + return []string{ + string(ClusterUpgradeCadenceWaveOne), + string(ClusterUpgradeCadenceWaveTwo), + string(ClusterUpgradeCadenceWaveZero), + } +} + +func parseClusterUpgradeCadence(input string) (*ClusterUpgradeCadence, error) { + vals := map[string]ClusterUpgradeCadence{ + "wave1": ClusterUpgradeCadenceWaveOne, + "wave2": ClusterUpgradeCadenceWaveTwo, + "wave0": ClusterUpgradeCadenceWaveZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterUpgradeCadence(input) + return &out, nil +} + +type DurabilityLevel string + +const ( + DurabilityLevelBronze DurabilityLevel = "Bronze" + DurabilityLevelGold DurabilityLevel = "Gold" + DurabilityLevelSilver DurabilityLevel = "Silver" +) + +func PossibleValuesForDurabilityLevel() []string { + return []string{ + string(DurabilityLevelBronze), + string(DurabilityLevelGold), + string(DurabilityLevelSilver), + } +} + +func parseDurabilityLevel(input string) (*DurabilityLevel, error) { + vals := map[string]DurabilityLevel{ + "bronze": DurabilityLevelBronze, + "gold": DurabilityLevelGold, + "silver": DurabilityLevelSilver, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DurabilityLevel(input) + return &out, nil +} + +type Environment string + +const ( + EnvironmentLinux Environment = "Linux" + EnvironmentWindows Environment = "Windows" +) + +func PossibleValuesForEnvironment() []string { + return []string{ + string(EnvironmentLinux), + string(EnvironmentWindows), + } +} + +func parseEnvironment(input string) (*Environment, error) { + vals := map[string]Environment{ + "linux": EnvironmentLinux, + "windows": EnvironmentWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Environment(input) + return &out, nil +} + +type NotificationCategory string + +const ( + NotificationCategoryWaveProgress NotificationCategory = "WaveProgress" +) + +func PossibleValuesForNotificationCategory() []string { + return []string{ + string(NotificationCategoryWaveProgress), + } +} + +func parseNotificationCategory(input string) (*NotificationCategory, error) { + vals := map[string]NotificationCategory{ + "waveprogress": NotificationCategoryWaveProgress, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotificationCategory(input) + return &out, nil +} + +type NotificationChannel string + +const ( + NotificationChannelEmailSubscription NotificationChannel = "EmailSubscription" + NotificationChannelEmailUser NotificationChannel = "EmailUser" +) + +func PossibleValuesForNotificationChannel() []string { + return []string{ + string(NotificationChannelEmailSubscription), + string(NotificationChannelEmailUser), + } +} + +func parseNotificationChannel(input string) (*NotificationChannel, error) { + vals := map[string]NotificationChannel{ + "emailsubscription": NotificationChannelEmailSubscription, + "emailuser": NotificationChannelEmailUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotificationChannel(input) + return &out, nil +} + +type NotificationLevel string + +const ( + NotificationLevelAll NotificationLevel = "All" + NotificationLevelCritical NotificationLevel = "Critical" +) + +func PossibleValuesForNotificationLevel() []string { + return []string{ + string(NotificationLevelAll), + string(NotificationLevelCritical), + } +} + +func parseNotificationLevel(input string) (*NotificationLevel, error) { + vals := map[string]NotificationLevel{ + "all": NotificationLevelAll, + "critical": NotificationLevelCritical, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotificationLevel(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type ReliabilityLevel string + +const ( + ReliabilityLevelBronze ReliabilityLevel = "Bronze" + ReliabilityLevelGold ReliabilityLevel = "Gold" + ReliabilityLevelNone ReliabilityLevel = "None" + ReliabilityLevelPlatinum ReliabilityLevel = "Platinum" + ReliabilityLevelSilver ReliabilityLevel = "Silver" +) + +func PossibleValuesForReliabilityLevel() []string { + return []string{ + string(ReliabilityLevelBronze), + string(ReliabilityLevelGold), + string(ReliabilityLevelNone), + string(ReliabilityLevelPlatinum), + string(ReliabilityLevelSilver), + } +} + +func parseReliabilityLevel(input string) (*ReliabilityLevel, error) { + vals := map[string]ReliabilityLevel{ + "bronze": ReliabilityLevelBronze, + "gold": ReliabilityLevelGold, + "none": ReliabilityLevelNone, + "platinum": ReliabilityLevelPlatinum, + "silver": ReliabilityLevelSilver, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ReliabilityLevel(input) + return &out, nil +} + +type SfZonalUpgradeMode string + +const ( + SfZonalUpgradeModeHierarchical SfZonalUpgradeMode = "Hierarchical" + SfZonalUpgradeModeParallel SfZonalUpgradeMode = "Parallel" +) + +func PossibleValuesForSfZonalUpgradeMode() []string { + return []string{ + string(SfZonalUpgradeModeHierarchical), + string(SfZonalUpgradeModeParallel), + } +} + +func parseSfZonalUpgradeMode(input string) (*SfZonalUpgradeMode, error) { + vals := map[string]SfZonalUpgradeMode{ + "hierarchical": SfZonalUpgradeModeHierarchical, + "parallel": SfZonalUpgradeModeParallel, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SfZonalUpgradeMode(input) + return &out, nil +} + +type UpgradeMode string + +const ( + UpgradeModeAutomatic UpgradeMode = "Automatic" + UpgradeModeManual UpgradeMode = "Manual" +) + +func PossibleValuesForUpgradeMode() []string { + return []string{ + string(UpgradeModeAutomatic), + string(UpgradeModeManual), + } +} + +func parseUpgradeMode(input string) (*UpgradeMode, error) { + vals := map[string]UpgradeMode{ + "automatic": UpgradeModeAutomatic, + "manual": UpgradeModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpgradeMode(input) + return &out, nil +} + +type VMSSZonalUpgradeMode string + +const ( + VMSSZonalUpgradeModeHierarchical VMSSZonalUpgradeMode = "Hierarchical" + VMSSZonalUpgradeModeParallel VMSSZonalUpgradeMode = "Parallel" +) + +func PossibleValuesForVMSSZonalUpgradeMode() []string { + return []string{ + string(VMSSZonalUpgradeModeHierarchical), + string(VMSSZonalUpgradeModeParallel), + } +} + +func parseVMSSZonalUpgradeMode(input string) (*VMSSZonalUpgradeMode, error) { + vals := map[string]VMSSZonalUpgradeMode{ + "hierarchical": VMSSZonalUpgradeModeHierarchical, + "parallel": VMSSZonalUpgradeModeParallel, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMSSZonalUpgradeMode(input) + return &out, nil +} + +type X509StoreName string + +const ( + X509StoreNameAddressBook X509StoreName = "AddressBook" + X509StoreNameAuthRoot X509StoreName = "AuthRoot" + X509StoreNameCertificateAuthority X509StoreName = "CertificateAuthority" + X509StoreNameDisallowed X509StoreName = "Disallowed" + X509StoreNameMy X509StoreName = "My" + X509StoreNameRoot X509StoreName = "Root" + X509StoreNameTrustedPeople X509StoreName = "TrustedPeople" + X509StoreNameTrustedPublisher X509StoreName = "TrustedPublisher" +) + +func PossibleValuesForX509StoreName() []string { + return []string{ + string(X509StoreNameAddressBook), + string(X509StoreNameAuthRoot), + string(X509StoreNameCertificateAuthority), + string(X509StoreNameDisallowed), + string(X509StoreNameMy), + string(X509StoreNameRoot), + string(X509StoreNameTrustedPeople), + string(X509StoreNameTrustedPublisher), + } +} + +func parseX509StoreName(input string) (*X509StoreName, error) { + vals := map[string]X509StoreName{ + "addressbook": X509StoreNameAddressBook, + "authroot": X509StoreNameAuthRoot, + "certificateauthority": X509StoreNameCertificateAuthority, + "disallowed": X509StoreNameDisallowed, + "my": X509StoreNameMy, + "root": X509StoreNameRoot, + "trustedpeople": X509StoreNameTrustedPeople, + "trustedpublisher": X509StoreNameTrustedPublisher, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := X509StoreName(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/id_cluster.go new file mode 100644 index 000000000000..3d3e22b59c29 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/id_cluster.go @@ -0,0 +1,124 @@ +package cluster + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceFabric", "Microsoft.ServiceFabric", "Microsoft.ServiceFabric"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_createorupdate_autorest.go new file mode 100644 index 000000000000..47bcf5006fc9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package cluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ClusterClient) CreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ClusterClient) CreateOrUpdateThenPoll(ctx context.Context, id ClusterId, input Cluster) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ClusterClient) preparerForCreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ClusterClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_delete_autorest.go new file mode 100644 index 000000000000..d8c81fb14838 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_delete_autorest.go @@ -0,0 +1,66 @@ +package cluster + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ClusterClient) Delete(ctx context.Context, id ClusterId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ClusterClient) preparerForDelete(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ClusterClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_get_autorest.go new file mode 100644 index 000000000000..227b3e2bc41a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_get_autorest.go @@ -0,0 +1,68 @@ +package cluster + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Cluster +} + +// Get ... +func (c ClusterClient) Get(ctx context.Context, id ClusterId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ClusterClient) preparerForGet(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ClusterClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_list_autorest.go new file mode 100644 index 000000000000..a7c4e3a66583 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_list_autorest.go @@ -0,0 +1,70 @@ +package cluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ClusterListResult +} + +// List ... +func (c ClusterClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ClusterClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceFabric/clusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ClusterClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..280d21c7d767 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_listbyresourcegroup_autorest.go @@ -0,0 +1,70 @@ +package cluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *ClusterListResult +} + +// ListByResourceGroup ... +func (c ClusterClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ClusterClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceFabric/clusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ClusterClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_update_autorest.go new file mode 100644 index 000000000000..04196d8a97fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_update_autorest.go @@ -0,0 +1,79 @@ +package cluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ClusterClient) Update(ctx context.Context, id ClusterId, input ClusterUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ClusterClient) UpdateThenPoll(ctx context.Context, id ClusterId, input ClusterUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ClusterClient) preparerForUpdate(ctx context.Context, id ClusterId, input ClusterUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ClusterClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationdeltahealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationdeltahealthpolicy.go new file mode 100644 index 000000000000..8fad19da2b7e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationdeltahealthpolicy.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationDeltaHealthPolicy struct { + DefaultServiceTypeDeltaHealthPolicy *ServiceTypeDeltaHealthPolicy `json:"defaultServiceTypeDeltaHealthPolicy,omitempty"` + ServiceTypeDeltaHealthPolicies *map[string]ServiceTypeDeltaHealthPolicy `json:"serviceTypeDeltaHealthPolicies,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationhealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationhealthpolicy.go new file mode 100644 index 000000000000..0fbffd54f7a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationhealthpolicy.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationHealthPolicy struct { + DefaultServiceTypeHealthPolicy *ServiceTypeHealthPolicy `json:"defaultServiceTypeHealthPolicy,omitempty"` + ServiceTypeHealthPolicies *map[string]ServiceTypeHealthPolicy `json:"serviceTypeHealthPolicies,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationtypeversionscleanuppolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationtypeversionscleanuppolicy.go new file mode 100644 index 000000000000..93c8f9e615ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationtypeversionscleanuppolicy.go @@ -0,0 +1,8 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationTypeVersionsCleanupPolicy struct { + MaxUnusedVersionsToKeep int64 `json:"maxUnusedVersionsToKeep"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_azureactivedirectory.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_azureactivedirectory.go new file mode 100644 index 000000000000..3d538dacae17 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_azureactivedirectory.go @@ -0,0 +1,10 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureActiveDirectory struct { + ClientApplication *string `json:"clientApplication,omitempty"` + ClusterApplication *string `json:"clusterApplication,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_certificatedescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_certificatedescription.go new file mode 100644 index 000000000000..d06db35206eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_certificatedescription.go @@ -0,0 +1,10 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateDescription struct { + Thumbprint string `json:"thumbprint"` + ThumbprintSecondary *string `json:"thumbprintSecondary,omitempty"` + X509StoreName *X509StoreName `json:"x509StoreName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatecommonname.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatecommonname.go new file mode 100644 index 000000000000..58d105ad2276 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatecommonname.go @@ -0,0 +1,10 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClientCertificateCommonName struct { + CertificateCommonName string `json:"certificateCommonName"` + CertificateIssuerThumbprint string `json:"certificateIssuerThumbprint"` + IsAdmin bool `json:"isAdmin"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatethumbprint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatethumbprint.go new file mode 100644 index 000000000000..84be23937821 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatethumbprint.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClientCertificateThumbprint struct { + CertificateThumbprint string `json:"certificateThumbprint"` + IsAdmin bool `json:"isAdmin"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_cluster.go new file mode 100644 index 000000000000..1815abb6ff11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_cluster.go @@ -0,0 +1,15 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Cluster struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ClusterProperties `json:"properties,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterhealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterhealthpolicy.go new file mode 100644 index 000000000000..76c77ffbb815 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterhealthpolicy.go @@ -0,0 +1,10 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterHealthPolicy struct { + ApplicationHealthPolicies *map[string]ApplicationHealthPolicy `json:"applicationHealthPolicies,omitempty"` + MaxPercentUnhealthyApplications *int64 `json:"maxPercentUnhealthyApplications,omitempty"` + MaxPercentUnhealthyNodes *int64 `json:"maxPercentUnhealthyNodes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterlistresult.go new file mode 100644 index 000000000000..b205deaee9cc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterlistresult.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterListResult struct { + NextLink *string `json:"nextLink,omitempty"` + Value *[]Cluster `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterproperties.go new file mode 100644 index 000000000000..cb5b303f885d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterproperties.go @@ -0,0 +1,69 @@ +package cluster + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProperties struct { + AddOnFeatures *[]AddOnFeatures `json:"addOnFeatures,omitempty"` + ApplicationTypeVersionsCleanupPolicy *ApplicationTypeVersionsCleanupPolicy `json:"applicationTypeVersionsCleanupPolicy,omitempty"` + AvailableClusterVersions *[]ClusterVersionDetails `json:"availableClusterVersions,omitempty"` + AzureActiveDirectory *AzureActiveDirectory `json:"azureActiveDirectory,omitempty"` + Certificate *CertificateDescription `json:"certificate,omitempty"` + CertificateCommonNames *ServerCertificateCommonNames `json:"certificateCommonNames,omitempty"` + ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` + ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` + ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` + ClusterEndpoint *string `json:"clusterEndpoint,omitempty"` + ClusterId *string `json:"clusterId,omitempty"` + ClusterState *ClusterState `json:"clusterState,omitempty"` + DiagnosticsStorageAccountConfig *DiagnosticsStorageAccountConfig `json:"diagnosticsStorageAccountConfig,omitempty"` + EventStoreServiceEnabled *bool `json:"eventStoreServiceEnabled,omitempty"` + FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` + InfrastructureServiceManager *bool `json:"infrastructureServiceManager,omitempty"` + ManagementEndpoint string `json:"managementEndpoint"` + NodeTypes []NodeTypeDescription `json:"nodeTypes"` + Notifications *[]Notification `json:"notifications,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ReliabilityLevel *ReliabilityLevel `json:"reliabilityLevel,omitempty"` + ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` + ReverseProxyCertificateCommonNames *ServerCertificateCommonNames `json:"reverseProxyCertificateCommonNames,omitempty"` + SfZonalUpgradeMode *SfZonalUpgradeMode `json:"sfZonalUpgradeMode,omitempty"` + UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` + UpgradeMode *UpgradeMode `json:"upgradeMode,omitempty"` + UpgradePauseEndTimestampUtc *string `json:"upgradePauseEndTimestampUtc,omitempty"` + UpgradePauseStartTimestampUtc *string `json:"upgradePauseStartTimestampUtc,omitempty"` + UpgradeWave *ClusterUpgradeCadence `json:"upgradeWave,omitempty"` + VMSSZonalUpgradeMode *VMSSZonalUpgradeMode `json:"vmssZonalUpgradeMode,omitempty"` + VmImage *string `json:"vmImage,omitempty"` + WaveUpgradePaused *bool `json:"waveUpgradePaused,omitempty"` +} + +func (o *ClusterProperties) GetUpgradePauseEndTimestampUtcAsTime() (*time.Time, error) { + if o.UpgradePauseEndTimestampUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpgradePauseEndTimestampUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetUpgradePauseEndTimestampUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpgradePauseEndTimestampUtc = &formatted +} + +func (o *ClusterProperties) GetUpgradePauseStartTimestampUtcAsTime() (*time.Time, error) { + if o.UpgradePauseStartTimestampUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpgradePauseStartTimestampUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetUpgradePauseStartTimestampUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpgradePauseStartTimestampUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterpropertiesupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterpropertiesupdateparameters.go new file mode 100644 index 000000000000..00f45c72dc1c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterpropertiesupdateparameters.go @@ -0,0 +1,59 @@ +package cluster + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterPropertiesUpdateParameters struct { + AddOnFeatures *[]AddOnFeatures `json:"addOnFeatures,omitempty"` + ApplicationTypeVersionsCleanupPolicy *ApplicationTypeVersionsCleanupPolicy `json:"applicationTypeVersionsCleanupPolicy,omitempty"` + Certificate *CertificateDescription `json:"certificate,omitempty"` + CertificateCommonNames *ServerCertificateCommonNames `json:"certificateCommonNames,omitempty"` + ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` + ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` + ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` + EventStoreServiceEnabled *bool `json:"eventStoreServiceEnabled,omitempty"` + FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` + InfrastructureServiceManager *bool `json:"infrastructureServiceManager,omitempty"` + NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"` + Notifications *[]Notification `json:"notifications,omitempty"` + ReliabilityLevel *ReliabilityLevel `json:"reliabilityLevel,omitempty"` + ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` + SfZonalUpgradeMode *SfZonalUpgradeMode `json:"sfZonalUpgradeMode,omitempty"` + UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` + UpgradeMode *UpgradeMode `json:"upgradeMode,omitempty"` + UpgradePauseEndTimestampUtc *string `json:"upgradePauseEndTimestampUtc,omitempty"` + UpgradePauseStartTimestampUtc *string `json:"upgradePauseStartTimestampUtc,omitempty"` + UpgradeWave *ClusterUpgradeCadence `json:"upgradeWave,omitempty"` + VMSSZonalUpgradeMode *VMSSZonalUpgradeMode `json:"vmssZonalUpgradeMode,omitempty"` + WaveUpgradePaused *bool `json:"waveUpgradePaused,omitempty"` +} + +func (o *ClusterPropertiesUpdateParameters) GetUpgradePauseEndTimestampUtcAsTime() (*time.Time, error) { + if o.UpgradePauseEndTimestampUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpgradePauseEndTimestampUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterPropertiesUpdateParameters) SetUpgradePauseEndTimestampUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpgradePauseEndTimestampUtc = &formatted +} + +func (o *ClusterPropertiesUpdateParameters) GetUpgradePauseStartTimestampUtcAsTime() (*time.Time, error) { + if o.UpgradePauseStartTimestampUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpgradePauseStartTimestampUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterPropertiesUpdateParameters) SetUpgradePauseStartTimestampUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpgradePauseStartTimestampUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupdateparameters.go new file mode 100644 index 000000000000..5b03245e7ae9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupdateparameters.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpdateParameters struct { + Properties *ClusterPropertiesUpdateParameters `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradedeltahealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradedeltahealthpolicy.go new file mode 100644 index 000000000000..da9b8496dcf9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradedeltahealthpolicy.go @@ -0,0 +1,11 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpgradeDeltaHealthPolicy struct { + ApplicationDeltaHealthPolicies *map[string]ApplicationDeltaHealthPolicy `json:"applicationDeltaHealthPolicies,omitempty"` + MaxPercentDeltaUnhealthyApplications int64 `json:"maxPercentDeltaUnhealthyApplications"` + MaxPercentDeltaUnhealthyNodes int64 `json:"maxPercentDeltaUnhealthyNodes"` + MaxPercentUpgradeDomainDeltaUnhealthyNodes int64 `json:"maxPercentUpgradeDomainDeltaUnhealthyNodes"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradepolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradepolicy.go new file mode 100644 index 000000000000..e6ab29fc41ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradepolicy.go @@ -0,0 +1,16 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpgradePolicy struct { + DeltaHealthPolicy *ClusterUpgradeDeltaHealthPolicy `json:"deltaHealthPolicy,omitempty"` + ForceRestart *bool `json:"forceRestart,omitempty"` + HealthCheckRetryTimeout string `json:"healthCheckRetryTimeout"` + HealthCheckStableDuration string `json:"healthCheckStableDuration"` + HealthCheckWaitDuration string `json:"healthCheckWaitDuration"` + HealthPolicy ClusterHealthPolicy `json:"healthPolicy"` + UpgradeDomainTimeout string `json:"upgradeDomainTimeout"` + UpgradeReplicaSetCheckTimeout string `json:"upgradeReplicaSetCheckTimeout"` + UpgradeTimeout string `json:"upgradeTimeout"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterversiondetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterversiondetails.go new file mode 100644 index 000000000000..bbb863eb6fc9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterversiondetails.go @@ -0,0 +1,10 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterVersionDetails struct { + CodeVersion *string `json:"codeVersion,omitempty"` + Environment *Environment `json:"environment,omitempty"` + SupportExpiryUtc *string `json:"supportExpiryUtc,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_diagnosticsstorageaccountconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_diagnosticsstorageaccountconfig.go new file mode 100644 index 000000000000..995b5612d80a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_diagnosticsstorageaccountconfig.go @@ -0,0 +1,13 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsStorageAccountConfig struct { + BlobEndpoint string `json:"blobEndpoint"` + ProtectedAccountKeyName string `json:"protectedAccountKeyName"` + ProtectedAccountKeyName2 *string `json:"protectedAccountKeyName2,omitempty"` + QueueEndpoint string `json:"queueEndpoint"` + StorageAccountName string `json:"storageAccountName"` + TableEndpoint string `json:"tableEndpoint"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_endpointrangedescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_endpointrangedescription.go new file mode 100644 index 000000000000..67c517e9c8fe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_endpointrangedescription.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointRangeDescription struct { + EndPort int64 `json:"endPort"` + StartPort int64 `json:"startPort"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_nodetypedescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_nodetypedescription.go new file mode 100644 index 000000000000..d0da4988e795 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_nodetypedescription.go @@ -0,0 +1,20 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodeTypeDescription struct { + ApplicationPorts *EndpointRangeDescription `json:"applicationPorts,omitempty"` + Capacities *map[string]string `json:"capacities,omitempty"` + ClientConnectionEndpointPort int64 `json:"clientConnectionEndpointPort"` + DurabilityLevel *DurabilityLevel `json:"durabilityLevel,omitempty"` + EphemeralPorts *EndpointRangeDescription `json:"ephemeralPorts,omitempty"` + HTTPGatewayEndpointPort int64 `json:"httpGatewayEndpointPort"` + IsPrimary bool `json:"isPrimary"` + IsStateless *bool `json:"isStateless,omitempty"` + MultipleAvailabilityZones *bool `json:"multipleAvailabilityZones,omitempty"` + Name string `json:"name"` + PlacementProperties *map[string]string `json:"placementProperties,omitempty"` + ReverseProxyEndpointPort *int64 `json:"reverseProxyEndpointPort,omitempty"` + VMInstanceCount int64 `json:"vmInstanceCount"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notification.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notification.go new file mode 100644 index 000000000000..6a82ec3e3540 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notification.go @@ -0,0 +1,11 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Notification struct { + IsEnabled bool `json:"isEnabled"` + NotificationCategory NotificationCategory `json:"notificationCategory"` + NotificationLevel NotificationLevel `json:"notificationLevel"` + NotificationTargets []NotificationTarget `json:"notificationTargets"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notificationtarget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notificationtarget.go new file mode 100644 index 000000000000..1fd1edb852fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notificationtarget.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationTarget struct { + NotificationChannel NotificationChannel `json:"notificationChannel"` + Receivers []string `json:"receivers"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonname.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonname.go new file mode 100644 index 000000000000..09c968ba1904 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonname.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerCertificateCommonName struct { + CertificateCommonName string `json:"certificateCommonName"` + CertificateIssuerThumbprint string `json:"certificateIssuerThumbprint"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonnames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonnames.go new file mode 100644 index 000000000000..2ca94786d4d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonnames.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerCertificateCommonNames struct { + CommonNames *[]ServerCertificateCommonName `json:"commonNames,omitempty"` + X509StoreName *X509StoreName `json:"x509StoreName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypedeltahealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypedeltahealthpolicy.go new file mode 100644 index 000000000000..9581ae6ced73 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypedeltahealthpolicy.go @@ -0,0 +1,8 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceTypeDeltaHealthPolicy struct { + MaxPercentDeltaUnhealthyServices *int64 `json:"maxPercentDeltaUnhealthyServices,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypehealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypehealthpolicy.go new file mode 100644 index 000000000000..cdea29d7900c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypehealthpolicy.go @@ -0,0 +1,8 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceTypeHealthPolicy struct { + MaxPercentUnhealthyServices *int64 `json:"maxPercentUnhealthyServices,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingsparameterdescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingsparameterdescription.go new file mode 100644 index 000000000000..32448081d478 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingsparameterdescription.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SettingsParameterDescription struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingssectiondescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingssectiondescription.go new file mode 100644 index 000000000000..6ef9a478c34c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingssectiondescription.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SettingsSectionDescription struct { + Name string `json:"name"` + Parameters []SettingsParameterDescription `json:"parameters"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_systemdata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_systemdata.go new file mode 100644 index 000000000000..6fdfc6628a58 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_systemdata.go @@ -0,0 +1,43 @@ +package cluster + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemData struct { + CreatedAt *string `json:"createdAt,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByType *string `json:"createdByType,omitempty"` + LastModifiedAt *string `json:"lastModifiedAt,omitempty"` + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedByType *string `json:"lastModifiedByType,omitempty"` +} + +func (o *SystemData) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SystemData) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *SystemData) GetLastModifiedAtAsTime() (*time.Time, error) { + if o.LastModifiedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SystemData) SetLastModifiedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedAt = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/version.go new file mode 100644 index 000000000000..06f520be6868 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/version.go @@ -0,0 +1,12 @@ +package cluster + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/cluster/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index eb7e44f15ecf..667b4878805e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -62,7 +62,6 @@ github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedappl github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-05-01/managementgroups github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-06-01/resources github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-01-01/subscriptions -github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2021-09-01/storagecache github.com/Azure/azure-sdk-for-go/services/storagesync/mgmt/2020-03-01/storagesync @@ -440,6 +439,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2022-01-01-preview/namespaces +github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links