diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index 359bc13494d0..53e81dcdab7a 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -356,3 +356,6 @@ service/virtual-desktops: service/vmware: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_vmware_((.|\n)*)###' + +service/workloads: + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_workloads_sap_three_tier_virtual_instance((.|\n)*)###' diff --git a/.github/labeler-pull-request-triage.yml b/.github/labeler-pull-request-triage.yml index 99338ec8b910..1f21c88b7000 100644 --- a/.github/labeler-pull-request-triage.yml +++ b/.github/labeler-pull-request-triage.yml @@ -599,3 +599,8 @@ service/vmware: - changed-files: - any-glob-to-any-file: - internal/services/vmware/**/* + +service/workloads: +- changed-files: + - any-glob-to-any-file: + - internal/services/workloads/**/* diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index d72e546499d2..78c055e88b34 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -132,5 +132,6 @@ var services = mapOf( "vmware" to "VMware", "videoanalyzer" to "Video Analyzer", "voiceservices" to "Voice Services", - "web" to "Web" + "web" to "Web", + "workloads" to "Workloads" ) \ No newline at end of file diff --git a/.teamcity/components/settings.kt b/.teamcity/components/settings.kt index 68e179f7a37e..fbdc46b192be 100644 --- a/.teamcity/components/settings.kt +++ b/.teamcity/components/settings.kt @@ -192,5 +192,8 @@ var serviceTestConfigurationOverrides = mapOf( "voiceservices" to testConfiguration(parallelism = 3, locationOverride = LocationConfiguration("westcentralus", "westcentralus", "westcentralus", false)), // Offset start hour to avoid collision with new App Service, reduce frequency of testing days - "web" to testConfiguration(startHour = 3, daysOfWeek = "1,3,5", locationOverride = LocationConfiguration("westeurope", "francecentral", "eastus2", true)) + "web" to testConfiguration(startHour = 3, daysOfWeek = "1,3,5", locationOverride = LocationConfiguration("westeurope", "francecentral", "eastus2", true)), + + // Workloads has quota available in certain locations + "workloads" to testConfiguration(parallelism = 1, locationOverride = LocationConfiguration("eastus", "westeurope", "francecentral", false)) ) diff --git a/internal/acceptance/testcase.go b/internal/acceptance/testcase.go index 2425d7ea3cc1..95bd330acde0 100644 --- a/internal/acceptance/testcase.go +++ b/internal/acceptance/testcase.go @@ -143,5 +143,9 @@ func (td TestData) externalProviders() map[string]resource.ExternalProvider { VersionConstraint: "=0.9.1", Source: "registry.terraform.io/hashicorp/time", }, + "tls": { + VersionConstraint: "=4.0.4", + Source: "registry.terraform.io/hashicorp/tls", + }, } } diff --git a/internal/clients/client.go b/internal/clients/client.go index b39da80f7bcd..31409083e093 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -23,6 +23,7 @@ import ( storagecache_2023_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/storagecache/2023-05-01" systemcentervirtualmachinemanager_2023_10_07 "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07" timeseriesinsights_v2020_05_15 "github.com/hashicorp/go-azure-sdk/resource-manager/timeseriesinsights/2020-05-15" + workloads_v2023_04_01 "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/hashicorp/terraform-provider-azurerm/internal/features" aadb2c "github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/client" @@ -149,6 +150,7 @@ import ( vmware "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/client" voiceServices "github.com/hashicorp/terraform-provider-azurerm/internal/services/voiceservices/client" web "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/client" + workloads "github.com/hashicorp/terraform-provider-azurerm/internal/services/workloads/client" ) type Client struct { @@ -284,6 +286,7 @@ type Client struct { Vmware *vmware.Client VoiceServices *voiceServices.Client Web *web.Client + Workloads *workloads_v2023_04_01.Client } // NOTE: it should be possible for this method to become Private once the top level Client's removed @@ -656,5 +659,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error } client.Web = web.NewClient(o) + if client.Workloads, err = workloads.NewClient(o); err != nil { + return fmt.Errorf("building clients for Workloads: %+v", err) + } + return nil } diff --git a/internal/provider/services.go b/internal/provider/services.go index cb9e4b20e9ba..d77de92e1b58 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -132,6 +132,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware" "github.com/hashicorp/terraform-provider-azurerm/internal/services/voiceservices" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/workloads" ) //go:generate go run ../tools/generator-services/main.go -path=../../ @@ -216,6 +217,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { vmware.Registration{}, voiceservices.Registration{}, web.Registration{}, + workloads.Registration{}, } services = append(services, autoRegisteredTypedServices()...) return services diff --git a/internal/services/network/validate/network_interface_name.go b/internal/services/network/validate/network_interface_name.go new file mode 100644 index 000000000000..819e6367ee81 --- /dev/null +++ b/internal/services/network/validate/network_interface_name.go @@ -0,0 +1,16 @@ +package validate + +import ( + "fmt" + "regexp" +) + +func NetworkInterfaceName(v interface{}, k string) (warnings []string, errors []error) { + value := v.(string) + + if matched := regexp.MustCompile(`^[0-9a-zA-Z][0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_]$`).Match([]byte(value)); !matched { + errors = append(errors, fmt.Errorf("%q must be between 2 and 64 characters in length. It must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods or hyphens.", k)) + } + + return warnings, errors +} diff --git a/internal/services/network/validate/network_interface_name_test.go b/internal/services/network/validate/network_interface_name_test.go new file mode 100644 index 000000000000..0672e8fa322f --- /dev/null +++ b/internal/services/network/validate/network_interface_name_test.go @@ -0,0 +1,56 @@ +package validate + +import ( + "strings" + "testing" +) + +func TestNetworkInterfaceName(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + { + Input: "", + Valid: false, + }, + { + Input: "-a", + Valid: false, + }, + { + Input: "1_n.i-c", + Valid: true, + }, + { + Input: "01nic", + Valid: true, + }, + { + Input: "01nic01", + Valid: true, + }, + { + Input: strings.Repeat("s", 63), + Valid: true, + }, + { + Input: strings.Repeat("s", 64), + Valid: true, + }, + { + Input: strings.Repeat("s", 65), + Valid: false, + }, + } + + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := NetworkInterfaceName(tc.Input, "name") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/internal/services/workloads/client/client.go b/internal/services/workloads/client/client.go new file mode 100644 index 000000000000..dbaf2e0118ee --- /dev/null +++ b/internal/services/workloads/client/client.go @@ -0,0 +1,17 @@ +package client + +import ( + sapvirtualinstances_v2023_04_01 "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +func NewClient(o *common.ClientOptions) (*sapvirtualinstances_v2023_04_01.Client, error) { + client, err := sapvirtualinstances_v2023_04_01.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) + }) + if err != nil { + return nil, err + } + return client, nil +} diff --git a/internal/services/workloads/registration.go b/internal/services/workloads/registration.go new file mode 100644 index 000000000000..5dc53a767192 --- /dev/null +++ b/internal/services/workloads/registration.go @@ -0,0 +1,37 @@ +package workloads + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +) + +type Registration struct{} + +var _ sdk.TypedServiceRegistration = Registration{} + +func (r Registration) AssociatedGitHubLabel() string { + return "service/workloads" +} + +// Name is the name of this Service +func (r Registration) Name() string { + return "Workloads" +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return []string{ + "Workloads", + } +} + +// DataSources returns a list of Data Sources supported by this Service +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +// Resources returns a list of Resources supported by this Service +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + WorkloadsSAPThreeTierVirtualInstanceResource{}, + } +} diff --git a/internal/services/workloads/validate/sap_virtual_instance_name.go b/internal/services/workloads/validate/sap_virtual_instance_name.go new file mode 100644 index 000000000000..11260313428d --- /dev/null +++ b/internal/services/workloads/validate/sap_virtual_instance_name.go @@ -0,0 +1,17 @@ +package validate + +import ( + "fmt" + "regexp" +) + +func SAPVirtualInstanceName(v interface{}, k string) (warnings []string, errors []error) { + value := v.(string) + + if matched := regexp.MustCompile(`^[A-Z][A-Z0-9][A-Z0-9]$`).Match([]byte(value)); !matched { + errors = append(errors, fmt.Errorf("%q must have three characters. The first character must be alphabetic. The second and third characters must be alphanumerical. All alphabetic characters should be uppercase.", k)) + return warnings, errors + } + + return warnings, errors +} diff --git a/internal/services/workloads/validate/sap_virtual_instance_name_test.go b/internal/services/workloads/validate/sap_virtual_instance_name_test.go new file mode 100644 index 000000000000..62cf39077562 --- /dev/null +++ b/internal/services/workloads/validate/sap_virtual_instance_name_test.go @@ -0,0 +1,45 @@ +package validate + +import "testing" + +func TestSAPVirtualInstanceName(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + { + Input: "", + Valid: false, + }, + { + Input: "x01", + Valid: false, + }, + { + Input: "xx", + Valid: false, + }, + { + Input: "x0222", + Valid: false, + }, + { + Input: "X01", + Valid: true, + }, + { + Input: "XAA", + Valid: true, + }, + } + + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := SAPVirtualInstanceName(tc.Input, "name") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/internal/services/workloads/workloads_sap_three_tier_virtual_instance_resource.go b/internal/services/workloads/workloads_sap_three_tier_virtual_instance_resource.go new file mode 100644 index 000000000000..4698c74a29d6 --- /dev/null +++ b/internal/services/workloads/workloads_sap_three_tier_virtual_instance_resource.go @@ -0,0 +1,1943 @@ +package workloads + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + computeValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/workloads/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type WorkloadsSAPThreeTierVirtualInstanceModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + AppLocation string `tfschema:"app_location"` + Environment string `tfschema:"environment"` + Identity []identity.ModelUserAssigned `tfschema:"identity"` + ManagedResourceGroupName string `tfschema:"managed_resource_group_name"` + SapFqdn string `tfschema:"sap_fqdn"` + SapProduct string `tfschema:"sap_product"` + ThreeTierConfiguration []ThreeTierConfiguration `tfschema:"three_tier_configuration"` + Tags map[string]string `tfschema:"tags"` +} + +type DiskVolumeConfiguration struct { + VolumeName string `tfschema:"volume_name"` + NumberOfDisks int `tfschema:"number_of_disks"` + SizeGb int `tfschema:"size_in_gb"` + SkuName string `tfschema:"sku_name"` +} + +type VirtualMachineConfiguration struct { + ImageReference []ImageReference `tfschema:"image"` + OSProfile []OSProfile `tfschema:"os_profile"` + VmSize string `tfschema:"virtual_machine_size"` +} + +type ImageReference struct { + Offer string `tfschema:"offer"` + Publisher string `tfschema:"publisher"` + Sku string `tfschema:"sku"` + Version string `tfschema:"version"` +} + +type OSProfile struct { + AdminUsername string `tfschema:"admin_username"` + SshPrivateKey string `tfschema:"ssh_private_key"` + SshPublicKey string `tfschema:"ssh_public_key"` +} + +type VirtualMachineResourceNames struct { + DataDisks []DataDisk `tfschema:"data_disk"` + HostName string `tfschema:"host_name"` + NetworkInterfaceNames []string `tfschema:"network_interface_names"` + OSDiskName string `tfschema:"os_disk_name"` + VMName string `tfschema:"virtual_machine_name"` +} + +type DataDisk struct { + VolumeName string `tfschema:"volume_name"` + Names []string `tfschema:"names"` +} + +type ThreeTierConfiguration struct { + ApplicationServerConfiguration []ApplicationServerConfiguration `tfschema:"application_server_configuration"` + AppResourceGroupName string `tfschema:"app_resource_group_name"` + CentralServerConfiguration []CentralServerConfiguration `tfschema:"central_server_configuration"` + DatabaseServerConfiguration []DatabaseServerConfiguration `tfschema:"database_server_configuration"` + ResourceNames []ResourceNames `tfschema:"resource_names"` + HighAvailabilityType string `tfschema:"high_availability_type"` + IsSecondaryIpEnabled bool `tfschema:"secondary_ip_enabled"` + TransportCreateAndMount []TransportCreateAndMount `tfschema:"transport_create_and_mount"` +} + +type TransportCreateAndMount struct { + ResourceGroupId string `tfschema:"resource_group_id"` + StorageAccountName string `tfschema:"storage_account_name"` +} + +type ApplicationServerConfiguration struct { + InstanceCount int `tfschema:"instance_count"` + SubnetId string `tfschema:"subnet_id"` + VirtualMachineConfiguration []VirtualMachineConfiguration `tfschema:"virtual_machine_configuration"` +} + +type CentralServerConfiguration struct { + InstanceCount int `tfschema:"instance_count"` + SubnetId string `tfschema:"subnet_id"` + VirtualMachineConfiguration []VirtualMachineConfiguration `tfschema:"virtual_machine_configuration"` +} + +type DatabaseServerConfiguration struct { + DatabaseType string `tfschema:"database_type"` + DiskVolumeConfigurations []DiskVolumeConfiguration `tfschema:"disk_volume_configuration"` + InstanceCount int `tfschema:"instance_count"` + SubnetId string `tfschema:"subnet_id"` + VirtualMachineConfiguration []VirtualMachineConfiguration `tfschema:"virtual_machine_configuration"` +} + +type ResourceNames struct { + ApplicationServer []ApplicationServerResourceNames `tfschema:"application_server"` + CentralServer []CentralServerResourceNames `tfschema:"central_server"` + DatabaseServer []DatabaseServerResourceNames `tfschema:"database_server"` + SharedStorage []SharedStorage `tfschema:"shared_storage"` +} + +type ApplicationServerResourceNames struct { + AvailabilitySetName string `tfschema:"availability_set_name"` + VirtualMachines []VirtualMachineResourceNames `tfschema:"virtual_machine"` +} + +type CentralServerResourceNames struct { + AvailabilitySetName string `tfschema:"availability_set_name"` + LoadBalancer []LoadBalancer `tfschema:"load_balancer"` + VirtualMachines []VirtualMachineResourceNames `tfschema:"virtual_machine"` +} + +type DatabaseServerResourceNames struct { + AvailabilitySetName string `tfschema:"availability_set_name"` + LoadBalancer []LoadBalancer `tfschema:"load_balancer"` + VirtualMachines []VirtualMachineResourceNames `tfschema:"virtual_machine"` +} + +type LoadBalancer struct { + BackendPoolNames []string `tfschema:"backend_pool_names"` + FrontendIpConfigurationNames []string `tfschema:"frontend_ip_configuration_names"` + HealthProbeNames []string `tfschema:"health_probe_names"` + Name string `tfschema:"name"` +} + +type SharedStorage struct { + AccountName string `tfschema:"account_name"` + PrivateEndpointName string `tfschema:"private_endpoint_name"` +} + +type WorkloadsSAPThreeTierVirtualInstanceResource struct{} + +var _ sdk.ResourceWithUpdate = WorkloadsSAPThreeTierVirtualInstanceResource{} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) ResourceType() string { + return "azurerm_workloads_sap_three_tier_virtual_instance" +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) ModelObject() interface{} { + return &WorkloadsSAPThreeTierVirtualInstanceModel{} +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return sapvirtualinstances.ValidateSapVirtualInstanceID +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.SAPVirtualInstanceName, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "app_location": commonschema.Location(), + + "environment": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(sapvirtualinstances.PossibleValuesForSAPEnvironmentType(), false), + }, + + "identity": commonschema.UserAssignedIdentityOptional(), + + "sap_fqdn": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(2, 34), + }, + + "sap_product": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(sapvirtualinstances.PossibleValuesForSAPProductType(), false), + }, + + "three_tier_configuration": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "app_resource_group_name": commonschema.ResourceGroupName(), + + "application_server_configuration": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "instance_count": { + Type: pluginsdk.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validation.IntAtLeast(1), + }, + + "subnet_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: networkValidate.SubnetID, + }, + + "virtual_machine_configuration": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "image": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "offer": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "publisher": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "RedHat", + "SUSE", + }, false), + }, + + "sku": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "version": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "os_profile": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "admin_username": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 64), + }, + + "ssh_private_key": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "ssh_public_key": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "virtual_machine_size": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + }, + }, + }, + + "central_server_configuration": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "instance_count": { + Type: pluginsdk.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validation.IntAtLeast(1), + }, + + "subnet_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: networkValidate.SubnetID, + }, + + "virtual_machine_configuration": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "image": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "offer": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "publisher": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "RedHat", + "SUSE", + }, false), + }, + + "sku": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "version": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "os_profile": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "admin_username": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 64), + }, + + "ssh_private_key": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "ssh_public_key": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "virtual_machine_size": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + }, + }, + }, + + "database_server_configuration": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "instance_count": { + Type: pluginsdk.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validation.IntAtLeast(1), + }, + + "subnet_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: networkValidate.SubnetID, + }, + + "virtual_machine_configuration": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "image": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "offer": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "publisher": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "RedHat", + "SUSE", + }, false), + }, + + "sku": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "version": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "os_profile": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "admin_username": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 64), + }, + + "ssh_private_key": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "ssh_public_key": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "virtual_machine_size": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "database_type": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(sapvirtualinstances.PossibleValuesForSAPDatabaseType(), false), + }, + + "disk_volume_configuration": { + Type: pluginsdk.TypeSet, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "volume_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "backup", + "hana/data", + "hana/log", + "hana/shared", + "os", + "usr/sap", + }, false), + }, + + "number_of_disks": { + Type: pluginsdk.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validation.IntAtLeast(1), + }, + + "size_in_gb": { + Type: pluginsdk.TypeInt, + Required: true, + ForceNew: true, + }, + + "sku_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(sapvirtualinstances.PossibleValuesForDiskSkuName(), false), + }, + }, + }, + }, + }, + }, + }, + + "resource_names": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "application_server": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "availability_set_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 80), + }, + + "virtual_machine": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "data_disk": { + Type: pluginsdk.TypeSet, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "volume_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "default", + }, false), + }, + + "names": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringLenBetween(1, 80), + }, + }, + }, + }, + }, + + "host_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 13), + }, + + "network_interface_names": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: networkValidate.NetworkInterfaceName, + }, + }, + + "os_disk_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 80), + }, + + "virtual_machine_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: computeValidate.VirtualMachineName, + }, + }, + }, + }, + }, + }, + }, + + "central_server": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "availability_set_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 80), + }, + + "load_balancer": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "backend_pool_names": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "frontend_ip_configuration_names": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "health_probe_names": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + }, + + "virtual_machine": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "data_disk": { + Type: pluginsdk.TypeSet, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "volume_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "default", + }, false), + }, + + "names": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringLenBetween(1, 80), + }, + }, + }, + }, + }, + + "host_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 13), + }, + + "network_interface_names": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: networkValidate.NetworkInterfaceName, + }, + }, + + "os_disk_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 80), + }, + + "virtual_machine_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: computeValidate.VirtualMachineName, + }, + }, + }, + }, + }, + }, + }, + + "database_server": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "availability_set_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 80), + }, + + "load_balancer": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "backend_pool_names": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "frontend_ip_configuration_names": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "health_probe_names": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + }, + + "virtual_machine": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "data_disk": { + Type: pluginsdk.TypeSet, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "volume_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "hanaData", + "hanaLog", + "hanaShared", + "usrSap", + }, false), + }, + + "names": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringLenBetween(1, 80), + }, + }, + }, + }, + }, + + "host_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 13), + }, + + "network_interface_names": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: networkValidate.NetworkInterfaceName, + }, + }, + + "os_disk_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 80), + }, + + "virtual_machine_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: computeValidate.VirtualMachineName, + }, + }, + }, + }, + }, + }, + }, + + "shared_storage": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "account_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: storageValidate.StorageAccountName, + }, + + "private_endpoint_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: networkValidate.PrivateLinkName, + }, + }, + }, + }, + }, + }, + }, + + "high_availability_type": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(sapvirtualinstances.PossibleValuesForSAPHighAvailabilityType(), false), + }, + + "secondary_ip_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + ForceNew: true, + Default: false, + }, + + "transport_create_and_mount": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "resource_group_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: commonids.ValidateResourceGroupID, + }, + + "storage_account_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: storageValidate.StorageAccountName, + }, + }, + }, + }, + }, + }, + }, + + "managed_resource_group_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: resourcegroups.ValidateName, + }, + + "tags": commonschema.Tags(), + } +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) CustomizeDiff() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + rd := metadata.ResourceDiff + + if v := rd.Get("three_tier_configuration.0.database_server_configuration.0.disk_volume_configuration"); v != nil { + diskVolumes := v.(*pluginsdk.Set).List() + if hasDuplicateVolumeName(diskVolumes) { + return fmt.Errorf("`volume_name` cannot be duplicated") + } + } + + return nil + }, + } +} + +func hasDuplicateVolumeName(input []interface{}) bool { + seen := make(map[string]bool) + + for _, v := range input { + diskVolume := v.(map[string]interface{}) + volumeName := diskVolume["volume_name"].(string) + + if seen[volumeName] { + return true + } + seen[volumeName] = true + } + + return false +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 60 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model WorkloadsSAPThreeTierVirtualInstanceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.Workloads.SAPVirtualInstances + subscriptionId := metadata.Client.Account.SubscriptionId + id := sapvirtualinstances.NewSapVirtualInstanceID(subscriptionId, model.ResourceGroupName, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + identity, err := identity.ExpandUserAssignedMapFromModel(model.Identity) + if err != nil { + return fmt.Errorf("expanding `identity`: %+v", err) + } + + parameters := &sapvirtualinstances.SAPVirtualInstance{ + Identity: identity, + Location: location.Normalize(model.Location), + Properties: sapvirtualinstances.SAPVirtualInstanceProperties{ + Environment: sapvirtualinstances.SAPEnvironmentType(model.Environment), + SapProduct: sapvirtualinstances.SAPProductType(model.SapProduct), + }, + Tags: &model.Tags, + } + + deploymentWithOSConfiguration := &sapvirtualinstances.DeploymentWithOSConfiguration{ + AppLocation: utils.String(location.Normalize(model.AppLocation)), + OsSapConfiguration: &sapvirtualinstances.OsSapConfiguration{ + SapFqdn: utils.String(model.SapFqdn), + }, + } + + threeTierConfiguration, err := expandThreeTierConfiguration(model.ThreeTierConfiguration) + if err != nil { + return err + } + deploymentWithOSConfiguration.InfrastructureConfiguration = threeTierConfiguration + + parameters.Properties.Configuration = deploymentWithOSConfiguration + + if v := model.ManagedResourceGroupName; v != "" { + parameters.Properties.ManagedResourceGroupConfiguration = &sapvirtualinstances.ManagedRGConfiguration{ + Name: utils.String(v), + } + } + + if err := client.CreateThenPoll(ctx, id, *parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 60 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Workloads.SAPVirtualInstances + + id, err := sapvirtualinstances.ParseSapVirtualInstanceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model WorkloadsSAPThreeTierVirtualInstanceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + parameters := &sapvirtualinstances.UpdateSAPVirtualInstanceRequest{} + + if metadata.ResourceData.HasChange("identity") { + identityValue, err := identity.ExpandUserAssignedMap(metadata.ResourceData.Get("identity").([]interface{})) + if err != nil { + return fmt.Errorf("expanding `identity`: %+v", err) + } + parameters.Identity = identityValue + } + + if metadata.ResourceData.HasChange("tags") { + parameters.Tags = &model.Tags + } + + if _, err := client.Update(ctx, *id, *parameters); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Workloads.SAPVirtualInstances + subscriptionId := metadata.Client.Account.SubscriptionId + + id, err := sapvirtualinstances.ParseSapVirtualInstanceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + state := WorkloadsSAPThreeTierVirtualInstanceModel{} + if model := resp.Model; model != nil { + state.Name = id.SapVirtualInstanceName + state.ResourceGroupName = id.ResourceGroupName + state.Location = location.Normalize(model.Location) + + identity, err := identity.FlattenUserAssignedMapToModel(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + state.Identity = pointer.From(identity) + + props := &model.Properties + state.Environment = string(props.Environment) + state.SapProduct = string(props.SapProduct) + state.Tags = pointer.From(model.Tags) + + if config := props.Configuration; config != nil { + if v, ok := config.(sapvirtualinstances.DeploymentWithOSConfiguration); ok { + state.AppLocation = location.Normalize(pointer.From(v.AppLocation)) + + if osSapConfiguration := v.OsSapConfiguration; osSapConfiguration != nil { + state.SapFqdn = pointer.From(osSapConfiguration.SapFqdn) + } + + if configuration := v.InfrastructureConfiguration; configuration != nil { + if threeTierConfiguration, threeTierConfigurationExists := configuration.(sapvirtualinstances.ThreeTierConfiguration); threeTierConfigurationExists { + threeTierConfig, err := flattenThreeTierConfiguration(threeTierConfiguration, metadata.ResourceData, subscriptionId) + if err != nil { + return err + } + state.ThreeTierConfiguration = threeTierConfig + } + } + } + } + + if v := props.ManagedResourceGroupConfiguration; v != nil { + state.ManagedResourceGroupName = pointer.From(v.Name) + } + } + + return metadata.Encode(&state) + }, + } +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 60 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Workloads.SAPVirtualInstances + + id, err := sapvirtualinstances.ParseSapVirtualInstanceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} + +func expandVirtualMachineConfiguration(input []VirtualMachineConfiguration) *sapvirtualinstances.VirtualMachineConfiguration { + if len(input) == 0 { + return nil + } + + virtualMachineConfiguration := input[0] + + result := &sapvirtualinstances.VirtualMachineConfiguration{ + ImageReference: pointer.From(expandImageReference(virtualMachineConfiguration.ImageReference)), + OsProfile: pointer.From(expandOsProfile(virtualMachineConfiguration.OSProfile)), + VMSize: virtualMachineConfiguration.VmSize, + } + + return result +} + +func expandImageReference(input []ImageReference) *sapvirtualinstances.ImageReference { + if len(input) == 0 { + return nil + } + + imageReference := input[0] + + result := &sapvirtualinstances.ImageReference{ + Offer: utils.String(imageReference.Offer), + Publisher: utils.String(imageReference.Publisher), + Sku: utils.String(imageReference.Sku), + Version: utils.String(imageReference.Version), + } + + return result +} + +func expandOsProfile(input []OSProfile) *sapvirtualinstances.OSProfile { + if len(input) == 0 { + return nil + } + + osProfile := input[0] + + result := &sapvirtualinstances.OSProfile{ + AdminUsername: utils.String(osProfile.AdminUsername), + OsConfiguration: &sapvirtualinstances.LinuxConfiguration{ + DisablePasswordAuthentication: utils.Bool(true), + SshKeyPair: &sapvirtualinstances.SshKeyPair{ + PrivateKey: utils.String(osProfile.SshPrivateKey), + PublicKey: utils.String(osProfile.SshPublicKey), + }, + }, + } + + return result +} + +func expandNetworkInterfaceNames(input []string) *[]sapvirtualinstances.NetworkInterfaceResourceNames { + result := make([]sapvirtualinstances.NetworkInterfaceResourceNames, 0) + if len(input) == 0 { + return &result + } + + for _, v := range input { + networkInterfaceName := sapvirtualinstances.NetworkInterfaceResourceNames{ + NetworkInterfaceName: utils.String(v), + } + + result = append(result, networkInterfaceName) + } + + return &result +} + +func expandDataDisks(input []DataDisk) *map[string][]string { + result := make(map[string][]string) + if len(input) == 0 { + return &result + } + + for _, v := range input { + result[v.VolumeName] = v.Names + } + + return &result +} + +func expandDiskVolumeConfigurations(input []DiskVolumeConfiguration) *sapvirtualinstances.DiskConfiguration { + if len(input) == 0 { + return nil + } + + result := make(map[string]sapvirtualinstances.DiskVolumeConfiguration, 0) + + for _, v := range input { + skuName := sapvirtualinstances.DiskSkuName(v.SkuName) + + result[v.VolumeName] = sapvirtualinstances.DiskVolumeConfiguration{ + Count: utils.Int64(int64(v.NumberOfDisks)), + SizeGB: utils.Int64(int64(v.SizeGb)), + Sku: &sapvirtualinstances.DiskSku{ + Name: &skuName, + }, + } + } + + return &sapvirtualinstances.DiskConfiguration{ + DiskVolumeConfigurations: &result, + } +} + +func expandApplicationServer(input []ApplicationServerConfiguration) *sapvirtualinstances.ApplicationServerConfiguration { + if len(input) == 0 { + return nil + } + + applicationServer := input[0] + + result := &sapvirtualinstances.ApplicationServerConfiguration{ + InstanceCount: int64(applicationServer.InstanceCount), + SubnetId: applicationServer.SubnetId, + VirtualMachineConfiguration: pointer.From(expandVirtualMachineConfiguration(applicationServer.VirtualMachineConfiguration)), + } + + return result +} + +func expandCentralServer(input []CentralServerConfiguration) *sapvirtualinstances.CentralServerConfiguration { + if len(input) == 0 { + return nil + } + + centralServer := input[0] + + result := &sapvirtualinstances.CentralServerConfiguration{ + InstanceCount: int64(centralServer.InstanceCount), + SubnetId: centralServer.SubnetId, + VirtualMachineConfiguration: pointer.From(expandVirtualMachineConfiguration(centralServer.VirtualMachineConfiguration)), + } + + return result +} + +func expandDatabaseServer(input []DatabaseServerConfiguration) *sapvirtualinstances.DatabaseConfiguration { + if len(input) == 0 { + return nil + } + + databaseServer := input[0] + + result := &sapvirtualinstances.DatabaseConfiguration{ + DiskConfiguration: expandDiskVolumeConfigurations(databaseServer.DiskVolumeConfigurations), + InstanceCount: int64(databaseServer.InstanceCount), + SubnetId: databaseServer.SubnetId, + VirtualMachineConfiguration: pointer.From(expandVirtualMachineConfiguration(databaseServer.VirtualMachineConfiguration)), + } + + if v := databaseServer.DatabaseType; v != "" { + dbType := sapvirtualinstances.SAPDatabaseType(v) + result.DatabaseType = &dbType + } + + return result +} + +func expandStorageConfiguration(input ThreeTierConfiguration) (*sapvirtualinstances.StorageConfiguration, error) { + if len(input.TransportCreateAndMount) == 0 { + return &sapvirtualinstances.StorageConfiguration{ + TransportFileShareConfiguration: sapvirtualinstances.SkipFileShareConfiguration{}, + }, nil + } + + result := &sapvirtualinstances.StorageConfiguration{} + + if len(input.TransportCreateAndMount) != 0 { + transportCreateAndMount, err := expandTransportCreateAndMount(input.TransportCreateAndMount) + if err != nil { + return nil, err + } + result.TransportFileShareConfiguration = transportCreateAndMount + } + + return result, nil +} + +func expandTransportCreateAndMount(input []TransportCreateAndMount) (*sapvirtualinstances.CreateAndMountFileShareConfiguration, error) { + if len(input) == 0 { + return nil, nil + } + + transportCreateAndMount := input[0] + + result := &sapvirtualinstances.CreateAndMountFileShareConfiguration{} + + if v := transportCreateAndMount.ResourceGroupId; v != "" { + resourceGroupId, err := commonids.ParseResourceGroupID(v) + if err != nil { + return nil, err + } + result.ResourceGroup = utils.String(resourceGroupId.ResourceGroupName) + } + + if v := transportCreateAndMount.StorageAccountName; v != "" { + result.StorageAccountName = utils.String(v) + } + + return result, nil +} + +func expandResourceNames(input []ResourceNames) *sapvirtualinstances.ThreeTierFullResourceNames { + if len(input) == 0 { + return nil + } + + resourceNames := input[0] + + result := &sapvirtualinstances.ThreeTierFullResourceNames{ + ApplicationServer: expandApplicationServerResourceNames(resourceNames.ApplicationServer), + CentralServer: expandCentralServerResourceNames(resourceNames.CentralServer), + DatabaseServer: expandDatabaseServerResourceNames(resourceNames.DatabaseServer), + SharedStorage: expandSharedStorage(resourceNames.SharedStorage), + } + + return result +} + +func expandApplicationServerResourceNames(input []ApplicationServerResourceNames) *sapvirtualinstances.ApplicationServerFullResourceNames { + if len(input) == 0 { + return nil + } + + applicationServerResourceNames := input[0] + + result := &sapvirtualinstances.ApplicationServerFullResourceNames{ + VirtualMachines: expandVirtualMachinesResourceNames(applicationServerResourceNames.VirtualMachines), + } + + if v := applicationServerResourceNames.AvailabilitySetName; v != "" { + result.AvailabilitySetName = utils.String(v) + } + + return result +} + +func expandVirtualMachinesResourceNames(input []VirtualMachineResourceNames) *[]sapvirtualinstances.VirtualMachineResourceNames { + result := make([]sapvirtualinstances.VirtualMachineResourceNames, 0) + if len(input) == 0 { + return &result + } + + for _, item := range input { + vmResourceNames := sapvirtualinstances.VirtualMachineResourceNames{ + DataDiskNames: expandDataDisks(item.DataDisks), + NetworkInterfaces: expandNetworkInterfaceNames(item.NetworkInterfaceNames), + } + + if v := item.HostName; v != "" { + vmResourceNames.HostName = utils.String(v) + } + + if v := item.OSDiskName; v != "" { + vmResourceNames.OsDiskName = utils.String(v) + } + + if v := item.VMName; v != "" { + vmResourceNames.VirtualMachineName = utils.String(v) + } + + result = append(result, vmResourceNames) + } + + return &result +} + +func expandCentralServerResourceNames(input []CentralServerResourceNames) *sapvirtualinstances.CentralServerFullResourceNames { + if len(input) == 0 { + return nil + } + + centralServerResourceNames := input[0] + + result := &sapvirtualinstances.CentralServerFullResourceNames{ + LoadBalancer: expandLoadBalancerResourceNames(centralServerResourceNames.LoadBalancer), + VirtualMachines: expandVirtualMachinesResourceNames(centralServerResourceNames.VirtualMachines), + } + + if v := centralServerResourceNames.AvailabilitySetName; v != "" { + result.AvailabilitySetName = utils.String(v) + } + + return result +} + +func expandLoadBalancerResourceNames(input []LoadBalancer) *sapvirtualinstances.LoadBalancerResourceNames { + result := &sapvirtualinstances.LoadBalancerResourceNames{} + if len(input) == 0 { + return result + } + + loadBalancerResourceNames := input[0] + + if v := loadBalancerResourceNames.Name; v != "" { + result.LoadBalancerName = utils.String(v) + } + + if v := loadBalancerResourceNames.BackendPoolNames; v != nil { + result.BackendPoolNames = &v + } + + if v := loadBalancerResourceNames.FrontendIpConfigurationNames; v != nil { + result.FrontendIPConfigurationNames = &v + } + + if v := loadBalancerResourceNames.HealthProbeNames; v != nil { + result.HealthProbeNames = &v + } + + return result +} + +func expandDatabaseServerResourceNames(input []DatabaseServerResourceNames) *sapvirtualinstances.DatabaseServerFullResourceNames { + if len(input) == 0 { + return nil + } + + databaseServerResourceNames := input[0] + + result := &sapvirtualinstances.DatabaseServerFullResourceNames{ + LoadBalancer: expandLoadBalancerResourceNames(databaseServerResourceNames.LoadBalancer), + VirtualMachines: expandVirtualMachinesResourceNames(databaseServerResourceNames.VirtualMachines), + } + + if v := databaseServerResourceNames.AvailabilitySetName; v != "" { + result.AvailabilitySetName = utils.String(v) + } + + return result +} + +func expandSharedStorage(input []SharedStorage) *sapvirtualinstances.SharedStorageResourceNames { + result := &sapvirtualinstances.SharedStorageResourceNames{} + if len(input) == 0 { + return result + } + + sharedStorage := input[0] + + if v := sharedStorage.AccountName; v != "" { + result.SharedStorageAccountName = utils.String(v) + } + + if v := sharedStorage.PrivateEndpointName; v != "" { + result.SharedStorageAccountPrivateEndPointName = utils.String(v) + } + + return result +} + +func expandThreeTierConfiguration(input []ThreeTierConfiguration) (*sapvirtualinstances.ThreeTierConfiguration, error) { + threeTierConfiguration := input[0] + + result := &sapvirtualinstances.ThreeTierConfiguration{ + ApplicationServer: pointer.From(expandApplicationServer(threeTierConfiguration.ApplicationServerConfiguration)), + AppResourceGroup: threeTierConfiguration.AppResourceGroupName, + CentralServer: pointer.From(expandCentralServer(threeTierConfiguration.CentralServerConfiguration)), + CustomResourceNames: expandResourceNames(threeTierConfiguration.ResourceNames), + DatabaseServer: pointer.From(expandDatabaseServer(threeTierConfiguration.DatabaseServerConfiguration)), + NetworkConfiguration: &sapvirtualinstances.NetworkConfiguration{ + IsSecondaryIPEnabled: utils.Bool(threeTierConfiguration.IsSecondaryIpEnabled), + }, + } + + storageConfiguration, err := expandStorageConfiguration(threeTierConfiguration) + if err != nil { + return nil, err + } + result.StorageConfiguration = storageConfiguration + + if v := threeTierConfiguration.HighAvailabilityType; v != "" { + result.HighAvailabilityConfig = &sapvirtualinstances.HighAvailabilityConfiguration{ + HighAvailabilityType: sapvirtualinstances.SAPHighAvailabilityType(v), + } + } + + return result, nil +} + +func flattenApplicationServer(input sapvirtualinstances.ApplicationServerConfiguration, d *pluginsdk.ResourceData, basePath string) []ApplicationServerConfiguration { + result := make([]ApplicationServerConfiguration, 0) + + applicationServerConfig := ApplicationServerConfiguration{ + InstanceCount: int(input.InstanceCount), + SubnetId: input.SubnetId, + VirtualMachineConfiguration: flattenVirtualMachineConfiguration(input.VirtualMachineConfiguration, d, fmt.Sprintf("%s.0.application_server_configuration", basePath)), + } + + return append(result, applicationServerConfig) +} + +func flattenCentralServer(input sapvirtualinstances.CentralServerConfiguration, d *pluginsdk.ResourceData, basePath string) []CentralServerConfiguration { + result := make([]CentralServerConfiguration, 0) + + centralServerConfig := CentralServerConfiguration{ + InstanceCount: int(input.InstanceCount), + SubnetId: input.SubnetId, + VirtualMachineConfiguration: flattenVirtualMachineConfiguration(input.VirtualMachineConfiguration, d, fmt.Sprintf("%s.0.central_server_configuration", basePath)), + } + + return append(result, centralServerConfig) +} + +func flattenDatabaseServer(input sapvirtualinstances.DatabaseConfiguration, d *pluginsdk.ResourceData, basePath string) []DatabaseServerConfiguration { + result := make([]DatabaseServerConfiguration, 0) + + databaseServerConfig := DatabaseServerConfiguration{ + DiskVolumeConfigurations: flattenDiskVolumeConfigurations(input.DiskConfiguration), + InstanceCount: int(input.InstanceCount), + SubnetId: input.SubnetId, + VirtualMachineConfiguration: flattenVirtualMachineConfiguration(input.VirtualMachineConfiguration, d, fmt.Sprintf("%s.0.database_server_configuration", basePath)), + } + + if v := input.DatabaseType; v != nil { + databaseServerConfig.DatabaseType = string(*v) + } + + return append(result, databaseServerConfig) +} + +func flattenResourceNames(input sapvirtualinstances.ThreeTierFullResourceNames) []ResourceNames { + result := make([]ResourceNames, 0) + + resourceNames := ResourceNames{ + ApplicationServer: flattenApplicationServerResourceNames(input.ApplicationServer), + CentralServer: flattenCentralServerResourceNames(input.CentralServer), + DatabaseServer: flattenDatabaseServerResourceNames(input.DatabaseServer), + SharedStorage: flattenSharedStorage(input.SharedStorage), + } + + return append(result, resourceNames) +} + +func flattenApplicationServerResourceNames(input *sapvirtualinstances.ApplicationServerFullResourceNames) []ApplicationServerResourceNames { + result := make([]ApplicationServerResourceNames, 0) + if input == nil { + return result + } + + return append(result, ApplicationServerResourceNames{ + AvailabilitySetName: pointer.From(input.AvailabilitySetName), + VirtualMachines: flattenVirtualMachinesResourceNames(input.VirtualMachines), + }) +} + +func flattenVirtualMachinesResourceNames(input *[]sapvirtualinstances.VirtualMachineResourceNames) []VirtualMachineResourceNames { + result := make([]VirtualMachineResourceNames, 0) + if input == nil { + return result + } + + for _, item := range *input { + result = append(result, VirtualMachineResourceNames{ + HostName: pointer.From(item.HostName), + OSDiskName: pointer.From(item.OsDiskName), + VMName: pointer.From(item.VirtualMachineName), + DataDisks: flattenDataDisks(item.DataDiskNames), + NetworkInterfaceNames: flattenNetworkInterfaceResourceNames(item.NetworkInterfaces), + }) + } + + return result +} + +func flattenCentralServerResourceNames(input *sapvirtualinstances.CentralServerFullResourceNames) []CentralServerResourceNames { + result := make([]CentralServerResourceNames, 0) + if input == nil { + return result + } + + centralServerResourceNames := CentralServerResourceNames{ + AvailabilitySetName: pointer.From(input.AvailabilitySetName), + LoadBalancer: flattenLoadBalancerResourceNames(input.LoadBalancer), + VirtualMachines: flattenVirtualMachinesResourceNames(input.VirtualMachines), + } + + return append(result, centralServerResourceNames) +} + +func flattenLoadBalancerResourceNames(input *sapvirtualinstances.LoadBalancerResourceNames) []LoadBalancer { + result := make([]LoadBalancer, 0) + if input == nil { + return result + } + + return append(result, LoadBalancer{ + Name: pointer.From(input.LoadBalancerName), + BackendPoolNames: pointer.From(input.BackendPoolNames), + FrontendIpConfigurationNames: pointer.From(input.FrontendIPConfigurationNames), + HealthProbeNames: pointer.From(input.HealthProbeNames), + }) +} + +func flattenDatabaseServerResourceNames(input *sapvirtualinstances.DatabaseServerFullResourceNames) []DatabaseServerResourceNames { + result := make([]DatabaseServerResourceNames, 0) + if input == nil { + return result + } + + return append(result, DatabaseServerResourceNames{ + AvailabilitySetName: pointer.From(input.AvailabilitySetName), + LoadBalancer: flattenLoadBalancerResourceNames(input.LoadBalancer), + VirtualMachines: flattenVirtualMachinesResourceNames(input.VirtualMachines), + }) +} + +func flattenSharedStorage(input *sapvirtualinstances.SharedStorageResourceNames) []SharedStorage { + result := make([]SharedStorage, 0) + if input == nil { + return result + } + + return append(result, SharedStorage{ + AccountName: pointer.From(input.SharedStorageAccountName), + PrivateEndpointName: pointer.From(input.SharedStorageAccountPrivateEndPointName), + }) +} + +func flattenDiskVolumeConfigurations(input *sapvirtualinstances.DiskConfiguration) []DiskVolumeConfiguration { + result := make([]DiskVolumeConfiguration, 0) + if input == nil || input.DiskVolumeConfigurations == nil { + return result + } + + for k, v := range *input.DiskVolumeConfigurations { + diskVolumeConfiguration := DiskVolumeConfiguration{ + NumberOfDisks: int(pointer.From(v.Count)), + SizeGb: int(pointer.From(v.SizeGB)), + VolumeName: k, + } + + if sku := v.Sku; sku != nil { + diskVolumeConfiguration.SkuName = string(pointer.From(sku.Name)) + } + + result = append(result, diskVolumeConfiguration) + } + + return result +} + +func flattenNetworkInterfaceResourceNames(input *[]sapvirtualinstances.NetworkInterfaceResourceNames) []string { + result := make([]string, 0) + if input == nil { + return result + } + + for _, v := range *input { + result = append(result, pointer.From(v.NetworkInterfaceName)) + } + + return result +} + +func flattenDataDisks(input *map[string][]string) []DataDisk { + results := make([]DataDisk, 0) + if input == nil { + return results + } + + for k, v := range *input { + dataDisk := DataDisk{ + VolumeName: k, + Names: v, + } + + results = append(results, dataDisk) + } + + return results +} + +func flattenVirtualMachineConfiguration(input sapvirtualinstances.VirtualMachineConfiguration, d *pluginsdk.ResourceData, basePath string) []VirtualMachineConfiguration { + result := make([]VirtualMachineConfiguration, 0) + + return append(result, VirtualMachineConfiguration{ + ImageReference: flattenImageReference(input.ImageReference), + OSProfile: flattenOSProfile(input.OsProfile, d, fmt.Sprintf("%s.0.virtual_machine_configuration", basePath)), + VmSize: input.VMSize, + }) +} + +func flattenImageReference(input sapvirtualinstances.ImageReference) []ImageReference { + result := make([]ImageReference, 0) + + return append(result, ImageReference{ + Offer: pointer.From(input.Offer), + Publisher: pointer.From(input.Publisher), + Sku: pointer.From(input.Sku), + Version: pointer.From(input.Version), + }) +} + +func flattenOSProfile(input sapvirtualinstances.OSProfile, d *pluginsdk.ResourceData, basePath string) []OSProfile { + result := make([]OSProfile, 0) + + osProfile := OSProfile{ + AdminUsername: pointer.From(input.AdminUsername), + } + + if osConfiguration := input.OsConfiguration; osConfiguration != nil { + if v, ok := osConfiguration.(sapvirtualinstances.LinuxConfiguration); ok { + if sshKeyPair := v.SshKeyPair; sshKeyPair != nil { + osProfile.SshPrivateKey = d.Get(fmt.Sprintf("%s.0.os_profile.0.ssh_private_key", basePath)).(string) + osProfile.SshPublicKey = pointer.From(sshKeyPair.PublicKey) + } + } + } + + return append(result, osProfile) +} + +func flattenThreeTierConfiguration(input sapvirtualinstances.ThreeTierConfiguration, d *pluginsdk.ResourceData, subscriptionId string) ([]ThreeTierConfiguration, error) { + result := make([]ThreeTierConfiguration, 0) + + threeTierConfig := ThreeTierConfiguration{ + AppResourceGroupName: input.AppResourceGroup, + ApplicationServerConfiguration: flattenApplicationServer(input.ApplicationServer, d, "three_tier_configuration"), + CentralServerConfiguration: flattenCentralServer(input.CentralServer, d, "three_tier_configuration"), + DatabaseServerConfiguration: flattenDatabaseServer(input.DatabaseServer, d, "three_tier_configuration"), + } + + if customResourceNames := input.CustomResourceNames; customResourceNames != nil { + if v, ok := customResourceNames.(sapvirtualinstances.ThreeTierFullResourceNames); ok { + threeTierConfig.ResourceNames = flattenResourceNames(v) + } + } + + if v := input.HighAvailabilityConfig; v != nil && v.HighAvailabilityType != "" { + threeTierConfig.HighAvailabilityType = string(v.HighAvailabilityType) + } + + if v := input.NetworkConfiguration; v != nil && v.IsSecondaryIPEnabled != nil { + threeTierConfig.IsSecondaryIpEnabled = *v.IsSecondaryIPEnabled + } + + if storageConfiguration := input.StorageConfiguration; storageConfiguration != nil { + if transportFileShareConfiguration := storageConfiguration.TransportFileShareConfiguration; transportFileShareConfiguration != nil { + if createAndMountFileShareConfiguration, ok := transportFileShareConfiguration.(sapvirtualinstances.CreateAndMountFileShareConfiguration); ok { + transportCreateAndMount := TransportCreateAndMount{ + StorageAccountName: pointer.From(createAndMountFileShareConfiguration.StorageAccountName), + } + + var resourceGroupId string + if v := createAndMountFileShareConfiguration.ResourceGroup; v != nil { + resourceGroupId = commonids.NewResourceGroupID(subscriptionId, *createAndMountFileShareConfiguration.ResourceGroup).ID() + } + transportCreateAndMount.ResourceGroupId = resourceGroupId + + threeTierConfig.TransportCreateAndMount = []TransportCreateAndMount{ + transportCreateAndMount, + } + } + + if _, ok := transportFileShareConfiguration.(sapvirtualinstances.MountFileShareConfiguration); ok { + return nil, fmt.Errorf("currently, the last segment of the Storage File Share resource manager ID in Swagger is defined as `/shares/` but it's unexpected. The last segment of the Storage File Share resource manager ID should be `/fileshares/` not `/shares/` in Swagger since the backend service is using `/fileshares/`. See more details from https://github.com/Azure/azure-rest-api-specs/issues/25209. So the feature of `TransportMount` isn't supported by TF for now due to this service API bug") + } + } + } + + return append(result, threeTierConfig), nil +} diff --git a/internal/services/workloads/workloads_sap_three_tier_virtual_instance_resource_test.go b/internal/services/workloads/workloads_sap_three_tier_virtual_instance_resource_test.go new file mode 100644 index 000000000000..93c357e011a6 --- /dev/null +++ b/internal/services/workloads/workloads_sap_three_tier_virtual_instance_resource_test.go @@ -0,0 +1,897 @@ +package workloads_test + +import ( + "context" + "fmt" + "math/rand" + "testing" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances" + "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/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type WorkloadsSAPThreeTierVirtualInstanceResource struct{} + +func TestAccWorkloadsSAPThreeTierVirtualInstance_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_workloads_sap_three_tier_virtual_instance", "test") + r := WorkloadsSAPThreeTierVirtualInstanceResource{} + sapVISNameSuffix := RandomInt() + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data, sapVISNameSuffix), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep( + "three_tier_configuration.0.application_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + "three_tier_configuration.0.central_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + "three_tier_configuration.0.database_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + ), + }) +} + +func TestAccWorkloadsSAPThreeTierVirtualInstance_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_workloads_sap_three_tier_virtual_instance", "test") + r := WorkloadsSAPThreeTierVirtualInstanceResource{} + sapVISNameSuffix := RandomInt() + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data, sapVISNameSuffix), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + { + Config: r.requiresImport(data, sapVISNameSuffix), + ExpectError: acceptance.RequiresImportError(data.ResourceType), + }, + }) +} + +func TestAccWorkloadsSAPThreeTierVirtualInstance_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_workloads_sap_three_tier_virtual_instance", "test") + r := WorkloadsSAPThreeTierVirtualInstanceResource{} + sapVISNameSuffix := RandomInt() + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data, sapVISNameSuffix), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep( + "three_tier_configuration.0.application_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + "three_tier_configuration.0.central_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + "three_tier_configuration.0.database_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + ), + }) +} + +func TestAccWorkloadsSAPThreeTierVirtualInstance_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_workloads_sap_three_tier_virtual_instance", "test") + r := WorkloadsSAPThreeTierVirtualInstanceResource{} + sapVISNameSuffix := RandomInt() + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data, sapVISNameSuffix), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep( + "three_tier_configuration.0.application_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + "three_tier_configuration.0.central_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + "three_tier_configuration.0.database_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + ), + { + Config: r.update(data, sapVISNameSuffix), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep( + "three_tier_configuration.0.application_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + "three_tier_configuration.0.central_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + "three_tier_configuration.0.database_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + ), + { + Config: r.complete(data, sapVISNameSuffix), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep( + "three_tier_configuration.0.application_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + "three_tier_configuration.0.central_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + "three_tier_configuration.0.database_server_configuration.0.virtual_machine_configuration.0.os_profile.0.ssh_private_key", + ), + }) +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := sapvirtualinstances.ParseSapVirtualInstanceID(state.ID) + if err != nil { + return nil, err + } + + client := clients.Workloads.SAPVirtualInstances + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +resource "tls_private_key" "test" { + algorithm = "RSA" + rsa_bits = 4096 +} + +data "tls_public_key" "test" { + private_key_pem = tls_private_key.test.private_key_pem +} + +data "azurerm_subscription" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-sapvis-%d" + location = "%s" +} + +resource "azurerm_user_assigned_identity" "test" { + name = "acctest-uai-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_role_assignment" "test" { + scope = data.azurerm_subscription.current.id + role_definition_name = "Azure Center for SAP solutions service role" + principal_id = azurerm_user_assigned_identity.test.principal_id +} + +resource "azurerm_virtual_network" "test" { + name = "acctest-vnet-%d" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "test" { + name = "acctest-subnet-%d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.2.0/24"] +} + +resource "azurerm_resource_group" "app" { + name = "acctestRG-sapapp-%d" + location = "%s" + + depends_on = [ + azurerm_subnet.test + ] +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.Locations.Primary) +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) basic(data acceptance.TestData, sapVISNameSuffix int) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } +} + +resource "azurerm_workloads_sap_three_tier_virtual_instance" "test" { + name = "X%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + environment = "NonProd" + sap_product = "S4HANA" + managed_resource_group_name = "acctestManagedRG%d" + app_location = azurerm_resource_group.app.location + sap_fqdn = "sap.bpaas.com" + + three_tier_configuration { + app_resource_group_name = azurerm_resource_group.app.name + + application_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_D16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + } + + central_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_D16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + } + + database_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_E16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + } + } + + identity { + type = "UserAssigned" + + identity_ids = [ + azurerm_user_assigned_identity.test.id, + ] + } + + depends_on = [ + azurerm_role_assignment.test + ] +} +`, r.template(data), sapVISNameSuffix, data.RandomInteger) +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) requiresImport(data acceptance.TestData, sapVISNameSuffix int) string { + return fmt.Sprintf(` +%s + +resource "azurerm_workloads_sap_three_tier_virtual_instance" "import" { + name = azurerm_workloads_sap_three_tier_virtual_instance.test.name + resource_group_name = azurerm_workloads_sap_three_tier_virtual_instance.test.resource_group_name + location = azurerm_workloads_sap_three_tier_virtual_instance.test.location + environment = azurerm_workloads_sap_three_tier_virtual_instance.test.environment + sap_product = azurerm_workloads_sap_three_tier_virtual_instance.test.sap_product + managed_resource_group_name = azurerm_workloads_sap_three_tier_virtual_instance.test.managed_resource_group_name + app_location = azurerm_workloads_sap_three_tier_virtual_instance.test.app_location + sap_fqdn = "sap.bpaas.com" + + three_tier_configuration { + app_resource_group_name = azurerm_resource_group.app.name + + application_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_D16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + } + + central_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_D16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + } + + database_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_E16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + } + } + + identity { + type = "UserAssigned" + + identity_ids = [ + azurerm_user_assigned_identity.test.id, + ] + } + + depends_on = [ + azurerm_role_assignment.test + ] +} +`, r.basic(data, sapVISNameSuffix)) +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) complete(data acceptance.TestData, sapVISNameSuffix int) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } +} + +resource "azurerm_storage_account" "test" { + name = "acctestsa%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_workloads_sap_three_tier_virtual_instance" "test" { + name = "X%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + environment = "NonProd" + sap_product = "S4HANA" + managed_resource_group_name = "acctestManagedRG%d" + app_location = azurerm_resource_group.app.location + sap_fqdn = "sap.bpaas.com" + + three_tier_configuration { + app_resource_group_name = azurerm_resource_group.app.name + secondary_ip_enabled = true + + application_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_D16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + } + + central_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_D16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + } + + database_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + database_type = "HANA" + + virtual_machine_configuration { + virtual_machine_size = "Standard_E16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + + disk_volume_configuration { + volume_name = "hana/data" + number_of_disks = 3 + size_in_gb = 128 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "hana/log" + number_of_disks = 3 + size_in_gb = 128 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "hana/shared" + number_of_disks = 1 + size_in_gb = 256 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "usr/sap" + number_of_disks = 1 + size_in_gb = 128 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "backup" + number_of_disks = 2 + size_in_gb = 256 + sku_name = "StandardSSD_LRS" + } + + disk_volume_configuration { + volume_name = "os" + number_of_disks = 1 + size_in_gb = 64 + sku_name = "StandardSSD_LRS" + } + } + + resource_names { + application_server { + availability_set_name = "appAvSet" + + virtual_machine { + host_name = "apphostName0" + os_disk_name = "app0osdisk" + virtual_machine_name = "appvm0" + network_interface_names = ["appnic0"] + + data_disk { + volume_name = "default" + names = ["app0disk0"] + } + } + } + + central_server { + availability_set_name = "csAvSet" + + load_balancer { + name = "ascslb" + backend_pool_names = ["ascsBackendPool"] + frontend_ip_configuration_names = ["ascsip0"] + health_probe_names = ["ascsHealthProbe"] + } + + virtual_machine { + host_name = "ascshostName" + os_disk_name = "ascsosdisk" + virtual_machine_name = "ascsvm" + network_interface_names = ["ascsnic"] + + data_disk { + volume_name = "default" + names = ["ascsdisk"] + } + } + } + + database_server { + availability_set_name = "dbAvSet" + + load_balancer { + name = "dblb" + backend_pool_names = ["dbBackendPool"] + frontend_ip_configuration_names = ["dbip"] + health_probe_names = ["dbHealthProbe"] + } + + virtual_machine { + host_name = "dbprhost" + os_disk_name = "dbprosdisk" + virtual_machine_name = "dbvmpr" + network_interface_names = ["dbprnic"] + + data_disk { + volume_name = "hanaData" + names = ["hanadatapr0", "hanadatapr1"] + } + + data_disk { + volume_name = "hanaLog" + names = ["hanalogpr0", "hanalogpr1", "hanalogpr2"] + } + + data_disk { + volume_name = "usrSap" + names = ["usrsappr0"] + } + + data_disk { + volume_name = "hanaShared" + names = ["hanasharedpr0", "hanasharedpr1"] + } + } + } + + shared_storage { + account_name = "sharedtestsa%s" + private_endpoint_name = "testPE%s" + } + } + + transport_create_and_mount { + resource_group_id = azurerm_resource_group.app.id + storage_account_name = "transsa%s" + } + } + + identity { + type = "UserAssigned" + + identity_ids = [ + azurerm_user_assigned_identity.test.id, + ] + } + + tags = { + Env = "Test" + } + + depends_on = [ + azurerm_role_assignment.test + ] +} +`, r.template(data), data.RandomString, sapVISNameSuffix, data.RandomInteger, data.RandomString, data.RandomString, data.RandomString) +} + +func (r WorkloadsSAPThreeTierVirtualInstanceResource) update(data acceptance.TestData, sapVISNameSuffix int) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } +} + +resource "azurerm_storage_account" "test" { + name = "acctestsa%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_workloads_sap_three_tier_virtual_instance" "test" { + name = "X%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + environment = "NonProd" + sap_product = "S4HANA" + managed_resource_group_name = "acctestManagedRG%d" + app_location = azurerm_resource_group.app.location + sap_fqdn = "sap.bpaas.com" + + three_tier_configuration { + app_resource_group_name = azurerm_resource_group.app.name + secondary_ip_enabled = true + + application_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_D16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + } + + central_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_D16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + } + + database_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.test.id + database_type = "HANA" + + virtual_machine_configuration { + virtual_machine_size = "Standard_E16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.test.private_key_pem + ssh_public_key = data.tls_public_key.test.public_key_openssh + } + } + + disk_volume_configuration { + volume_name = "hana/data" + number_of_disks = 3 + size_in_gb = 128 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "hana/log" + number_of_disks = 3 + size_in_gb = 128 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "hana/shared" + number_of_disks = 1 + size_in_gb = 256 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "usr/sap" + number_of_disks = 1 + size_in_gb = 128 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "backup" + number_of_disks = 2 + size_in_gb = 256 + sku_name = "StandardSSD_LRS" + } + + disk_volume_configuration { + volume_name = "os" + number_of_disks = 1 + size_in_gb = 64 + sku_name = "StandardSSD_LRS" + } + } + + resource_names { + application_server { + availability_set_name = "appAvSet" + + virtual_machine { + host_name = "apphostName0" + os_disk_name = "app0osdisk" + virtual_machine_name = "appvm0" + network_interface_names = ["appnic0"] + + data_disk { + volume_name = "default" + names = ["app0disk0"] + } + } + } + + central_server { + availability_set_name = "csAvSet" + + load_balancer { + name = "ascslb" + backend_pool_names = ["ascsBackendPool"] + frontend_ip_configuration_names = ["ascsip0"] + health_probe_names = ["ascsHealthProbe"] + } + + virtual_machine { + host_name = "ascshostName" + os_disk_name = "ascsosdisk" + virtual_machine_name = "ascsvm" + network_interface_names = ["ascsnic"] + + data_disk { + volume_name = "default" + names = ["ascsdisk"] + } + } + } + + database_server { + availability_set_name = "dbAvSet" + + load_balancer { + name = "dblb" + backend_pool_names = ["dbBackendPool"] + frontend_ip_configuration_names = ["dbip"] + health_probe_names = ["dbHealthProbe"] + } + + virtual_machine { + host_name = "dbprhost" + os_disk_name = "dbprosdisk" + virtual_machine_name = "dbvmpr" + network_interface_names = ["dbprnic"] + + data_disk { + volume_name = "hanaData" + names = ["hanadatapr0", "hanadatapr1"] + } + + data_disk { + volume_name = "hanaLog" + names = ["hanalogpr0", "hanalogpr1", "hanalogpr2"] + } + + data_disk { + volume_name = "usrSap" + names = ["usrsappr0"] + } + + data_disk { + volume_name = "hanaShared" + names = ["hanasharedpr0", "hanasharedpr1"] + } + } + } + + shared_storage { + account_name = "sharedtestsa%s" + private_endpoint_name = "testPE%s" + } + } + + transport_create_and_mount { + resource_group_id = azurerm_resource_group.app.id + storage_account_name = "transsa%s" + } + } + + depends_on = [ + azurerm_role_assignment.test + ] +} +`, r.template(data), data.RandomString, sapVISNameSuffix, data.RandomInteger, data.RandomString, data.RandomString, data.RandomString) +} + +func RandomInt() int { + rand.NewSource(time.Now().UnixNano()) + num := rand.Intn(90) + 10 + + return num +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/client.go new file mode 100644 index 000000000000..b92f8f3cf562 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/client.go @@ -0,0 +1,118 @@ +package v2023_04_01 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + Monitors *monitors.MonitorsClient + ProviderInstances *providerinstances.ProviderInstancesClient + SAPApplicationServerInstances *sapapplicationserverinstances.SAPApplicationServerInstancesClient + SAPAvailabilityZoneDetails *sapavailabilityzonedetails.SAPAvailabilityZoneDetailsClient + SAPCentralInstances *sapcentralinstances.SAPCentralInstancesClient + SAPDatabaseInstances *sapdatabaseinstances.SAPDatabaseInstancesClient + SAPDiskConfigurations *sapdiskconfigurations.SAPDiskConfigurationsClient + SAPRecommendations *saprecommendations.SAPRecommendationsClient + SAPSupportedSku *sapsupportedsku.SAPSupportedSkuClient + SAPVirtualInstances *sapvirtualinstances.SAPVirtualInstancesClient + SapLandscapeMonitor *saplandscapemonitor.SapLandscapeMonitorClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + monitorsClient, err := monitors.NewMonitorsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Monitors client: %+v", err) + } + configureFunc(monitorsClient.Client) + + providerInstancesClient, err := providerinstances.NewProviderInstancesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ProviderInstances client: %+v", err) + } + configureFunc(providerInstancesClient.Client) + + sAPApplicationServerInstancesClient, err := sapapplicationserverinstances.NewSAPApplicationServerInstancesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SAPApplicationServerInstances client: %+v", err) + } + configureFunc(sAPApplicationServerInstancesClient.Client) + + sAPAvailabilityZoneDetailsClient, err := sapavailabilityzonedetails.NewSAPAvailabilityZoneDetailsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SAPAvailabilityZoneDetails client: %+v", err) + } + configureFunc(sAPAvailabilityZoneDetailsClient.Client) + + sAPCentralInstancesClient, err := sapcentralinstances.NewSAPCentralInstancesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SAPCentralInstances client: %+v", err) + } + configureFunc(sAPCentralInstancesClient.Client) + + sAPDatabaseInstancesClient, err := sapdatabaseinstances.NewSAPDatabaseInstancesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SAPDatabaseInstances client: %+v", err) + } + configureFunc(sAPDatabaseInstancesClient.Client) + + sAPDiskConfigurationsClient, err := sapdiskconfigurations.NewSAPDiskConfigurationsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SAPDiskConfigurations client: %+v", err) + } + configureFunc(sAPDiskConfigurationsClient.Client) + + sAPRecommendationsClient, err := saprecommendations.NewSAPRecommendationsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SAPRecommendations client: %+v", err) + } + configureFunc(sAPRecommendationsClient.Client) + + sAPSupportedSkuClient, err := sapsupportedsku.NewSAPSupportedSkuClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SAPSupportedSku client: %+v", err) + } + configureFunc(sAPSupportedSkuClient.Client) + + sAPVirtualInstancesClient, err := sapvirtualinstances.NewSAPVirtualInstancesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SAPVirtualInstances client: %+v", err) + } + configureFunc(sAPVirtualInstancesClient.Client) + + sapLandscapeMonitorClient, err := saplandscapemonitor.NewSapLandscapeMonitorClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SapLandscapeMonitor client: %+v", err) + } + configureFunc(sapLandscapeMonitorClient.Client) + + return &Client{ + Monitors: monitorsClient, + ProviderInstances: providerInstancesClient, + SAPApplicationServerInstances: sAPApplicationServerInstancesClient, + SAPAvailabilityZoneDetails: sAPAvailabilityZoneDetailsClient, + SAPCentralInstances: sAPCentralInstancesClient, + SAPDatabaseInstances: sAPDatabaseInstancesClient, + SAPDiskConfigurations: sAPDiskConfigurationsClient, + SAPRecommendations: sAPRecommendationsClient, + SAPSupportedSku: sAPSupportedSkuClient, + SAPVirtualInstances: sAPVirtualInstancesClient, + SapLandscapeMonitor: sapLandscapeMonitorClient, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/README.md new file mode 100644 index 000000000000..d9f988b29c47 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/README.md @@ -0,0 +1,121 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors` Documentation + +The `monitors` SDK allows for interaction with the Azure Resource Manager Service `workloads` (API Version `2023-04-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors" +``` + + +### Client Initialization + +```go +client := monitors.NewMonitorsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `MonitorsClient.Create` + +```go +ctx := context.TODO() +id := monitors.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +payload := monitors.Monitor{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `MonitorsClient.Delete` + +```go +ctx := context.TODO() +id := monitors.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `MonitorsClient.Get` + +```go +ctx := context.TODO() +id := monitors.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +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: `MonitorsClient.List` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `MonitorsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `MonitorsClient.Update` + +```go +ctx := context.TODO() +id := monitors.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +payload := monitors.UpdateMonitorRequest{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/client.go new file mode 100644 index 000000000000..6a08c03de8b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/client.go @@ -0,0 +1,26 @@ +package monitors + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsClient struct { + Client *resourcemanager.Client +} + +func NewMonitorsClientWithBaseURI(sdkApi sdkEnv.Api) (*MonitorsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "monitors", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating MonitorsClient: %+v", err) + } + + return &MonitorsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/constants.go new file mode 100644 index 000000000000..a18e1177463a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/constants.go @@ -0,0 +1,107 @@ +package monitors + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RoutingPreference string + +const ( + RoutingPreferenceDefault RoutingPreference = "Default" + RoutingPreferenceRouteAll RoutingPreference = "RouteAll" +) + +func PossibleValuesForRoutingPreference() []string { + return []string{ + string(RoutingPreferenceDefault), + string(RoutingPreferenceRouteAll), + } +} + +func (s *RoutingPreference) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRoutingPreference(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRoutingPreference(input string) (*RoutingPreference, error) { + vals := map[string]RoutingPreference{ + "default": RoutingPreferenceDefault, + "routeall": RoutingPreferenceRouteAll, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RoutingPreference(input) + return &out, nil +} + +type WorkloadMonitorProvisioningState string + +const ( + WorkloadMonitorProvisioningStateAccepted WorkloadMonitorProvisioningState = "Accepted" + WorkloadMonitorProvisioningStateCreating WorkloadMonitorProvisioningState = "Creating" + WorkloadMonitorProvisioningStateDeleting WorkloadMonitorProvisioningState = "Deleting" + WorkloadMonitorProvisioningStateFailed WorkloadMonitorProvisioningState = "Failed" + WorkloadMonitorProvisioningStateMigrating WorkloadMonitorProvisioningState = "Migrating" + WorkloadMonitorProvisioningStateSucceeded WorkloadMonitorProvisioningState = "Succeeded" + WorkloadMonitorProvisioningStateUpdating WorkloadMonitorProvisioningState = "Updating" +) + +func PossibleValuesForWorkloadMonitorProvisioningState() []string { + return []string{ + string(WorkloadMonitorProvisioningStateAccepted), + string(WorkloadMonitorProvisioningStateCreating), + string(WorkloadMonitorProvisioningStateDeleting), + string(WorkloadMonitorProvisioningStateFailed), + string(WorkloadMonitorProvisioningStateMigrating), + string(WorkloadMonitorProvisioningStateSucceeded), + string(WorkloadMonitorProvisioningStateUpdating), + } +} + +func (s *WorkloadMonitorProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWorkloadMonitorProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWorkloadMonitorProvisioningState(input string) (*WorkloadMonitorProvisioningState, error) { + vals := map[string]WorkloadMonitorProvisioningState{ + "accepted": WorkloadMonitorProvisioningStateAccepted, + "creating": WorkloadMonitorProvisioningStateCreating, + "deleting": WorkloadMonitorProvisioningStateDeleting, + "failed": WorkloadMonitorProvisioningStateFailed, + "migrating": WorkloadMonitorProvisioningStateMigrating, + "succeeded": WorkloadMonitorProvisioningStateSucceeded, + "updating": WorkloadMonitorProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkloadMonitorProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/id_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/id_monitor.go new file mode 100644 index 000000000000..91ad9135d1a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/id_monitor.go @@ -0,0 +1,125 @@ +package monitors + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &MonitorId{} + +// MonitorId is a struct representing the Resource ID for a Monitor +type MonitorId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string +} + +// NewMonitorID returns a new MonitorId struct +func NewMonitorID(subscriptionId string, resourceGroupName string, monitorName string) MonitorId { + return MonitorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + } +} + +// ParseMonitorID parses 'input' into a MonitorId +func ParseMonitorID(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(&MonitorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseMonitorIDInsensitively parses 'input' case-insensitively into a MonitorId +// note: this method should only be used for API response data and not user input +func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(&MonitorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MonitorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) + } + + return nil +} + +// ValidateMonitorID checks that 'input' can be parsed as a Monitor ID +func ValidateMonitorID(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 := ParseMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Monitor ID +func (id MonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Workloads/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Monitor ID +func (id MonitorId) 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("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + } +} + +// String returns a human-readable description of this Monitor ID +func (id MonitorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + } + return fmt.Sprintf("Monitor (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_create.go new file mode 100644 index 000000000000..2bd656897c5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_create.go @@ -0,0 +1,75 @@ +package monitors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Monitor +} + +// Create ... +func (c MonitorsClient) Create(ctx context.Context, id MonitorId, input Monitor) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c MonitorsClient) CreateThenPoll(ctx context.Context, id MonitorId, input Monitor) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_delete.go new file mode 100644 index 000000000000..15174fbb45f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_delete.go @@ -0,0 +1,72 @@ +package monitors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// Delete ... +func (c MonitorsClient) Delete(ctx context.Context, id MonitorId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c MonitorsClient) DeleteThenPoll(ctx context.Context, id MonitorId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_get.go new file mode 100644 index 000000000000..fc8735c60327 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_get.go @@ -0,0 +1,54 @@ +package monitors + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Monitor +} + +// Get ... +func (c MonitorsClient) Get(ctx context.Context, id MonitorId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Monitor + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_list.go new file mode 100644 index 000000000000..10f73f6ce50e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_list.go @@ -0,0 +1,92 @@ +package monitors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Monitor +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Monitor +} + +// List ... +func (c MonitorsClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Workloads/monitors", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Monitor `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c MonitorsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, MonitorOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c MonitorsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate MonitorOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Monitor, 0) + + resp, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_listbyresourcegroup.go new file mode 100644 index 000000000000..a25be4e980a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package monitors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Monitor +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Monitor +} + +// ListByResourceGroup ... +func (c MonitorsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Workloads/monitors", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Monitor `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c MonitorsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, MonitorOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c MonitorsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate MonitorOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Monitor, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_update.go new file mode 100644 index 000000000000..024eae08ef5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/method_update.go @@ -0,0 +1,58 @@ +package monitors + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Monitor +} + +// Update ... +func (c MonitorsClient) Update(ctx context.Context, id MonitorId, input UpdateMonitorRequest) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Monitor + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_error.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_error.go new file mode 100644 index 000000000000..0cb36b669f86 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_error.go @@ -0,0 +1,12 @@ +package monitors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Error struct { + Code *string `json:"code,omitempty"` + Details *[]Error `json:"details,omitempty"` + InnerError *ErrorInnerError `json:"innerError,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_erroradditionalinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_erroradditionalinfo.go new file mode 100644 index 000000000000..f8bd860c06e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package monitors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_errordetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_errordetail.go new file mode 100644 index 000000000000..47cceaf570a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_errordetail.go @@ -0,0 +1,12 @@ +package monitors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDetail struct { + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_errorinnererror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_errorinnererror.go new file mode 100644 index 000000000000..181cb41b9ad7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_errorinnererror.go @@ -0,0 +1,8 @@ +package monitors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorInnerError struct { + InnerError *Error `json:"innerError,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_managedrgconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_managedrgconfiguration.go new file mode 100644 index 000000000000..21d74c2a4c1b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_managedrgconfiguration.go @@ -0,0 +1,8 @@ +package monitors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRGConfiguration struct { + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_monitor.go new file mode 100644 index 000000000000..04f17682e68a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_monitor.go @@ -0,0 +1,20 @@ +package monitors + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Monitor struct { + Id *string `json:"id,omitempty"` + Identity *identity.UserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *MonitorProperties `json:"properties,omitempty"` + SystemData *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/workloads/2023-04-01/monitors/model_monitorproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_monitorproperties.go new file mode 100644 index 000000000000..6d8e38b2092c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_monitorproperties.go @@ -0,0 +1,17 @@ +package monitors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorProperties struct { + AppLocation *string `json:"appLocation,omitempty"` + Errors *Error `json:"errors,omitempty"` + LogAnalyticsWorkspaceArmId *string `json:"logAnalyticsWorkspaceArmId,omitempty"` + ManagedResourceGroupConfiguration *ManagedRGConfiguration `json:"managedResourceGroupConfiguration,omitempty"` + MonitorSubnet *string `json:"monitorSubnet,omitempty"` + MsiArmId *string `json:"msiArmId,omitempty"` + ProvisioningState *WorkloadMonitorProvisioningState `json:"provisioningState,omitempty"` + RoutingPreference *RoutingPreference `json:"routingPreference,omitempty"` + StorageAccountArmId *string `json:"storageAccountArmId,omitempty"` + ZoneRedundancyPreference *string `json:"zoneRedundancyPreference,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_operationstatusresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_operationstatusresult.go new file mode 100644 index 000000000000..2cda24eeac3a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_operationstatusresult.go @@ -0,0 +1,45 @@ +package monitors + +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 OperationStatusResult struct { + EndTime *string `json:"endTime,omitempty"` + Error *ErrorDetail `json:"error,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Operations *[]OperationStatusResult `json:"operations,omitempty"` + PercentComplete *float64 `json:"percentComplete,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status string `json:"status"` +} + +func (o *OperationStatusResult) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *OperationStatusResult) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_updatemonitorrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_updatemonitorrequest.go new file mode 100644 index 000000000000..7c1c5544aeb0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/model_updatemonitorrequest.go @@ -0,0 +1,13 @@ +package monitors + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateMonitorRequest struct { + Identity *identity.UserAssignedMap `json:"identity,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/predicates.go new file mode 100644 index 000000000000..c4b22dac8c46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/predicates.go @@ -0,0 +1,32 @@ +package monitors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p MonitorOperationPredicate) Matches(input Monitor) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/version.go new file mode 100644 index 000000000000..56ae1ca607fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors/version.go @@ -0,0 +1,12 @@ +package monitors + +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 = "2023-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/monitors/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/README.md new file mode 100644 index 000000000000..727699db3238 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances` Documentation + +The `providerinstances` SDK allows for interaction with the Azure Resource Manager Service `workloads` (API Version `2023-04-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/workloads/2023-04-01/providerinstances" +``` + + +### Client Initialization + +```go +client := providerinstances.NewProviderInstancesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProviderInstancesClient.Create` + +```go +ctx := context.TODO() +id := providerinstances.NewProviderInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "providerInstanceValue") + +payload := providerinstances.ProviderInstance{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProviderInstancesClient.Delete` + +```go +ctx := context.TODO() +id := providerinstances.NewProviderInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "providerInstanceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ProviderInstancesClient.Get` + +```go +ctx := context.TODO() +id := providerinstances.NewProviderInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "providerInstanceValue") + +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: `ProviderInstancesClient.List` + +```go +ctx := context.TODO() +id := providerinstances.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/client.go new file mode 100644 index 000000000000..32b9237eacec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/client.go @@ -0,0 +1,26 @@ +package providerinstances + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProviderInstancesClient struct { + Client *resourcemanager.Client +} + +func NewProviderInstancesClientWithBaseURI(sdkApi sdkEnv.Api) (*ProviderInstancesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "providerinstances", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProviderInstancesClient: %+v", err) + } + + return &ProviderInstancesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/constants.go new file mode 100644 index 000000000000..2746d491ce8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/constants.go @@ -0,0 +1,110 @@ +package providerinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SslPreference string + +const ( + SslPreferenceDisabled SslPreference = "Disabled" + SslPreferenceRootCertificate SslPreference = "RootCertificate" + SslPreferenceServerCertificate SslPreference = "ServerCertificate" +) + +func PossibleValuesForSslPreference() []string { + return []string{ + string(SslPreferenceDisabled), + string(SslPreferenceRootCertificate), + string(SslPreferenceServerCertificate), + } +} + +func (s *SslPreference) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSslPreference(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSslPreference(input string) (*SslPreference, error) { + vals := map[string]SslPreference{ + "disabled": SslPreferenceDisabled, + "rootcertificate": SslPreferenceRootCertificate, + "servercertificate": SslPreferenceServerCertificate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SslPreference(input) + return &out, nil +} + +type WorkloadMonitorProvisioningState string + +const ( + WorkloadMonitorProvisioningStateAccepted WorkloadMonitorProvisioningState = "Accepted" + WorkloadMonitorProvisioningStateCreating WorkloadMonitorProvisioningState = "Creating" + WorkloadMonitorProvisioningStateDeleting WorkloadMonitorProvisioningState = "Deleting" + WorkloadMonitorProvisioningStateFailed WorkloadMonitorProvisioningState = "Failed" + WorkloadMonitorProvisioningStateMigrating WorkloadMonitorProvisioningState = "Migrating" + WorkloadMonitorProvisioningStateSucceeded WorkloadMonitorProvisioningState = "Succeeded" + WorkloadMonitorProvisioningStateUpdating WorkloadMonitorProvisioningState = "Updating" +) + +func PossibleValuesForWorkloadMonitorProvisioningState() []string { + return []string{ + string(WorkloadMonitorProvisioningStateAccepted), + string(WorkloadMonitorProvisioningStateCreating), + string(WorkloadMonitorProvisioningStateDeleting), + string(WorkloadMonitorProvisioningStateFailed), + string(WorkloadMonitorProvisioningStateMigrating), + string(WorkloadMonitorProvisioningStateSucceeded), + string(WorkloadMonitorProvisioningStateUpdating), + } +} + +func (s *WorkloadMonitorProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWorkloadMonitorProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWorkloadMonitorProvisioningState(input string) (*WorkloadMonitorProvisioningState, error) { + vals := map[string]WorkloadMonitorProvisioningState{ + "accepted": WorkloadMonitorProvisioningStateAccepted, + "creating": WorkloadMonitorProvisioningStateCreating, + "deleting": WorkloadMonitorProvisioningStateDeleting, + "failed": WorkloadMonitorProvisioningStateFailed, + "migrating": WorkloadMonitorProvisioningStateMigrating, + "succeeded": WorkloadMonitorProvisioningStateSucceeded, + "updating": WorkloadMonitorProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkloadMonitorProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/id_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/id_monitor.go new file mode 100644 index 000000000000..fafec7a18c2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/id_monitor.go @@ -0,0 +1,125 @@ +package providerinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &MonitorId{} + +// MonitorId is a struct representing the Resource ID for a Monitor +type MonitorId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string +} + +// NewMonitorID returns a new MonitorId struct +func NewMonitorID(subscriptionId string, resourceGroupName string, monitorName string) MonitorId { + return MonitorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + } +} + +// ParseMonitorID parses 'input' into a MonitorId +func ParseMonitorID(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(&MonitorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseMonitorIDInsensitively parses 'input' case-insensitively into a MonitorId +// note: this method should only be used for API response data and not user input +func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(&MonitorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MonitorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) + } + + return nil +} + +// ValidateMonitorID checks that 'input' can be parsed as a Monitor ID +func ValidateMonitorID(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 := ParseMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Monitor ID +func (id MonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Workloads/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Monitor ID +func (id MonitorId) 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("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + } +} + +// String returns a human-readable description of this Monitor ID +func (id MonitorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + } + return fmt.Sprintf("Monitor (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/id_providerinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/id_providerinstance.go new file mode 100644 index 000000000000..4826fcc56cc5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/id_providerinstance.go @@ -0,0 +1,134 @@ +package providerinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ProviderInstanceId{} + +// ProviderInstanceId is a struct representing the Resource ID for a Provider Instance +type ProviderInstanceId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string + ProviderInstanceName string +} + +// NewProviderInstanceID returns a new ProviderInstanceId struct +func NewProviderInstanceID(subscriptionId string, resourceGroupName string, monitorName string, providerInstanceName string) ProviderInstanceId { + return ProviderInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + ProviderInstanceName: providerInstanceName, + } +} + +// ParseProviderInstanceID parses 'input' into a ProviderInstanceId +func ParseProviderInstanceID(input string) (*ProviderInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProviderInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProviderInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseProviderInstanceIDInsensitively parses 'input' case-insensitively into a ProviderInstanceId +// note: this method should only be used for API response data and not user input +func ParseProviderInstanceIDInsensitively(input string) (*ProviderInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProviderInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProviderInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProviderInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) + } + + if id.ProviderInstanceName, ok = input.Parsed["providerInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerInstanceName", input) + } + + return nil +} + +// ValidateProviderInstanceID checks that 'input' can be parsed as a Provider Instance ID +func ValidateProviderInstanceID(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 := ParseProviderInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provider Instance ID +func (id ProviderInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Workloads/monitors/%s/providerInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName, id.ProviderInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provider Instance ID +func (id ProviderInstanceId) 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("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + resourceids.StaticSegment("staticProviderInstances", "providerInstances", "providerInstances"), + resourceids.UserSpecifiedSegment("providerInstanceName", "providerInstanceValue"), + } +} + +// String returns a human-readable description of this Provider Instance ID +func (id ProviderInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + fmt.Sprintf("Provider Instance Name: %q", id.ProviderInstanceName), + } + return fmt.Sprintf("Provider Instance (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_create.go new file mode 100644 index 000000000000..7945da33039e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_create.go @@ -0,0 +1,75 @@ +package providerinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ProviderInstance +} + +// Create ... +func (c ProviderInstancesClient) Create(ctx context.Context, id ProviderInstanceId, input ProviderInstance) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c ProviderInstancesClient) CreateThenPoll(ctx context.Context, id ProviderInstanceId, input ProviderInstance) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_delete.go new file mode 100644 index 000000000000..699cfc01fdec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_delete.go @@ -0,0 +1,72 @@ +package providerinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// Delete ... +func (c ProviderInstancesClient) Delete(ctx context.Context, id ProviderInstanceId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ProviderInstancesClient) DeleteThenPoll(ctx context.Context, id ProviderInstanceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_get.go new file mode 100644 index 000000000000..a64a993f9d29 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_get.go @@ -0,0 +1,54 @@ +package providerinstances + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProviderInstance +} + +// Get ... +func (c ProviderInstancesClient) Get(ctx context.Context, id ProviderInstanceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ProviderInstance + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_list.go new file mode 100644 index 000000000000..4fe65334980a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/method_list.go @@ -0,0 +1,91 @@ +package providerinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ProviderInstance +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ProviderInstance +} + +// List ... +func (c ProviderInstancesClient) List(ctx context.Context, id MonitorId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providerInstances", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ProviderInstance `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ProviderInstancesClient) ListComplete(ctx context.Context, id MonitorId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ProviderInstanceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProviderInstancesClient) ListCompleteMatchingPredicate(ctx context.Context, id MonitorId, predicate ProviderInstanceOperationPredicate) (result ListCompleteResult, err error) { + items := make([]ProviderInstance, 0) + + resp, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_db2providerinstanceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_db2providerinstanceproperties.go new file mode 100644 index 000000000000..0c65ab5d2d45 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_db2providerinstanceproperties.go @@ -0,0 +1,49 @@ +package providerinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ProviderSpecificProperties = DB2ProviderInstanceProperties{} + +type DB2ProviderInstanceProperties struct { + DbName *string `json:"dbName,omitempty"` + DbPassword *string `json:"dbPassword,omitempty"` + DbPasswordUri *string `json:"dbPasswordUri,omitempty"` + DbPort *string `json:"dbPort,omitempty"` + DbUsername *string `json:"dbUsername,omitempty"` + Hostname *string `json:"hostname,omitempty"` + SapSid *string `json:"sapSid,omitempty"` + SslCertificateUri *string `json:"sslCertificateUri,omitempty"` + SslPreference *SslPreference `json:"sslPreference,omitempty"` + + // Fields inherited from ProviderSpecificProperties +} + +var _ json.Marshaler = DB2ProviderInstanceProperties{} + +func (s DB2ProviderInstanceProperties) MarshalJSON() ([]byte, error) { + type wrapper DB2ProviderInstanceProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DB2ProviderInstanceProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DB2ProviderInstanceProperties: %+v", err) + } + decoded["providerType"] = "Db2" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DB2ProviderInstanceProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_error.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_error.go new file mode 100644 index 000000000000..b8bad25fb082 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_error.go @@ -0,0 +1,12 @@ +package providerinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Error struct { + Code *string `json:"code,omitempty"` + Details *[]Error `json:"details,omitempty"` + InnerError *ErrorInnerError `json:"innerError,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_erroradditionalinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_erroradditionalinfo.go new file mode 100644 index 000000000000..e5ddfeee54a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package providerinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_errordetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_errordetail.go new file mode 100644 index 000000000000..c08a0467c170 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_errordetail.go @@ -0,0 +1,12 @@ +package providerinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDetail struct { + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_errorinnererror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_errorinnererror.go new file mode 100644 index 000000000000..c6482b27cd30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_errorinnererror.go @@ -0,0 +1,8 @@ +package providerinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorInnerError struct { + InnerError *Error `json:"innerError,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_hanadbproviderinstanceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_hanadbproviderinstanceproperties.go new file mode 100644 index 000000000000..0478e8e2904d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_hanadbproviderinstanceproperties.go @@ -0,0 +1,51 @@ +package providerinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ProviderSpecificProperties = HanaDbProviderInstanceProperties{} + +type HanaDbProviderInstanceProperties struct { + DbName *string `json:"dbName,omitempty"` + DbPassword *string `json:"dbPassword,omitempty"` + DbPasswordUri *string `json:"dbPasswordUri,omitempty"` + DbUsername *string `json:"dbUsername,omitempty"` + Hostname *string `json:"hostname,omitempty"` + InstanceNumber *string `json:"instanceNumber,omitempty"` + SapSid *string `json:"sapSid,omitempty"` + SqlPort *string `json:"sqlPort,omitempty"` + SslCertificateUri *string `json:"sslCertificateUri,omitempty"` + SslHostNameInCertificate *string `json:"sslHostNameInCertificate,omitempty"` + SslPreference *SslPreference `json:"sslPreference,omitempty"` + + // Fields inherited from ProviderSpecificProperties +} + +var _ json.Marshaler = HanaDbProviderInstanceProperties{} + +func (s HanaDbProviderInstanceProperties) MarshalJSON() ([]byte, error) { + type wrapper HanaDbProviderInstanceProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling HanaDbProviderInstanceProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling HanaDbProviderInstanceProperties: %+v", err) + } + decoded["providerType"] = "SapHana" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling HanaDbProviderInstanceProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_mssqlserverproviderinstanceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_mssqlserverproviderinstanceproperties.go new file mode 100644 index 000000000000..3ef49af37ada --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_mssqlserverproviderinstanceproperties.go @@ -0,0 +1,48 @@ +package providerinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ProviderSpecificProperties = MsSqlServerProviderInstanceProperties{} + +type MsSqlServerProviderInstanceProperties struct { + DbPassword *string `json:"dbPassword,omitempty"` + DbPasswordUri *string `json:"dbPasswordUri,omitempty"` + DbPort *string `json:"dbPort,omitempty"` + DbUsername *string `json:"dbUsername,omitempty"` + Hostname *string `json:"hostname,omitempty"` + SapSid *string `json:"sapSid,omitempty"` + SslCertificateUri *string `json:"sslCertificateUri,omitempty"` + SslPreference *SslPreference `json:"sslPreference,omitempty"` + + // Fields inherited from ProviderSpecificProperties +} + +var _ json.Marshaler = MsSqlServerProviderInstanceProperties{} + +func (s MsSqlServerProviderInstanceProperties) MarshalJSON() ([]byte, error) { + type wrapper MsSqlServerProviderInstanceProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling MsSqlServerProviderInstanceProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling MsSqlServerProviderInstanceProperties: %+v", err) + } + decoded["providerType"] = "MsSqlServer" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling MsSqlServerProviderInstanceProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_operationstatusresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_operationstatusresult.go new file mode 100644 index 000000000000..238a07866633 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_operationstatusresult.go @@ -0,0 +1,45 @@ +package providerinstances + +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 OperationStatusResult struct { + EndTime *string `json:"endTime,omitempty"` + Error *ErrorDetail `json:"error,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Operations *[]OperationStatusResult `json:"operations,omitempty"` + PercentComplete *float64 `json:"percentComplete,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status string `json:"status"` +} + +func (o *OperationStatusResult) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *OperationStatusResult) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_prometheushaclusterproviderinstanceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_prometheushaclusterproviderinstanceproperties.go new file mode 100644 index 000000000000..1facc5f662a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_prometheushaclusterproviderinstanceproperties.go @@ -0,0 +1,46 @@ +package providerinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ProviderSpecificProperties = PrometheusHaClusterProviderInstanceProperties{} + +type PrometheusHaClusterProviderInstanceProperties struct { + ClusterName *string `json:"clusterName,omitempty"` + Hostname *string `json:"hostname,omitempty"` + PrometheusUrl *string `json:"prometheusUrl,omitempty"` + Sid *string `json:"sid,omitempty"` + SslCertificateUri *string `json:"sslCertificateUri,omitempty"` + SslPreference *SslPreference `json:"sslPreference,omitempty"` + + // Fields inherited from ProviderSpecificProperties +} + +var _ json.Marshaler = PrometheusHaClusterProviderInstanceProperties{} + +func (s PrometheusHaClusterProviderInstanceProperties) MarshalJSON() ([]byte, error) { + type wrapper PrometheusHaClusterProviderInstanceProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling PrometheusHaClusterProviderInstanceProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling PrometheusHaClusterProviderInstanceProperties: %+v", err) + } + decoded["providerType"] = "PrometheusHaCluster" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling PrometheusHaClusterProviderInstanceProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_prometheusosproviderinstanceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_prometheusosproviderinstanceproperties.go new file mode 100644 index 000000000000..8ee8c0b7ebf9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_prometheusosproviderinstanceproperties.go @@ -0,0 +1,44 @@ +package providerinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ProviderSpecificProperties = PrometheusOSProviderInstanceProperties{} + +type PrometheusOSProviderInstanceProperties struct { + PrometheusUrl *string `json:"prometheusUrl,omitempty"` + SapSid *string `json:"sapSid,omitempty"` + SslCertificateUri *string `json:"sslCertificateUri,omitempty"` + SslPreference *SslPreference `json:"sslPreference,omitempty"` + + // Fields inherited from ProviderSpecificProperties +} + +var _ json.Marshaler = PrometheusOSProviderInstanceProperties{} + +func (s PrometheusOSProviderInstanceProperties) MarshalJSON() ([]byte, error) { + type wrapper PrometheusOSProviderInstanceProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling PrometheusOSProviderInstanceProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling PrometheusOSProviderInstanceProperties: %+v", err) + } + decoded["providerType"] = "PrometheusOS" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling PrometheusOSProviderInstanceProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_providerinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_providerinstance.go new file mode 100644 index 000000000000..e11ac02adf98 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_providerinstance.go @@ -0,0 +1,18 @@ +package providerinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProviderInstance struct { + Id *string `json:"id,omitempty"` + Identity *identity.UserAssignedMap `json:"identity,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ProviderInstanceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_providerinstanceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_providerinstanceproperties.go new file mode 100644 index 000000000000..6c0320dcd9d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_providerinstanceproperties.go @@ -0,0 +1,42 @@ +package providerinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProviderInstanceProperties struct { + Errors *Error `json:"errors,omitempty"` + ProviderSettings ProviderSpecificProperties `json:"providerSettings"` + ProvisioningState *WorkloadMonitorProvisioningState `json:"provisioningState,omitempty"` +} + +var _ json.Unmarshaler = &ProviderInstanceProperties{} + +func (s *ProviderInstanceProperties) UnmarshalJSON(bytes []byte) error { + type alias ProviderInstanceProperties + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into ProviderInstanceProperties: %+v", err) + } + + s.Errors = decoded.Errors + s.ProvisioningState = decoded.ProvisioningState + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling ProviderInstanceProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["providerSettings"]; ok { + impl, err := unmarshalProviderSpecificPropertiesImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'ProviderSettings' for 'ProviderInstanceProperties': %+v", err) + } + s.ProviderSettings = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_providerspecificproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_providerspecificproperties.go new file mode 100644 index 000000000000..c436db81dadb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_providerspecificproperties.go @@ -0,0 +1,93 @@ +package providerinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProviderSpecificProperties interface { +} + +// RawProviderSpecificPropertiesImpl is returned when the Discriminated Value +// doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawProviderSpecificPropertiesImpl struct { + Type string + Values map[string]interface{} +} + +func unmarshalProviderSpecificPropertiesImplementation(input []byte) (ProviderSpecificProperties, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling ProviderSpecificProperties into map[string]interface: %+v", err) + } + + value, ok := temp["providerType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "Db2") { + var out DB2ProviderInstanceProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DB2ProviderInstanceProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "SapHana") { + var out HanaDbProviderInstanceProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into HanaDbProviderInstanceProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "MsSqlServer") { + var out MsSqlServerProviderInstanceProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into MsSqlServerProviderInstanceProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "PrometheusHaCluster") { + var out PrometheusHaClusterProviderInstanceProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into PrometheusHaClusterProviderInstanceProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "PrometheusOS") { + var out PrometheusOSProviderInstanceProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into PrometheusOSProviderInstanceProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "SapNetWeaver") { + var out SapNetWeaverProviderInstanceProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SapNetWeaverProviderInstanceProperties: %+v", err) + } + return out, nil + } + + out := RawProviderSpecificPropertiesImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_sapnetweaverproviderinstanceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_sapnetweaverproviderinstanceproperties.go new file mode 100644 index 000000000000..bb26cfe13c71 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/model_sapnetweaverproviderinstanceproperties.go @@ -0,0 +1,51 @@ +package providerinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ProviderSpecificProperties = SapNetWeaverProviderInstanceProperties{} + +type SapNetWeaverProviderInstanceProperties struct { + SapClientId *string `json:"sapClientId,omitempty"` + SapHostFileEntries *[]string `json:"sapHostFileEntries,omitempty"` + SapHostname *string `json:"sapHostname,omitempty"` + SapInstanceNr *string `json:"sapInstanceNr,omitempty"` + SapPassword *string `json:"sapPassword,omitempty"` + SapPasswordUri *string `json:"sapPasswordUri,omitempty"` + SapPortNumber *string `json:"sapPortNumber,omitempty"` + SapSid *string `json:"sapSid,omitempty"` + SapUsername *string `json:"sapUsername,omitempty"` + SslCertificateUri *string `json:"sslCertificateUri,omitempty"` + SslPreference *SslPreference `json:"sslPreference,omitempty"` + + // Fields inherited from ProviderSpecificProperties +} + +var _ json.Marshaler = SapNetWeaverProviderInstanceProperties{} + +func (s SapNetWeaverProviderInstanceProperties) MarshalJSON() ([]byte, error) { + type wrapper SapNetWeaverProviderInstanceProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SapNetWeaverProviderInstanceProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SapNetWeaverProviderInstanceProperties: %+v", err) + } + decoded["providerType"] = "SapNetWeaver" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SapNetWeaverProviderInstanceProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/predicates.go new file mode 100644 index 000000000000..b05f3ea03134 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/predicates.go @@ -0,0 +1,27 @@ +package providerinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProviderInstanceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ProviderInstanceOperationPredicate) Matches(input ProviderInstance) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/version.go new file mode 100644 index 000000000000..cdfb18cc5894 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances/version.go @@ -0,0 +1,12 @@ +package providerinstances + +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 = "2023-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/providerinstances/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/README.md new file mode 100644 index 000000000000..617b4c14d943 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances` Documentation + +The `sapapplicationserverinstances` SDK allows for interaction with the Azure Resource Manager Service `workloads` (API Version `2023-04-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/workloads/2023-04-01/sapapplicationserverinstances" +``` + + +### Client Initialization + +```go +client := sapapplicationserverinstances.NewSAPApplicationServerInstancesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SAPApplicationServerInstancesClient.Create` + +```go +ctx := context.TODO() +id := sapapplicationserverinstances.NewApplicationInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "applicationInstanceValue") + +payload := sapapplicationserverinstances.SAPApplicationServerInstance{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPApplicationServerInstancesClient.Delete` + +```go +ctx := context.TODO() +id := sapapplicationserverinstances.NewApplicationInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "applicationInstanceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPApplicationServerInstancesClient.Get` + +```go +ctx := context.TODO() +id := sapapplicationserverinstances.NewApplicationInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "applicationInstanceValue") + +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: `SAPApplicationServerInstancesClient.List` + +```go +ctx := context.TODO() +id := sapapplicationserverinstances.NewSapVirtualInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SAPApplicationServerInstancesClient.StartInstance` + +```go +ctx := context.TODO() +id := sapapplicationserverinstances.NewApplicationInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "applicationInstanceValue") + +if err := client.StartInstanceThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPApplicationServerInstancesClient.StopInstance` + +```go +ctx := context.TODO() +id := sapapplicationserverinstances.NewApplicationInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "applicationInstanceValue") + +payload := sapapplicationserverinstances.StopRequest{ + // ... +} + + +if err := client.StopInstanceThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPApplicationServerInstancesClient.Update` + +```go +ctx := context.TODO() +id := sapapplicationserverinstances.NewApplicationInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "applicationInstanceValue") + +payload := sapapplicationserverinstances.UpdateSAPApplicationInstanceRequest{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/client.go new file mode 100644 index 000000000000..e372453b8bae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/client.go @@ -0,0 +1,26 @@ +package sapapplicationserverinstances + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPApplicationServerInstancesClient struct { + Client *resourcemanager.Client +} + +func NewSAPApplicationServerInstancesClientWithBaseURI(sdkApi sdkEnv.Api) (*SAPApplicationServerInstancesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "sapapplicationserverinstances", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SAPApplicationServerInstancesClient: %+v", err) + } + + return &SAPApplicationServerInstancesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/constants.go new file mode 100644 index 000000000000..80d2298a505b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/constants.go @@ -0,0 +1,207 @@ +package sapapplicationserverinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationServerVirtualMachineType string + +const ( + ApplicationServerVirtualMachineTypeActive ApplicationServerVirtualMachineType = "Active" + ApplicationServerVirtualMachineTypeStandby ApplicationServerVirtualMachineType = "Standby" + ApplicationServerVirtualMachineTypeUnknown ApplicationServerVirtualMachineType = "Unknown" +) + +func PossibleValuesForApplicationServerVirtualMachineType() []string { + return []string{ + string(ApplicationServerVirtualMachineTypeActive), + string(ApplicationServerVirtualMachineTypeStandby), + string(ApplicationServerVirtualMachineTypeUnknown), + } +} + +func (s *ApplicationServerVirtualMachineType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApplicationServerVirtualMachineType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApplicationServerVirtualMachineType(input string) (*ApplicationServerVirtualMachineType, error) { + vals := map[string]ApplicationServerVirtualMachineType{ + "active": ApplicationServerVirtualMachineTypeActive, + "standby": ApplicationServerVirtualMachineTypeStandby, + "unknown": ApplicationServerVirtualMachineTypeUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationServerVirtualMachineType(input) + return &out, nil +} + +type SAPHealthState string + +const ( + SAPHealthStateDegraded SAPHealthState = "Degraded" + SAPHealthStateHealthy SAPHealthState = "Healthy" + SAPHealthStateUnhealthy SAPHealthState = "Unhealthy" + SAPHealthStateUnknown SAPHealthState = "Unknown" +) + +func PossibleValuesForSAPHealthState() []string { + return []string{ + string(SAPHealthStateDegraded), + string(SAPHealthStateHealthy), + string(SAPHealthStateUnhealthy), + string(SAPHealthStateUnknown), + } +} + +func (s *SAPHealthState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPHealthState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPHealthState(input string) (*SAPHealthState, error) { + vals := map[string]SAPHealthState{ + "degraded": SAPHealthStateDegraded, + "healthy": SAPHealthStateHealthy, + "unhealthy": SAPHealthStateUnhealthy, + "unknown": SAPHealthStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPHealthState(input) + return &out, nil +} + +type SAPVirtualInstanceStatus string + +const ( + SAPVirtualInstanceStatusOffline SAPVirtualInstanceStatus = "Offline" + SAPVirtualInstanceStatusPartiallyRunning SAPVirtualInstanceStatus = "PartiallyRunning" + SAPVirtualInstanceStatusRunning SAPVirtualInstanceStatus = "Running" + SAPVirtualInstanceStatusSoftShutdown SAPVirtualInstanceStatus = "SoftShutdown" + SAPVirtualInstanceStatusStarting SAPVirtualInstanceStatus = "Starting" + SAPVirtualInstanceStatusStopping SAPVirtualInstanceStatus = "Stopping" + SAPVirtualInstanceStatusUnavailable SAPVirtualInstanceStatus = "Unavailable" +) + +func PossibleValuesForSAPVirtualInstanceStatus() []string { + return []string{ + string(SAPVirtualInstanceStatusOffline), + string(SAPVirtualInstanceStatusPartiallyRunning), + string(SAPVirtualInstanceStatusRunning), + string(SAPVirtualInstanceStatusSoftShutdown), + string(SAPVirtualInstanceStatusStarting), + string(SAPVirtualInstanceStatusStopping), + string(SAPVirtualInstanceStatusUnavailable), + } +} + +func (s *SAPVirtualInstanceStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPVirtualInstanceStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPVirtualInstanceStatus(input string) (*SAPVirtualInstanceStatus, error) { + vals := map[string]SAPVirtualInstanceStatus{ + "offline": SAPVirtualInstanceStatusOffline, + "partiallyrunning": SAPVirtualInstanceStatusPartiallyRunning, + "running": SAPVirtualInstanceStatusRunning, + "softshutdown": SAPVirtualInstanceStatusSoftShutdown, + "starting": SAPVirtualInstanceStatusStarting, + "stopping": SAPVirtualInstanceStatusStopping, + "unavailable": SAPVirtualInstanceStatusUnavailable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPVirtualInstanceStatus(input) + return &out, nil +} + +type SapVirtualInstanceProvisioningState string + +const ( + SapVirtualInstanceProvisioningStateCreating SapVirtualInstanceProvisioningState = "Creating" + SapVirtualInstanceProvisioningStateDeleting SapVirtualInstanceProvisioningState = "Deleting" + SapVirtualInstanceProvisioningStateFailed SapVirtualInstanceProvisioningState = "Failed" + SapVirtualInstanceProvisioningStateSucceeded SapVirtualInstanceProvisioningState = "Succeeded" + SapVirtualInstanceProvisioningStateUpdating SapVirtualInstanceProvisioningState = "Updating" +) + +func PossibleValuesForSapVirtualInstanceProvisioningState() []string { + return []string{ + string(SapVirtualInstanceProvisioningStateCreating), + string(SapVirtualInstanceProvisioningStateDeleting), + string(SapVirtualInstanceProvisioningStateFailed), + string(SapVirtualInstanceProvisioningStateSucceeded), + string(SapVirtualInstanceProvisioningStateUpdating), + } +} + +func (s *SapVirtualInstanceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSapVirtualInstanceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSapVirtualInstanceProvisioningState(input string) (*SapVirtualInstanceProvisioningState, error) { + vals := map[string]SapVirtualInstanceProvisioningState{ + "creating": SapVirtualInstanceProvisioningStateCreating, + "deleting": SapVirtualInstanceProvisioningStateDeleting, + "failed": SapVirtualInstanceProvisioningStateFailed, + "succeeded": SapVirtualInstanceProvisioningStateSucceeded, + "updating": SapVirtualInstanceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SapVirtualInstanceProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_applicationinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_applicationinstance.go new file mode 100644 index 000000000000..107f89447ae2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_applicationinstance.go @@ -0,0 +1,134 @@ +package sapapplicationserverinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ApplicationInstanceId{} + +// ApplicationInstanceId is a struct representing the Resource ID for a Application Instance +type ApplicationInstanceId struct { + SubscriptionId string + ResourceGroupName string + SapVirtualInstanceName string + ApplicationInstanceName string +} + +// NewApplicationInstanceID returns a new ApplicationInstanceId struct +func NewApplicationInstanceID(subscriptionId string, resourceGroupName string, sapVirtualInstanceName string, applicationInstanceName string) ApplicationInstanceId { + return ApplicationInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SapVirtualInstanceName: sapVirtualInstanceName, + ApplicationInstanceName: applicationInstanceName, + } +} + +// ParseApplicationInstanceID parses 'input' into a ApplicationInstanceId +func ParseApplicationInstanceID(input string) (*ApplicationInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApplicationInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApplicationInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseApplicationInstanceIDInsensitively parses 'input' case-insensitively into a ApplicationInstanceId +// note: this method should only be used for API response data and not user input +func ParseApplicationInstanceIDInsensitively(input string) (*ApplicationInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApplicationInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApplicationInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) + } + + if id.ApplicationInstanceName, ok = input.Parsed["applicationInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationInstanceName", input) + } + + return nil +} + +// ValidateApplicationInstanceID checks that 'input' can be parsed as a Application Instance ID +func ValidateApplicationInstanceID(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 := ParseApplicationInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application Instance ID +func (id ApplicationInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Workloads/sapVirtualInstances/%s/applicationInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SapVirtualInstanceName, id.ApplicationInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application Instance ID +func (id ApplicationInstanceId) 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("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticSapVirtualInstances", "sapVirtualInstances", "sapVirtualInstances"), + resourceids.UserSpecifiedSegment("sapVirtualInstanceName", "sapVirtualInstanceValue"), + resourceids.StaticSegment("staticApplicationInstances", "applicationInstances", "applicationInstances"), + resourceids.UserSpecifiedSegment("applicationInstanceName", "applicationInstanceValue"), + } +} + +// String returns a human-readable description of this Application Instance ID +func (id ApplicationInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Sap Virtual Instance Name: %q", id.SapVirtualInstanceName), + fmt.Sprintf("Application Instance Name: %q", id.ApplicationInstanceName), + } + return fmt.Sprintf("Application Instance (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_sapvirtualinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_sapvirtualinstance.go new file mode 100644 index 000000000000..1b4bcea90dc7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_sapvirtualinstance.go @@ -0,0 +1,125 @@ +package sapapplicationserverinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &SapVirtualInstanceId{} + +// SapVirtualInstanceId is a struct representing the Resource ID for a Sap Virtual Instance +type SapVirtualInstanceId struct { + SubscriptionId string + ResourceGroupName string + SapVirtualInstanceName string +} + +// NewSapVirtualInstanceID returns a new SapVirtualInstanceId struct +func NewSapVirtualInstanceID(subscriptionId string, resourceGroupName string, sapVirtualInstanceName string) SapVirtualInstanceId { + return SapVirtualInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SapVirtualInstanceName: sapVirtualInstanceName, + } +} + +// ParseSapVirtualInstanceID parses 'input' into a SapVirtualInstanceId +func ParseSapVirtualInstanceID(input string) (*SapVirtualInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&SapVirtualInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSapVirtualInstanceIDInsensitively parses 'input' case-insensitively into a SapVirtualInstanceId +// note: this method should only be used for API response data and not user input +func ParseSapVirtualInstanceIDInsensitively(input string) (*SapVirtualInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&SapVirtualInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SapVirtualInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) + } + + return nil +} + +// ValidateSapVirtualInstanceID checks that 'input' can be parsed as a Sap Virtual Instance ID +func ValidateSapVirtualInstanceID(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 := ParseSapVirtualInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sap Virtual Instance ID +func (id SapVirtualInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Workloads/sapVirtualInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SapVirtualInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sap Virtual Instance ID +func (id SapVirtualInstanceId) 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("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticSapVirtualInstances", "sapVirtualInstances", "sapVirtualInstances"), + resourceids.UserSpecifiedSegment("sapVirtualInstanceName", "sapVirtualInstanceValue"), + } +} + +// String returns a human-readable description of this Sap Virtual Instance ID +func (id SapVirtualInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Sap Virtual Instance Name: %q", id.SapVirtualInstanceName), + } + return fmt.Sprintf("Sap Virtual Instance (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_create.go new file mode 100644 index 000000000000..ab1f8b5ee768 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_create.go @@ -0,0 +1,75 @@ +package sapapplicationserverinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *SAPApplicationServerInstance +} + +// Create ... +func (c SAPApplicationServerInstancesClient) Create(ctx context.Context, id ApplicationInstanceId, input SAPApplicationServerInstance) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c SAPApplicationServerInstancesClient) CreateThenPoll(ctx context.Context, id ApplicationInstanceId, input SAPApplicationServerInstance) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_delete.go new file mode 100644 index 000000000000..ef13443a7244 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_delete.go @@ -0,0 +1,72 @@ +package sapapplicationserverinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// Delete ... +func (c SAPApplicationServerInstancesClient) Delete(ctx context.Context, id ApplicationInstanceId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SAPApplicationServerInstancesClient) DeleteThenPoll(ctx context.Context, id ApplicationInstanceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_get.go new file mode 100644 index 000000000000..206f642660d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_get.go @@ -0,0 +1,54 @@ +package sapapplicationserverinstances + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SAPApplicationServerInstance +} + +// Get ... +func (c SAPApplicationServerInstancesClient) Get(ctx context.Context, id ApplicationInstanceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SAPApplicationServerInstance + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_list.go new file mode 100644 index 000000000000..ff4232505b33 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_list.go @@ -0,0 +1,91 @@ +package sapapplicationserverinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SAPApplicationServerInstance +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []SAPApplicationServerInstance +} + +// List ... +func (c SAPApplicationServerInstancesClient) List(ctx context.Context, id SapVirtualInstanceId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/applicationInstances", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SAPApplicationServerInstance `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c SAPApplicationServerInstancesClient) ListComplete(ctx context.Context, id SapVirtualInstanceId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, SAPApplicationServerInstanceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SAPApplicationServerInstancesClient) ListCompleteMatchingPredicate(ctx context.Context, id SapVirtualInstanceId, predicate SAPApplicationServerInstanceOperationPredicate) (result ListCompleteResult, err error) { + items := make([]SAPApplicationServerInstance, 0) + + resp, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_startinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_startinstance.go new file mode 100644 index 000000000000..c6592c0aca07 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_startinstance.go @@ -0,0 +1,71 @@ +package sapapplicationserverinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartInstanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// StartInstance ... +func (c SAPApplicationServerInstancesClient) StartInstance(ctx context.Context, id ApplicationInstanceId) (result StartInstanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StartInstanceThenPoll performs StartInstance then polls until it's completed +func (c SAPApplicationServerInstancesClient) StartInstanceThenPoll(ctx context.Context, id ApplicationInstanceId) error { + result, err := c.StartInstance(ctx, id) + if err != nil { + return fmt.Errorf("performing StartInstance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after StartInstance: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_stopinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_stopinstance.go new file mode 100644 index 000000000000..464abe88a132 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_stopinstance.go @@ -0,0 +1,75 @@ +package sapapplicationserverinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopInstanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// StopInstance ... +func (c SAPApplicationServerInstancesClient) StopInstance(ctx context.Context, id ApplicationInstanceId, input StopRequest) (result StopInstanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StopInstanceThenPoll performs StopInstance then polls until it's completed +func (c SAPApplicationServerInstancesClient) StopInstanceThenPoll(ctx context.Context, id ApplicationInstanceId, input StopRequest) error { + result, err := c.StopInstance(ctx, id, input) + if err != nil { + return fmt.Errorf("performing StopInstance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after StopInstance: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_update.go new file mode 100644 index 000000000000..5dd725efcb05 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/method_update.go @@ -0,0 +1,75 @@ +package sapapplicationserverinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *SAPApplicationServerInstance +} + +// Update ... +func (c SAPApplicationServerInstancesClient) Update(ctx context.Context, id ApplicationInstanceId, input UpdateSAPApplicationInstanceRequest) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c SAPApplicationServerInstancesClient) UpdateThenPoll(ctx context.Context, id ApplicationInstanceId, input UpdateSAPApplicationInstanceRequest) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_applicationservervmdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_applicationservervmdetails.go new file mode 100644 index 000000000000..b726103087ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_applicationservervmdetails.go @@ -0,0 +1,10 @@ +package sapapplicationserverinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationServerVMDetails struct { + StorageDetails *[]StorageInformation `json:"storageDetails,omitempty"` + Type *ApplicationServerVirtualMachineType `json:"type,omitempty"` + VirtualMachineId *string `json:"virtualMachineId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_erroradditionalinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_erroradditionalinfo.go new file mode 100644 index 000000000000..0e481e26494c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package sapapplicationserverinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_errordefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_errordefinition.go new file mode 100644 index 000000000000..46aaa86d6cc5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_errordefinition.go @@ -0,0 +1,10 @@ +package sapapplicationserverinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDefinition struct { + Code *string `json:"code,omitempty"` + Details *[]ErrorDefinition `json:"details,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_errordetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_errordetail.go new file mode 100644 index 000000000000..1c96d28f14e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_errordetail.go @@ -0,0 +1,12 @@ +package sapapplicationserverinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDetail struct { + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_loadbalancerdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_loadbalancerdetails.go new file mode 100644 index 000000000000..3ff21a98118c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_loadbalancerdetails.go @@ -0,0 +1,8 @@ +package sapapplicationserverinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadBalancerDetails struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_operationstatusresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_operationstatusresult.go new file mode 100644 index 000000000000..b72d45ffa76d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_operationstatusresult.go @@ -0,0 +1,45 @@ +package sapapplicationserverinstances + +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 OperationStatusResult struct { + EndTime *string `json:"endTime,omitempty"` + Error *ErrorDetail `json:"error,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Operations *[]OperationStatusResult `json:"operations,omitempty"` + PercentComplete *float64 `json:"percentComplete,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status string `json:"status"` +} + +func (o *OperationStatusResult) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *OperationStatusResult) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_sapapplicationserverinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_sapapplicationserverinstance.go new file mode 100644 index 000000000000..a3837fdd73de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_sapapplicationserverinstance.go @@ -0,0 +1,18 @@ +package sapapplicationserverinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPApplicationServerInstance struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SAPApplicationServerProperties `json:"properties,omitempty"` + SystemData *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/workloads/2023-04-01/sapapplicationserverinstances/model_sapapplicationserverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_sapapplicationserverproperties.go new file mode 100644 index 000000000000..c12a484cea1d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_sapapplicationserverproperties.go @@ -0,0 +1,22 @@ +package sapapplicationserverinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPApplicationServerProperties struct { + Errors *SAPVirtualInstanceError `json:"errors,omitempty"` + GatewayPort *int64 `json:"gatewayPort,omitempty"` + Health *SAPHealthState `json:"health,omitempty"` + Hostname *string `json:"hostname,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + IcmHTTPPort *int64 `json:"icmHttpPort,omitempty"` + IcmHTTPSPort *int64 `json:"icmHttpsPort,omitempty"` + InstanceNo *string `json:"instanceNo,omitempty"` + KernelPatch *string `json:"kernelPatch,omitempty"` + KernelVersion *string `json:"kernelVersion,omitempty"` + LoadBalancerDetails *LoadBalancerDetails `json:"loadBalancerDetails,omitempty"` + ProvisioningState *SapVirtualInstanceProvisioningState `json:"provisioningState,omitempty"` + Status *SAPVirtualInstanceStatus `json:"status,omitempty"` + Subnet *string `json:"subnet,omitempty"` + VMDetails *[]ApplicationServerVMDetails `json:"vmDetails,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_sapvirtualinstanceerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_sapvirtualinstanceerror.go new file mode 100644 index 000000000000..079f2c6a94df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_sapvirtualinstanceerror.go @@ -0,0 +1,8 @@ +package sapapplicationserverinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPVirtualInstanceError struct { + Properties *ErrorDefinition `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_stoprequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_stoprequest.go new file mode 100644 index 000000000000..8cca664f4d82 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_stoprequest.go @@ -0,0 +1,8 @@ +package sapapplicationserverinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopRequest struct { + SoftStopTimeoutSeconds *int64 `json:"softStopTimeoutSeconds,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_storageinformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_storageinformation.go new file mode 100644 index 000000000000..c4b5853f8d75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_storageinformation.go @@ -0,0 +1,8 @@ +package sapapplicationserverinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageInformation struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_updatesapapplicationinstancerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_updatesapapplicationinstancerequest.go new file mode 100644 index 000000000000..47841304c980 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/model_updatesapapplicationinstancerequest.go @@ -0,0 +1,8 @@ +package sapapplicationserverinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSAPApplicationInstanceRequest struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/predicates.go new file mode 100644 index 000000000000..29caee9a23cc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/predicates.go @@ -0,0 +1,32 @@ +package sapapplicationserverinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPApplicationServerInstanceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SAPApplicationServerInstanceOperationPredicate) Matches(input SAPApplicationServerInstance) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/version.go new file mode 100644 index 000000000000..09c849d2626d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/version.go @@ -0,0 +1,12 @@ +package sapapplicationserverinstances + +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 = "2023-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sapapplicationserverinstances/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/README.md new file mode 100644 index 000000000000..f5a2d5119dc8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/README.md @@ -0,0 +1,41 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails` Documentation + +The `sapavailabilityzonedetails` SDK allows for interaction with the Azure Resource Manager Service `workloads` (API Version `2023-04-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/workloads/2023-04-01/sapavailabilityzonedetails" +``` + + +### Client Initialization + +```go +client := sapavailabilityzonedetails.NewSAPAvailabilityZoneDetailsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SAPAvailabilityZoneDetailsClient.SAPAvailabilityZoneDetails` + +```go +ctx := context.TODO() +id := sapavailabilityzonedetails.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +payload := sapavailabilityzonedetails.SAPAvailabilityZoneDetailsRequest{ + // ... +} + + +read, err := client.SAPAvailabilityZoneDetails(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/client.go new file mode 100644 index 000000000000..f3e01b03d447 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/client.go @@ -0,0 +1,26 @@ +package sapavailabilityzonedetails + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPAvailabilityZoneDetailsClient struct { + Client *resourcemanager.Client +} + +func NewSAPAvailabilityZoneDetailsClientWithBaseURI(sdkApi sdkEnv.Api) (*SAPAvailabilityZoneDetailsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "sapavailabilityzonedetails", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SAPAvailabilityZoneDetailsClient: %+v", err) + } + + return &SAPAvailabilityZoneDetailsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/constants.go new file mode 100644 index 000000000000..f2b98d50bbf5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/constants.go @@ -0,0 +1,95 @@ +package sapavailabilityzonedetails + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDatabaseType string + +const ( + SAPDatabaseTypeDBTwo SAPDatabaseType = "DB2" + SAPDatabaseTypeHANA SAPDatabaseType = "HANA" +) + +func PossibleValuesForSAPDatabaseType() []string { + return []string{ + string(SAPDatabaseTypeDBTwo), + string(SAPDatabaseTypeHANA), + } +} + +func (s *SAPDatabaseType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPDatabaseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPDatabaseType(input string) (*SAPDatabaseType, error) { + vals := map[string]SAPDatabaseType{ + "db2": SAPDatabaseTypeDBTwo, + "hana": SAPDatabaseTypeHANA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPDatabaseType(input) + return &out, nil +} + +type SAPProductType string + +const ( + SAPProductTypeECC SAPProductType = "ECC" + SAPProductTypeOther SAPProductType = "Other" + SAPProductTypeSFourHANA SAPProductType = "S4HANA" +) + +func PossibleValuesForSAPProductType() []string { + return []string{ + string(SAPProductTypeECC), + string(SAPProductTypeOther), + string(SAPProductTypeSFourHANA), + } +} + +func (s *SAPProductType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPProductType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPProductType(input string) (*SAPProductType, error) { + vals := map[string]SAPProductType{ + "ecc": SAPProductTypeECC, + "other": SAPProductTypeOther, + "s4hana": SAPProductTypeSFourHANA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPProductType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/id_location.go new file mode 100644 index 000000000000..b0f5a74ab600 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/id_location.go @@ -0,0 +1,116 @@ +package sapavailabilityzonedetails + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(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 := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Workloads/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/method_sapavailabilityzonedetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/method_sapavailabilityzonedetails.go new file mode 100644 index 000000000000..0f7595f67fad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/method_sapavailabilityzonedetails.go @@ -0,0 +1,59 @@ +package sapavailabilityzonedetails + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPAvailabilityZoneDetailsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SAPAvailabilityZoneDetailsResult +} + +// SAPAvailabilityZoneDetails ... +func (c SAPAvailabilityZoneDetailsClient) SAPAvailabilityZoneDetails(ctx context.Context, id LocationId, input SAPAvailabilityZoneDetailsRequest) (result SAPAvailabilityZoneDetailsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SAPAvailabilityZoneDetailsResult + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/model_sapavailabilityzonedetailsrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/model_sapavailabilityzonedetailsrequest.go new file mode 100644 index 000000000000..cca634f46ad2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/model_sapavailabilityzonedetailsrequest.go @@ -0,0 +1,10 @@ +package sapavailabilityzonedetails + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPAvailabilityZoneDetailsRequest struct { + AppLocation string `json:"appLocation"` + DatabaseType SAPDatabaseType `json:"databaseType"` + SapProduct SAPProductType `json:"sapProduct"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/model_sapavailabilityzonedetailsresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/model_sapavailabilityzonedetailsresult.go new file mode 100644 index 000000000000..c9a1f13e66a8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/model_sapavailabilityzonedetailsresult.go @@ -0,0 +1,8 @@ +package sapavailabilityzonedetails + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPAvailabilityZoneDetailsResult struct { + AvailabilityZonePairs *[]SAPAvailabilityZonePair `json:"availabilityZonePairs,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/model_sapavailabilityzonepair.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/model_sapavailabilityzonepair.go new file mode 100644 index 000000000000..7850db487d42 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/model_sapavailabilityzonepair.go @@ -0,0 +1,9 @@ +package sapavailabilityzonedetails + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPAvailabilityZonePair struct { + ZoneA *int64 `json:"zoneA,omitempty"` + ZoneB *int64 `json:"zoneB,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/version.go new file mode 100644 index 000000000000..5250751b0147 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/version.go @@ -0,0 +1,12 @@ +package sapavailabilityzonedetails + +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 = "2023-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sapavailabilityzonedetails/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/README.md new file mode 100644 index 000000000000..e03f00632519 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances` Documentation + +The `sapcentralinstances` SDK allows for interaction with the Azure Resource Manager Service `workloads` (API Version `2023-04-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/workloads/2023-04-01/sapcentralinstances" +``` + + +### Client Initialization + +```go +client := sapcentralinstances.NewSAPCentralInstancesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SAPCentralInstancesClient.Create` + +```go +ctx := context.TODO() +id := sapcentralinstances.NewCentralInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "centralInstanceValue") + +payload := sapcentralinstances.SAPCentralServerInstance{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPCentralInstancesClient.Delete` + +```go +ctx := context.TODO() +id := sapcentralinstances.NewCentralInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "centralInstanceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPCentralInstancesClient.Get` + +```go +ctx := context.TODO() +id := sapcentralinstances.NewCentralInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "centralInstanceValue") + +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: `SAPCentralInstancesClient.List` + +```go +ctx := context.TODO() +id := sapcentralinstances.NewSapVirtualInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SAPCentralInstancesClient.StartInstance` + +```go +ctx := context.TODO() +id := sapcentralinstances.NewCentralInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "centralInstanceValue") + +if err := client.StartInstanceThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPCentralInstancesClient.StopInstance` + +```go +ctx := context.TODO() +id := sapcentralinstances.NewCentralInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "centralInstanceValue") + +payload := sapcentralinstances.StopRequest{ + // ... +} + + +if err := client.StopInstanceThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPCentralInstancesClient.Update` + +```go +ctx := context.TODO() +id := sapcentralinstances.NewCentralInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "centralInstanceValue") + +payload := sapcentralinstances.UpdateSAPCentralInstanceRequest{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/client.go new file mode 100644 index 000000000000..82698cd1887d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/client.go @@ -0,0 +1,26 @@ +package sapcentralinstances + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPCentralInstancesClient struct { + Client *resourcemanager.Client +} + +func NewSAPCentralInstancesClientWithBaseURI(sdkApi sdkEnv.Api) (*SAPCentralInstancesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "sapcentralinstances", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SAPCentralInstancesClient: %+v", err) + } + + return &SAPCentralInstancesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/constants.go new file mode 100644 index 000000000000..cebda41218a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/constants.go @@ -0,0 +1,260 @@ +package sapcentralinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CentralServerVirtualMachineType string + +const ( + CentralServerVirtualMachineTypeASCS CentralServerVirtualMachineType = "ASCS" + CentralServerVirtualMachineTypeERS CentralServerVirtualMachineType = "ERS" + CentralServerVirtualMachineTypeERSInactive CentralServerVirtualMachineType = "ERSInactive" + CentralServerVirtualMachineTypePrimary CentralServerVirtualMachineType = "Primary" + CentralServerVirtualMachineTypeSecondary CentralServerVirtualMachineType = "Secondary" + CentralServerVirtualMachineTypeStandby CentralServerVirtualMachineType = "Standby" + CentralServerVirtualMachineTypeUnknown CentralServerVirtualMachineType = "Unknown" +) + +func PossibleValuesForCentralServerVirtualMachineType() []string { + return []string{ + string(CentralServerVirtualMachineTypeASCS), + string(CentralServerVirtualMachineTypeERS), + string(CentralServerVirtualMachineTypeERSInactive), + string(CentralServerVirtualMachineTypePrimary), + string(CentralServerVirtualMachineTypeSecondary), + string(CentralServerVirtualMachineTypeStandby), + string(CentralServerVirtualMachineTypeUnknown), + } +} + +func (s *CentralServerVirtualMachineType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCentralServerVirtualMachineType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCentralServerVirtualMachineType(input string) (*CentralServerVirtualMachineType, error) { + vals := map[string]CentralServerVirtualMachineType{ + "ascs": CentralServerVirtualMachineTypeASCS, + "ers": CentralServerVirtualMachineTypeERS, + "ersinactive": CentralServerVirtualMachineTypeERSInactive, + "primary": CentralServerVirtualMachineTypePrimary, + "secondary": CentralServerVirtualMachineTypeSecondary, + "standby": CentralServerVirtualMachineTypeStandby, + "unknown": CentralServerVirtualMachineTypeUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CentralServerVirtualMachineType(input) + return &out, nil +} + +type EnqueueReplicationServerType string + +const ( + EnqueueReplicationServerTypeEnqueueReplicatorOne EnqueueReplicationServerType = "EnqueueReplicator1" + EnqueueReplicationServerTypeEnqueueReplicatorTwo EnqueueReplicationServerType = "EnqueueReplicator2" +) + +func PossibleValuesForEnqueueReplicationServerType() []string { + return []string{ + string(EnqueueReplicationServerTypeEnqueueReplicatorOne), + string(EnqueueReplicationServerTypeEnqueueReplicatorTwo), + } +} + +func (s *EnqueueReplicationServerType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEnqueueReplicationServerType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEnqueueReplicationServerType(input string) (*EnqueueReplicationServerType, error) { + vals := map[string]EnqueueReplicationServerType{ + "enqueuereplicator1": EnqueueReplicationServerTypeEnqueueReplicatorOne, + "enqueuereplicator2": EnqueueReplicationServerTypeEnqueueReplicatorTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnqueueReplicationServerType(input) + return &out, nil +} + +type SAPHealthState string + +const ( + SAPHealthStateDegraded SAPHealthState = "Degraded" + SAPHealthStateHealthy SAPHealthState = "Healthy" + SAPHealthStateUnhealthy SAPHealthState = "Unhealthy" + SAPHealthStateUnknown SAPHealthState = "Unknown" +) + +func PossibleValuesForSAPHealthState() []string { + return []string{ + string(SAPHealthStateDegraded), + string(SAPHealthStateHealthy), + string(SAPHealthStateUnhealthy), + string(SAPHealthStateUnknown), + } +} + +func (s *SAPHealthState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPHealthState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPHealthState(input string) (*SAPHealthState, error) { + vals := map[string]SAPHealthState{ + "degraded": SAPHealthStateDegraded, + "healthy": SAPHealthStateHealthy, + "unhealthy": SAPHealthStateUnhealthy, + "unknown": SAPHealthStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPHealthState(input) + return &out, nil +} + +type SAPVirtualInstanceStatus string + +const ( + SAPVirtualInstanceStatusOffline SAPVirtualInstanceStatus = "Offline" + SAPVirtualInstanceStatusPartiallyRunning SAPVirtualInstanceStatus = "PartiallyRunning" + SAPVirtualInstanceStatusRunning SAPVirtualInstanceStatus = "Running" + SAPVirtualInstanceStatusSoftShutdown SAPVirtualInstanceStatus = "SoftShutdown" + SAPVirtualInstanceStatusStarting SAPVirtualInstanceStatus = "Starting" + SAPVirtualInstanceStatusStopping SAPVirtualInstanceStatus = "Stopping" + SAPVirtualInstanceStatusUnavailable SAPVirtualInstanceStatus = "Unavailable" +) + +func PossibleValuesForSAPVirtualInstanceStatus() []string { + return []string{ + string(SAPVirtualInstanceStatusOffline), + string(SAPVirtualInstanceStatusPartiallyRunning), + string(SAPVirtualInstanceStatusRunning), + string(SAPVirtualInstanceStatusSoftShutdown), + string(SAPVirtualInstanceStatusStarting), + string(SAPVirtualInstanceStatusStopping), + string(SAPVirtualInstanceStatusUnavailable), + } +} + +func (s *SAPVirtualInstanceStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPVirtualInstanceStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPVirtualInstanceStatus(input string) (*SAPVirtualInstanceStatus, error) { + vals := map[string]SAPVirtualInstanceStatus{ + "offline": SAPVirtualInstanceStatusOffline, + "partiallyrunning": SAPVirtualInstanceStatusPartiallyRunning, + "running": SAPVirtualInstanceStatusRunning, + "softshutdown": SAPVirtualInstanceStatusSoftShutdown, + "starting": SAPVirtualInstanceStatusStarting, + "stopping": SAPVirtualInstanceStatusStopping, + "unavailable": SAPVirtualInstanceStatusUnavailable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPVirtualInstanceStatus(input) + return &out, nil +} + +type SapVirtualInstanceProvisioningState string + +const ( + SapVirtualInstanceProvisioningStateCreating SapVirtualInstanceProvisioningState = "Creating" + SapVirtualInstanceProvisioningStateDeleting SapVirtualInstanceProvisioningState = "Deleting" + SapVirtualInstanceProvisioningStateFailed SapVirtualInstanceProvisioningState = "Failed" + SapVirtualInstanceProvisioningStateSucceeded SapVirtualInstanceProvisioningState = "Succeeded" + SapVirtualInstanceProvisioningStateUpdating SapVirtualInstanceProvisioningState = "Updating" +) + +func PossibleValuesForSapVirtualInstanceProvisioningState() []string { + return []string{ + string(SapVirtualInstanceProvisioningStateCreating), + string(SapVirtualInstanceProvisioningStateDeleting), + string(SapVirtualInstanceProvisioningStateFailed), + string(SapVirtualInstanceProvisioningStateSucceeded), + string(SapVirtualInstanceProvisioningStateUpdating), + } +} + +func (s *SapVirtualInstanceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSapVirtualInstanceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSapVirtualInstanceProvisioningState(input string) (*SapVirtualInstanceProvisioningState, error) { + vals := map[string]SapVirtualInstanceProvisioningState{ + "creating": SapVirtualInstanceProvisioningStateCreating, + "deleting": SapVirtualInstanceProvisioningStateDeleting, + "failed": SapVirtualInstanceProvisioningStateFailed, + "succeeded": SapVirtualInstanceProvisioningStateSucceeded, + "updating": SapVirtualInstanceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SapVirtualInstanceProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/id_centralinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/id_centralinstance.go new file mode 100644 index 000000000000..e31f9d21c6a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/id_centralinstance.go @@ -0,0 +1,134 @@ +package sapcentralinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &CentralInstanceId{} + +// CentralInstanceId is a struct representing the Resource ID for a Central Instance +type CentralInstanceId struct { + SubscriptionId string + ResourceGroupName string + SapVirtualInstanceName string + CentralInstanceName string +} + +// NewCentralInstanceID returns a new CentralInstanceId struct +func NewCentralInstanceID(subscriptionId string, resourceGroupName string, sapVirtualInstanceName string, centralInstanceName string) CentralInstanceId { + return CentralInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SapVirtualInstanceName: sapVirtualInstanceName, + CentralInstanceName: centralInstanceName, + } +} + +// ParseCentralInstanceID parses 'input' into a CentralInstanceId +func ParseCentralInstanceID(input string) (*CentralInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&CentralInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CentralInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCentralInstanceIDInsensitively parses 'input' case-insensitively into a CentralInstanceId +// note: this method should only be used for API response data and not user input +func ParseCentralInstanceIDInsensitively(input string) (*CentralInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&CentralInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CentralInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CentralInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) + } + + if id.CentralInstanceName, ok = input.Parsed["centralInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "centralInstanceName", input) + } + + return nil +} + +// ValidateCentralInstanceID checks that 'input' can be parsed as a Central Instance ID +func ValidateCentralInstanceID(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 := ParseCentralInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Central Instance ID +func (id CentralInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Workloads/sapVirtualInstances/%s/centralInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SapVirtualInstanceName, id.CentralInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Central Instance ID +func (id CentralInstanceId) 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("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticSapVirtualInstances", "sapVirtualInstances", "sapVirtualInstances"), + resourceids.UserSpecifiedSegment("sapVirtualInstanceName", "sapVirtualInstanceValue"), + resourceids.StaticSegment("staticCentralInstances", "centralInstances", "centralInstances"), + resourceids.UserSpecifiedSegment("centralInstanceName", "centralInstanceValue"), + } +} + +// String returns a human-readable description of this Central Instance ID +func (id CentralInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Sap Virtual Instance Name: %q", id.SapVirtualInstanceName), + fmt.Sprintf("Central Instance Name: %q", id.CentralInstanceName), + } + return fmt.Sprintf("Central Instance (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/id_sapvirtualinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/id_sapvirtualinstance.go new file mode 100644 index 000000000000..560571748dac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/id_sapvirtualinstance.go @@ -0,0 +1,125 @@ +package sapcentralinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &SapVirtualInstanceId{} + +// SapVirtualInstanceId is a struct representing the Resource ID for a Sap Virtual Instance +type SapVirtualInstanceId struct { + SubscriptionId string + ResourceGroupName string + SapVirtualInstanceName string +} + +// NewSapVirtualInstanceID returns a new SapVirtualInstanceId struct +func NewSapVirtualInstanceID(subscriptionId string, resourceGroupName string, sapVirtualInstanceName string) SapVirtualInstanceId { + return SapVirtualInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SapVirtualInstanceName: sapVirtualInstanceName, + } +} + +// ParseSapVirtualInstanceID parses 'input' into a SapVirtualInstanceId +func ParseSapVirtualInstanceID(input string) (*SapVirtualInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&SapVirtualInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSapVirtualInstanceIDInsensitively parses 'input' case-insensitively into a SapVirtualInstanceId +// note: this method should only be used for API response data and not user input +func ParseSapVirtualInstanceIDInsensitively(input string) (*SapVirtualInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&SapVirtualInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SapVirtualInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) + } + + return nil +} + +// ValidateSapVirtualInstanceID checks that 'input' can be parsed as a Sap Virtual Instance ID +func ValidateSapVirtualInstanceID(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 := ParseSapVirtualInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sap Virtual Instance ID +func (id SapVirtualInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Workloads/sapVirtualInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SapVirtualInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sap Virtual Instance ID +func (id SapVirtualInstanceId) 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("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticSapVirtualInstances", "sapVirtualInstances", "sapVirtualInstances"), + resourceids.UserSpecifiedSegment("sapVirtualInstanceName", "sapVirtualInstanceValue"), + } +} + +// String returns a human-readable description of this Sap Virtual Instance ID +func (id SapVirtualInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Sap Virtual Instance Name: %q", id.SapVirtualInstanceName), + } + return fmt.Sprintf("Sap Virtual Instance (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_create.go new file mode 100644 index 000000000000..ead8c69f74ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_create.go @@ -0,0 +1,75 @@ +package sapcentralinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *SAPCentralServerInstance +} + +// Create ... +func (c SAPCentralInstancesClient) Create(ctx context.Context, id CentralInstanceId, input SAPCentralServerInstance) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c SAPCentralInstancesClient) CreateThenPoll(ctx context.Context, id CentralInstanceId, input SAPCentralServerInstance) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_delete.go new file mode 100644 index 000000000000..9b9a05df6e65 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_delete.go @@ -0,0 +1,72 @@ +package sapcentralinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// Delete ... +func (c SAPCentralInstancesClient) Delete(ctx context.Context, id CentralInstanceId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SAPCentralInstancesClient) DeleteThenPoll(ctx context.Context, id CentralInstanceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_get.go new file mode 100644 index 000000000000..51b2b250780f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_get.go @@ -0,0 +1,54 @@ +package sapcentralinstances + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SAPCentralServerInstance +} + +// Get ... +func (c SAPCentralInstancesClient) Get(ctx context.Context, id CentralInstanceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SAPCentralServerInstance + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_list.go new file mode 100644 index 000000000000..756164c35d3e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_list.go @@ -0,0 +1,91 @@ +package sapcentralinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SAPCentralServerInstance +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []SAPCentralServerInstance +} + +// List ... +func (c SAPCentralInstancesClient) List(ctx context.Context, id SapVirtualInstanceId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/centralInstances", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SAPCentralServerInstance `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c SAPCentralInstancesClient) ListComplete(ctx context.Context, id SapVirtualInstanceId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, SAPCentralServerInstanceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SAPCentralInstancesClient) ListCompleteMatchingPredicate(ctx context.Context, id SapVirtualInstanceId, predicate SAPCentralServerInstanceOperationPredicate) (result ListCompleteResult, err error) { + items := make([]SAPCentralServerInstance, 0) + + resp, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_startinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_startinstance.go new file mode 100644 index 000000000000..d6ce7e69f4ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_startinstance.go @@ -0,0 +1,71 @@ +package sapcentralinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartInstanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// StartInstance ... +func (c SAPCentralInstancesClient) StartInstance(ctx context.Context, id CentralInstanceId) (result StartInstanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StartInstanceThenPoll performs StartInstance then polls until it's completed +func (c SAPCentralInstancesClient) StartInstanceThenPoll(ctx context.Context, id CentralInstanceId) error { + result, err := c.StartInstance(ctx, id) + if err != nil { + return fmt.Errorf("performing StartInstance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after StartInstance: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_stopinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_stopinstance.go new file mode 100644 index 000000000000..3003077f6471 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_stopinstance.go @@ -0,0 +1,75 @@ +package sapcentralinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopInstanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// StopInstance ... +func (c SAPCentralInstancesClient) StopInstance(ctx context.Context, id CentralInstanceId, input StopRequest) (result StopInstanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StopInstanceThenPoll performs StopInstance then polls until it's completed +func (c SAPCentralInstancesClient) StopInstanceThenPoll(ctx context.Context, id CentralInstanceId, input StopRequest) error { + result, err := c.StopInstance(ctx, id, input) + if err != nil { + return fmt.Errorf("performing StopInstance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after StopInstance: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_update.go new file mode 100644 index 000000000000..e09f15562eff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/method_update.go @@ -0,0 +1,75 @@ +package sapcentralinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *SAPCentralServerInstance +} + +// Update ... +func (c SAPCentralInstancesClient) Update(ctx context.Context, id CentralInstanceId, input UpdateSAPCentralInstanceRequest) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c SAPCentralInstancesClient) UpdateThenPoll(ctx context.Context, id CentralInstanceId, input UpdateSAPCentralInstanceRequest) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_centralservervmdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_centralservervmdetails.go new file mode 100644 index 000000000000..5c025fdfb178 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_centralservervmdetails.go @@ -0,0 +1,10 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CentralServerVMDetails struct { + StorageDetails *[]StorageInformation `json:"storageDetails,omitempty"` + Type *CentralServerVirtualMachineType `json:"type,omitempty"` + VirtualMachineId *string `json:"virtualMachineId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_enqueuereplicationserverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_enqueuereplicationserverproperties.go new file mode 100644 index 000000000000..70050aafb2a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_enqueuereplicationserverproperties.go @@ -0,0 +1,14 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnqueueReplicationServerProperties struct { + ErsVersion *EnqueueReplicationServerType `json:"ersVersion,omitempty"` + Health *SAPHealthState `json:"health,omitempty"` + Hostname *string `json:"hostname,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + InstanceNo *string `json:"instanceNo,omitempty"` + KernelPatch *string `json:"kernelPatch,omitempty"` + KernelVersion *string `json:"kernelVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_enqueueserverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_enqueueserverproperties.go new file mode 100644 index 000000000000..0a917b9f2b10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_enqueueserverproperties.go @@ -0,0 +1,11 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnqueueServerProperties struct { + Health *SAPHealthState `json:"health,omitempty"` + Hostname *string `json:"hostname,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + Port *int64 `json:"port,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_erroradditionalinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_erroradditionalinfo.go new file mode 100644 index 000000000000..f5763a445f3d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_errordefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_errordefinition.go new file mode 100644 index 000000000000..5d0fc634dc86 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_errordefinition.go @@ -0,0 +1,10 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDefinition struct { + Code *string `json:"code,omitempty"` + Details *[]ErrorDefinition `json:"details,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_errordetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_errordetail.go new file mode 100644 index 000000000000..872e9feefda5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_errordetail.go @@ -0,0 +1,12 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDetail struct { + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_gatewayserverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_gatewayserverproperties.go new file mode 100644 index 000000000000..23b1fa7bf8d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_gatewayserverproperties.go @@ -0,0 +1,9 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayServerProperties struct { + Health *SAPHealthState `json:"health,omitempty"` + Port *int64 `json:"port,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_loadbalancerdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_loadbalancerdetails.go new file mode 100644 index 000000000000..7e3db806cfad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_loadbalancerdetails.go @@ -0,0 +1,8 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadBalancerDetails struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_messageserverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_messageserverproperties.go new file mode 100644 index 000000000000..61d1f603c17d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_messageserverproperties.go @@ -0,0 +1,14 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MessageServerProperties struct { + HTTPPort *int64 `json:"httpPort,omitempty"` + HTTPSPort *int64 `json:"httpsPort,omitempty"` + Health *SAPHealthState `json:"health,omitempty"` + Hostname *string `json:"hostname,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + InternalMsPort *int64 `json:"internalMsPort,omitempty"` + MsPort *int64 `json:"msPort,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_operationstatusresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_operationstatusresult.go new file mode 100644 index 000000000000..d2d4e72967ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_operationstatusresult.go @@ -0,0 +1,45 @@ +package sapcentralinstances + +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 OperationStatusResult struct { + EndTime *string `json:"endTime,omitempty"` + Error *ErrorDetail `json:"error,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Operations *[]OperationStatusResult `json:"operations,omitempty"` + PercentComplete *float64 `json:"percentComplete,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status string `json:"status"` +} + +func (o *OperationStatusResult) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *OperationStatusResult) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_sapcentralserverinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_sapcentralserverinstance.go new file mode 100644 index 000000000000..f6afd4bd5d7f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_sapcentralserverinstance.go @@ -0,0 +1,18 @@ +package sapcentralinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPCentralServerInstance struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SAPCentralServerProperties `json:"properties,omitempty"` + SystemData *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/workloads/2023-04-01/sapcentralinstances/model_sapcentralserverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_sapcentralserverproperties.go new file mode 100644 index 000000000000..c8560f49b4fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_sapcentralserverproperties.go @@ -0,0 +1,21 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPCentralServerProperties struct { + EnqueueReplicationServerProperties *EnqueueReplicationServerProperties `json:"enqueueReplicationServerProperties,omitempty"` + EnqueueServerProperties *EnqueueServerProperties `json:"enqueueServerProperties,omitempty"` + Errors *SAPVirtualInstanceError `json:"errors,omitempty"` + GatewayServerProperties *GatewayServerProperties `json:"gatewayServerProperties,omitempty"` + Health *SAPHealthState `json:"health,omitempty"` + InstanceNo *string `json:"instanceNo,omitempty"` + KernelPatch *string `json:"kernelPatch,omitempty"` + KernelVersion *string `json:"kernelVersion,omitempty"` + LoadBalancerDetails *LoadBalancerDetails `json:"loadBalancerDetails,omitempty"` + MessageServerProperties *MessageServerProperties `json:"messageServerProperties,omitempty"` + ProvisioningState *SapVirtualInstanceProvisioningState `json:"provisioningState,omitempty"` + Status *SAPVirtualInstanceStatus `json:"status,omitempty"` + Subnet *string `json:"subnet,omitempty"` + VMDetails *[]CentralServerVMDetails `json:"vmDetails,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_sapvirtualinstanceerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_sapvirtualinstanceerror.go new file mode 100644 index 000000000000..d354c442c04f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_sapvirtualinstanceerror.go @@ -0,0 +1,8 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPVirtualInstanceError struct { + Properties *ErrorDefinition `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_stoprequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_stoprequest.go new file mode 100644 index 000000000000..51e4f6822de5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_stoprequest.go @@ -0,0 +1,8 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopRequest struct { + SoftStopTimeoutSeconds *int64 `json:"softStopTimeoutSeconds,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_storageinformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_storageinformation.go new file mode 100644 index 000000000000..52ea8093b8f6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_storageinformation.go @@ -0,0 +1,8 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageInformation struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_updatesapcentralinstancerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_updatesapcentralinstancerequest.go new file mode 100644 index 000000000000..e8745421ba94 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/model_updatesapcentralinstancerequest.go @@ -0,0 +1,8 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSAPCentralInstanceRequest struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/predicates.go new file mode 100644 index 000000000000..aff085e2e4a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/predicates.go @@ -0,0 +1,32 @@ +package sapcentralinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPCentralServerInstanceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SAPCentralServerInstanceOperationPredicate) Matches(input SAPCentralServerInstance) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/version.go new file mode 100644 index 000000000000..83ee8f7f4d6d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances/version.go @@ -0,0 +1,12 @@ +package sapcentralinstances + +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 = "2023-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sapcentralinstances/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/README.md new file mode 100644 index 000000000000..34301df01092 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances` Documentation + +The `sapdatabaseinstances` SDK allows for interaction with the Azure Resource Manager Service `workloads` (API Version `2023-04-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/workloads/2023-04-01/sapdatabaseinstances" +``` + + +### Client Initialization + +```go +client := sapdatabaseinstances.NewSAPDatabaseInstancesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SAPDatabaseInstancesClient.Create` + +```go +ctx := context.TODO() +id := sapdatabaseinstances.NewDatabaseInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "databaseInstanceValue") + +payload := sapdatabaseinstances.SAPDatabaseInstance{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPDatabaseInstancesClient.Delete` + +```go +ctx := context.TODO() +id := sapdatabaseinstances.NewDatabaseInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "databaseInstanceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPDatabaseInstancesClient.Get` + +```go +ctx := context.TODO() +id := sapdatabaseinstances.NewDatabaseInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "databaseInstanceValue") + +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: `SAPDatabaseInstancesClient.List` + +```go +ctx := context.TODO() +id := sapdatabaseinstances.NewSapVirtualInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SAPDatabaseInstancesClient.StartInstance` + +```go +ctx := context.TODO() +id := sapdatabaseinstances.NewDatabaseInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "databaseInstanceValue") + +if err := client.StartInstanceThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPDatabaseInstancesClient.StopInstance` + +```go +ctx := context.TODO() +id := sapdatabaseinstances.NewDatabaseInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "databaseInstanceValue") + +payload := sapdatabaseinstances.StopRequest{ + // ... +} + + +if err := client.StopInstanceThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPDatabaseInstancesClient.Update` + +```go +ctx := context.TODO() +id := sapdatabaseinstances.NewDatabaseInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue", "databaseInstanceValue") + +payload := sapdatabaseinstances.UpdateSAPDatabaseInstanceRequest{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/client.go new file mode 100644 index 000000000000..aa0ae88d4cc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/client.go @@ -0,0 +1,26 @@ +package sapdatabaseinstances + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDatabaseInstancesClient struct { + Client *resourcemanager.Client +} + +func NewSAPDatabaseInstancesClientWithBaseURI(sdkApi sdkEnv.Api) (*SAPDatabaseInstancesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "sapdatabaseinstances", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SAPDatabaseInstancesClient: %+v", err) + } + + return &SAPDatabaseInstancesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/constants.go new file mode 100644 index 000000000000..d07a0528f9e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/constants.go @@ -0,0 +1,116 @@ +package sapdatabaseinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPVirtualInstanceStatus string + +const ( + SAPVirtualInstanceStatusOffline SAPVirtualInstanceStatus = "Offline" + SAPVirtualInstanceStatusPartiallyRunning SAPVirtualInstanceStatus = "PartiallyRunning" + SAPVirtualInstanceStatusRunning SAPVirtualInstanceStatus = "Running" + SAPVirtualInstanceStatusSoftShutdown SAPVirtualInstanceStatus = "SoftShutdown" + SAPVirtualInstanceStatusStarting SAPVirtualInstanceStatus = "Starting" + SAPVirtualInstanceStatusStopping SAPVirtualInstanceStatus = "Stopping" + SAPVirtualInstanceStatusUnavailable SAPVirtualInstanceStatus = "Unavailable" +) + +func PossibleValuesForSAPVirtualInstanceStatus() []string { + return []string{ + string(SAPVirtualInstanceStatusOffline), + string(SAPVirtualInstanceStatusPartiallyRunning), + string(SAPVirtualInstanceStatusRunning), + string(SAPVirtualInstanceStatusSoftShutdown), + string(SAPVirtualInstanceStatusStarting), + string(SAPVirtualInstanceStatusStopping), + string(SAPVirtualInstanceStatusUnavailable), + } +} + +func (s *SAPVirtualInstanceStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPVirtualInstanceStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPVirtualInstanceStatus(input string) (*SAPVirtualInstanceStatus, error) { + vals := map[string]SAPVirtualInstanceStatus{ + "offline": SAPVirtualInstanceStatusOffline, + "partiallyrunning": SAPVirtualInstanceStatusPartiallyRunning, + "running": SAPVirtualInstanceStatusRunning, + "softshutdown": SAPVirtualInstanceStatusSoftShutdown, + "starting": SAPVirtualInstanceStatusStarting, + "stopping": SAPVirtualInstanceStatusStopping, + "unavailable": SAPVirtualInstanceStatusUnavailable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPVirtualInstanceStatus(input) + return &out, nil +} + +type SapVirtualInstanceProvisioningState string + +const ( + SapVirtualInstanceProvisioningStateCreating SapVirtualInstanceProvisioningState = "Creating" + SapVirtualInstanceProvisioningStateDeleting SapVirtualInstanceProvisioningState = "Deleting" + SapVirtualInstanceProvisioningStateFailed SapVirtualInstanceProvisioningState = "Failed" + SapVirtualInstanceProvisioningStateSucceeded SapVirtualInstanceProvisioningState = "Succeeded" + SapVirtualInstanceProvisioningStateUpdating SapVirtualInstanceProvisioningState = "Updating" +) + +func PossibleValuesForSapVirtualInstanceProvisioningState() []string { + return []string{ + string(SapVirtualInstanceProvisioningStateCreating), + string(SapVirtualInstanceProvisioningStateDeleting), + string(SapVirtualInstanceProvisioningStateFailed), + string(SapVirtualInstanceProvisioningStateSucceeded), + string(SapVirtualInstanceProvisioningStateUpdating), + } +} + +func (s *SapVirtualInstanceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSapVirtualInstanceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSapVirtualInstanceProvisioningState(input string) (*SapVirtualInstanceProvisioningState, error) { + vals := map[string]SapVirtualInstanceProvisioningState{ + "creating": SapVirtualInstanceProvisioningStateCreating, + "deleting": SapVirtualInstanceProvisioningStateDeleting, + "failed": SapVirtualInstanceProvisioningStateFailed, + "succeeded": SapVirtualInstanceProvisioningStateSucceeded, + "updating": SapVirtualInstanceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SapVirtualInstanceProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_databaseinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_databaseinstance.go new file mode 100644 index 000000000000..75e06feb8743 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_databaseinstance.go @@ -0,0 +1,134 @@ +package sapdatabaseinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &DatabaseInstanceId{} + +// DatabaseInstanceId is a struct representing the Resource ID for a Database Instance +type DatabaseInstanceId struct { + SubscriptionId string + ResourceGroupName string + SapVirtualInstanceName string + DatabaseInstanceName string +} + +// NewDatabaseInstanceID returns a new DatabaseInstanceId struct +func NewDatabaseInstanceID(subscriptionId string, resourceGroupName string, sapVirtualInstanceName string, databaseInstanceName string) DatabaseInstanceId { + return DatabaseInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SapVirtualInstanceName: sapVirtualInstanceName, + DatabaseInstanceName: databaseInstanceName, + } +} + +// ParseDatabaseInstanceID parses 'input' into a DatabaseInstanceId +func ParseDatabaseInstanceID(input string) (*DatabaseInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&DatabaseInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DatabaseInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDatabaseInstanceIDInsensitively parses 'input' case-insensitively into a DatabaseInstanceId +// note: this method should only be used for API response data and not user input +func ParseDatabaseInstanceIDInsensitively(input string) (*DatabaseInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&DatabaseInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DatabaseInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) + } + + if id.DatabaseInstanceName, ok = input.Parsed["databaseInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseInstanceName", input) + } + + return nil +} + +// ValidateDatabaseInstanceID checks that 'input' can be parsed as a Database Instance ID +func ValidateDatabaseInstanceID(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 := ParseDatabaseInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database Instance ID +func (id DatabaseInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Workloads/sapVirtualInstances/%s/databaseInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SapVirtualInstanceName, id.DatabaseInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database Instance ID +func (id DatabaseInstanceId) 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("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticSapVirtualInstances", "sapVirtualInstances", "sapVirtualInstances"), + resourceids.UserSpecifiedSegment("sapVirtualInstanceName", "sapVirtualInstanceValue"), + resourceids.StaticSegment("staticDatabaseInstances", "databaseInstances", "databaseInstances"), + resourceids.UserSpecifiedSegment("databaseInstanceName", "databaseInstanceValue"), + } +} + +// String returns a human-readable description of this Database Instance ID +func (id DatabaseInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Sap Virtual Instance Name: %q", id.SapVirtualInstanceName), + fmt.Sprintf("Database Instance Name: %q", id.DatabaseInstanceName), + } + return fmt.Sprintf("Database Instance (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_sapvirtualinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_sapvirtualinstance.go new file mode 100644 index 000000000000..21c8f676f8db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_sapvirtualinstance.go @@ -0,0 +1,125 @@ +package sapdatabaseinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &SapVirtualInstanceId{} + +// SapVirtualInstanceId is a struct representing the Resource ID for a Sap Virtual Instance +type SapVirtualInstanceId struct { + SubscriptionId string + ResourceGroupName string + SapVirtualInstanceName string +} + +// NewSapVirtualInstanceID returns a new SapVirtualInstanceId struct +func NewSapVirtualInstanceID(subscriptionId string, resourceGroupName string, sapVirtualInstanceName string) SapVirtualInstanceId { + return SapVirtualInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SapVirtualInstanceName: sapVirtualInstanceName, + } +} + +// ParseSapVirtualInstanceID parses 'input' into a SapVirtualInstanceId +func ParseSapVirtualInstanceID(input string) (*SapVirtualInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&SapVirtualInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSapVirtualInstanceIDInsensitively parses 'input' case-insensitively into a SapVirtualInstanceId +// note: this method should only be used for API response data and not user input +func ParseSapVirtualInstanceIDInsensitively(input string) (*SapVirtualInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&SapVirtualInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SapVirtualInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) + } + + return nil +} + +// ValidateSapVirtualInstanceID checks that 'input' can be parsed as a Sap Virtual Instance ID +func ValidateSapVirtualInstanceID(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 := ParseSapVirtualInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sap Virtual Instance ID +func (id SapVirtualInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Workloads/sapVirtualInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SapVirtualInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sap Virtual Instance ID +func (id SapVirtualInstanceId) 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("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticSapVirtualInstances", "sapVirtualInstances", "sapVirtualInstances"), + resourceids.UserSpecifiedSegment("sapVirtualInstanceName", "sapVirtualInstanceValue"), + } +} + +// String returns a human-readable description of this Sap Virtual Instance ID +func (id SapVirtualInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Sap Virtual Instance Name: %q", id.SapVirtualInstanceName), + } + return fmt.Sprintf("Sap Virtual Instance (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_create.go new file mode 100644 index 000000000000..7317badba24f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_create.go @@ -0,0 +1,75 @@ +package sapdatabaseinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *SAPDatabaseInstance +} + +// Create ... +func (c SAPDatabaseInstancesClient) Create(ctx context.Context, id DatabaseInstanceId, input SAPDatabaseInstance) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c SAPDatabaseInstancesClient) CreateThenPoll(ctx context.Context, id DatabaseInstanceId, input SAPDatabaseInstance) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_delete.go new file mode 100644 index 000000000000..57646fe19424 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_delete.go @@ -0,0 +1,72 @@ +package sapdatabaseinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// Delete ... +func (c SAPDatabaseInstancesClient) Delete(ctx context.Context, id DatabaseInstanceId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SAPDatabaseInstancesClient) DeleteThenPoll(ctx context.Context, id DatabaseInstanceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_get.go new file mode 100644 index 000000000000..f10920fbb71a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_get.go @@ -0,0 +1,54 @@ +package sapdatabaseinstances + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SAPDatabaseInstance +} + +// Get ... +func (c SAPDatabaseInstancesClient) Get(ctx context.Context, id DatabaseInstanceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SAPDatabaseInstance + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_list.go new file mode 100644 index 000000000000..fec2710c3fa3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_list.go @@ -0,0 +1,91 @@ +package sapdatabaseinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SAPDatabaseInstance +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []SAPDatabaseInstance +} + +// List ... +func (c SAPDatabaseInstancesClient) List(ctx context.Context, id SapVirtualInstanceId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/databaseInstances", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SAPDatabaseInstance `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c SAPDatabaseInstancesClient) ListComplete(ctx context.Context, id SapVirtualInstanceId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, SAPDatabaseInstanceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SAPDatabaseInstancesClient) ListCompleteMatchingPredicate(ctx context.Context, id SapVirtualInstanceId, predicate SAPDatabaseInstanceOperationPredicate) (result ListCompleteResult, err error) { + items := make([]SAPDatabaseInstance, 0) + + resp, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_startinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_startinstance.go new file mode 100644 index 000000000000..3b29ead68883 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_startinstance.go @@ -0,0 +1,71 @@ +package sapdatabaseinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartInstanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// StartInstance ... +func (c SAPDatabaseInstancesClient) StartInstance(ctx context.Context, id DatabaseInstanceId) (result StartInstanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StartInstanceThenPoll performs StartInstance then polls until it's completed +func (c SAPDatabaseInstancesClient) StartInstanceThenPoll(ctx context.Context, id DatabaseInstanceId) error { + result, err := c.StartInstance(ctx, id) + if err != nil { + return fmt.Errorf("performing StartInstance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after StartInstance: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_stopinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_stopinstance.go new file mode 100644 index 000000000000..304e43bd7ceb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_stopinstance.go @@ -0,0 +1,75 @@ +package sapdatabaseinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopInstanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// StopInstance ... +func (c SAPDatabaseInstancesClient) StopInstance(ctx context.Context, id DatabaseInstanceId, input StopRequest) (result StopInstanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StopInstanceThenPoll performs StopInstance then polls until it's completed +func (c SAPDatabaseInstancesClient) StopInstanceThenPoll(ctx context.Context, id DatabaseInstanceId, input StopRequest) error { + result, err := c.StopInstance(ctx, id, input) + if err != nil { + return fmt.Errorf("performing StopInstance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after StopInstance: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_update.go new file mode 100644 index 000000000000..222290a6b8fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/method_update.go @@ -0,0 +1,75 @@ +package sapdatabaseinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *SAPDatabaseInstance +} + +// Update ... +func (c SAPDatabaseInstancesClient) Update(ctx context.Context, id DatabaseInstanceId, input UpdateSAPDatabaseInstanceRequest) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c SAPDatabaseInstancesClient) UpdateThenPoll(ctx context.Context, id DatabaseInstanceId, input UpdateSAPDatabaseInstanceRequest) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_databasevmdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_databasevmdetails.go new file mode 100644 index 000000000000..61f23878c824 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_databasevmdetails.go @@ -0,0 +1,10 @@ +package sapdatabaseinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseVMDetails struct { + Status *SAPVirtualInstanceStatus `json:"status,omitempty"` + StorageDetails *[]StorageInformation `json:"storageDetails,omitempty"` + VirtualMachineId *string `json:"virtualMachineId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_erroradditionalinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_erroradditionalinfo.go new file mode 100644 index 000000000000..3f0ca0f13adb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package sapdatabaseinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_errordefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_errordefinition.go new file mode 100644 index 000000000000..a00104408229 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_errordefinition.go @@ -0,0 +1,10 @@ +package sapdatabaseinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDefinition struct { + Code *string `json:"code,omitempty"` + Details *[]ErrorDefinition `json:"details,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_errordetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_errordetail.go new file mode 100644 index 000000000000..109ec8b6f467 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_errordetail.go @@ -0,0 +1,12 @@ +package sapdatabaseinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDetail struct { + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_loadbalancerdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_loadbalancerdetails.go new file mode 100644 index 000000000000..c13208cd34a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_loadbalancerdetails.go @@ -0,0 +1,8 @@ +package sapdatabaseinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadBalancerDetails struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_operationstatusresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_operationstatusresult.go new file mode 100644 index 000000000000..64fc194844d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_operationstatusresult.go @@ -0,0 +1,45 @@ +package sapdatabaseinstances + +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 OperationStatusResult struct { + EndTime *string `json:"endTime,omitempty"` + Error *ErrorDetail `json:"error,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Operations *[]OperationStatusResult `json:"operations,omitempty"` + PercentComplete *float64 `json:"percentComplete,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status string `json:"status"` +} + +func (o *OperationStatusResult) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *OperationStatusResult) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_sapdatabaseinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_sapdatabaseinstance.go new file mode 100644 index 000000000000..04f0b39f6d3d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_sapdatabaseinstance.go @@ -0,0 +1,18 @@ +package sapdatabaseinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDatabaseInstance struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SAPDatabaseProperties `json:"properties,omitempty"` + SystemData *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/workloads/2023-04-01/sapdatabaseinstances/model_sapdatabaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_sapdatabaseproperties.go new file mode 100644 index 000000000000..25dd497a8697 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_sapdatabaseproperties.go @@ -0,0 +1,16 @@ +package sapdatabaseinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDatabaseProperties struct { + DatabaseSid *string `json:"databaseSid,omitempty"` + DatabaseType *string `json:"databaseType,omitempty"` + Errors *SAPVirtualInstanceError `json:"errors,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + LoadBalancerDetails *LoadBalancerDetails `json:"loadBalancerDetails,omitempty"` + ProvisioningState *SapVirtualInstanceProvisioningState `json:"provisioningState,omitempty"` + Status *SAPVirtualInstanceStatus `json:"status,omitempty"` + Subnet *string `json:"subnet,omitempty"` + VMDetails *[]DatabaseVMDetails `json:"vmDetails,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_sapvirtualinstanceerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_sapvirtualinstanceerror.go new file mode 100644 index 000000000000..016147f04937 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_sapvirtualinstanceerror.go @@ -0,0 +1,8 @@ +package sapdatabaseinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPVirtualInstanceError struct { + Properties *ErrorDefinition `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_stoprequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_stoprequest.go new file mode 100644 index 000000000000..b4c1bf57d345 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_stoprequest.go @@ -0,0 +1,8 @@ +package sapdatabaseinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopRequest struct { + SoftStopTimeoutSeconds *int64 `json:"softStopTimeoutSeconds,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_storageinformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_storageinformation.go new file mode 100644 index 000000000000..4f5182e83c08 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_storageinformation.go @@ -0,0 +1,8 @@ +package sapdatabaseinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageInformation struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_updatesapdatabaseinstancerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_updatesapdatabaseinstancerequest.go new file mode 100644 index 000000000000..31957d5bbca8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/model_updatesapdatabaseinstancerequest.go @@ -0,0 +1,8 @@ +package sapdatabaseinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSAPDatabaseInstanceRequest struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/predicates.go new file mode 100644 index 000000000000..eba9c19b470d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/predicates.go @@ -0,0 +1,32 @@ +package sapdatabaseinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDatabaseInstanceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SAPDatabaseInstanceOperationPredicate) Matches(input SAPDatabaseInstance) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/version.go new file mode 100644 index 000000000000..32c596059841 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances/version.go @@ -0,0 +1,12 @@ +package sapdatabaseinstances + +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 = "2023-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sapdatabaseinstances/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/README.md new file mode 100644 index 000000000000..5e7ce81417b7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/README.md @@ -0,0 +1,41 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations` Documentation + +The `sapdiskconfigurations` SDK allows for interaction with the Azure Resource Manager Service `workloads` (API Version `2023-04-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/workloads/2023-04-01/sapdiskconfigurations" +``` + + +### Client Initialization + +```go +client := sapdiskconfigurations.NewSAPDiskConfigurationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SAPDiskConfigurationsClient.SAPDiskConfigurations` + +```go +ctx := context.TODO() +id := sapdiskconfigurations.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +payload := sapdiskconfigurations.SAPDiskConfigurationsRequest{ + // ... +} + + +read, err := client.SAPDiskConfigurations(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/client.go new file mode 100644 index 000000000000..4f1d5dc82434 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/client.go @@ -0,0 +1,26 @@ +package sapdiskconfigurations + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDiskConfigurationsClient struct { + Client *resourcemanager.Client +} + +func NewSAPDiskConfigurationsClientWithBaseURI(sdkApi sdkEnv.Api) (*SAPDiskConfigurationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "sapdiskconfigurations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SAPDiskConfigurationsClient: %+v", err) + } + + return &SAPDiskConfigurationsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/constants.go new file mode 100644 index 000000000000..625d133ccc6c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/constants.go @@ -0,0 +1,233 @@ +package sapdiskconfigurations + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskSkuName string + +const ( + DiskSkuNamePremiumLRS DiskSkuName = "Premium_LRS" + DiskSkuNamePremiumVTwoLRS DiskSkuName = "PremiumV2_LRS" + DiskSkuNamePremiumZRS DiskSkuName = "Premium_ZRS" + DiskSkuNameStandardLRS DiskSkuName = "Standard_LRS" + DiskSkuNameStandardSSDLRS DiskSkuName = "StandardSSD_LRS" + DiskSkuNameStandardSSDZRS DiskSkuName = "StandardSSD_ZRS" + DiskSkuNameUltraSSDLRS DiskSkuName = "UltraSSD_LRS" +) + +func PossibleValuesForDiskSkuName() []string { + return []string{ + string(DiskSkuNamePremiumLRS), + string(DiskSkuNamePremiumVTwoLRS), + string(DiskSkuNamePremiumZRS), + string(DiskSkuNameStandardLRS), + string(DiskSkuNameStandardSSDLRS), + string(DiskSkuNameStandardSSDZRS), + string(DiskSkuNameUltraSSDLRS), + } +} + +func (s *DiskSkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskSkuName(input string) (*DiskSkuName, error) { + vals := map[string]DiskSkuName{ + "premium_lrs": DiskSkuNamePremiumLRS, + "premiumv2_lrs": DiskSkuNamePremiumVTwoLRS, + "premium_zrs": DiskSkuNamePremiumZRS, + "standard_lrs": DiskSkuNameStandardLRS, + "standardssd_lrs": DiskSkuNameStandardSSDLRS, + "standardssd_zrs": DiskSkuNameStandardSSDZRS, + "ultrassd_lrs": DiskSkuNameUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskSkuName(input) + return &out, nil +} + +type SAPDatabaseType string + +const ( + SAPDatabaseTypeDBTwo SAPDatabaseType = "DB2" + SAPDatabaseTypeHANA SAPDatabaseType = "HANA" +) + +func PossibleValuesForSAPDatabaseType() []string { + return []string{ + string(SAPDatabaseTypeDBTwo), + string(SAPDatabaseTypeHANA), + } +} + +func (s *SAPDatabaseType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPDatabaseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPDatabaseType(input string) (*SAPDatabaseType, error) { + vals := map[string]SAPDatabaseType{ + "db2": SAPDatabaseTypeDBTwo, + "hana": SAPDatabaseTypeHANA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPDatabaseType(input) + return &out, nil +} + +type SAPDeploymentType string + +const ( + SAPDeploymentTypeSingleServer SAPDeploymentType = "SingleServer" + SAPDeploymentTypeThreeTier SAPDeploymentType = "ThreeTier" +) + +func PossibleValuesForSAPDeploymentType() []string { + return []string{ + string(SAPDeploymentTypeSingleServer), + string(SAPDeploymentTypeThreeTier), + } +} + +func (s *SAPDeploymentType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPDeploymentType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPDeploymentType(input string) (*SAPDeploymentType, error) { + vals := map[string]SAPDeploymentType{ + "singleserver": SAPDeploymentTypeSingleServer, + "threetier": SAPDeploymentTypeThreeTier, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPDeploymentType(input) + return &out, nil +} + +type SAPEnvironmentType string + +const ( + SAPEnvironmentTypeNonProd SAPEnvironmentType = "NonProd" + SAPEnvironmentTypeProd SAPEnvironmentType = "Prod" +) + +func PossibleValuesForSAPEnvironmentType() []string { + return []string{ + string(SAPEnvironmentTypeNonProd), + string(SAPEnvironmentTypeProd), + } +} + +func (s *SAPEnvironmentType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPEnvironmentType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPEnvironmentType(input string) (*SAPEnvironmentType, error) { + vals := map[string]SAPEnvironmentType{ + "nonprod": SAPEnvironmentTypeNonProd, + "prod": SAPEnvironmentTypeProd, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPEnvironmentType(input) + return &out, nil +} + +type SAPProductType string + +const ( + SAPProductTypeECC SAPProductType = "ECC" + SAPProductTypeOther SAPProductType = "Other" + SAPProductTypeSFourHANA SAPProductType = "S4HANA" +) + +func PossibleValuesForSAPProductType() []string { + return []string{ + string(SAPProductTypeECC), + string(SAPProductTypeOther), + string(SAPProductTypeSFourHANA), + } +} + +func (s *SAPProductType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPProductType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPProductType(input string) (*SAPProductType, error) { + vals := map[string]SAPProductType{ + "ecc": SAPProductTypeECC, + "other": SAPProductTypeOther, + "s4hana": SAPProductTypeSFourHANA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPProductType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/id_location.go new file mode 100644 index 000000000000..d736416b9386 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/id_location.go @@ -0,0 +1,116 @@ +package sapdiskconfigurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(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 := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Workloads/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/method_sapdiskconfigurations.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/method_sapdiskconfigurations.go new file mode 100644 index 000000000000..85d25b1c6236 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/method_sapdiskconfigurations.go @@ -0,0 +1,59 @@ +package sapdiskconfigurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDiskConfigurationsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SAPDiskConfigurationsResult +} + +// SAPDiskConfigurations ... +func (c SAPDiskConfigurationsClient) SAPDiskConfigurations(ctx context.Context, id LocationId, input SAPDiskConfigurationsRequest) (result SAPDiskConfigurationsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/sapVirtualInstanceMetadata/default/getDiskConfigurations", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SAPDiskConfigurationsResult + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_diskdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_diskdetails.go new file mode 100644 index 000000000000..560a85c84f73 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_diskdetails.go @@ -0,0 +1,14 @@ +package sapdiskconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskDetails struct { + DiskTier *string `json:"diskTier,omitempty"` + IopsReadWrite *int64 `json:"iopsReadWrite,omitempty"` + MaximumSupportedDiskCount *int64 `json:"maximumSupportedDiskCount,omitempty"` + MbpsReadWrite *int64 `json:"mbpsReadWrite,omitempty"` + MinimumSupportedDiskCount *int64 `json:"minimumSupportedDiskCount,omitempty"` + SizeGB *int64 `json:"sizeGB,omitempty"` + Sku *DiskSku `json:"sku,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_disksku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_disksku.go new file mode 100644 index 000000000000..980b36dd3285 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_disksku.go @@ -0,0 +1,8 @@ +package sapdiskconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskSku struct { + Name *DiskSkuName `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_diskvolumeconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_diskvolumeconfiguration.go new file mode 100644 index 000000000000..0416245e3f95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_diskvolumeconfiguration.go @@ -0,0 +1,10 @@ +package sapdiskconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskVolumeConfiguration struct { + Count *int64 `json:"count,omitempty"` + SizeGB *int64 `json:"sizeGB,omitempty"` + Sku *DiskSku `json:"sku,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_sapdiskconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_sapdiskconfiguration.go new file mode 100644 index 000000000000..9af96aabfd39 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_sapdiskconfiguration.go @@ -0,0 +1,9 @@ +package sapdiskconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDiskConfiguration struct { + RecommendedConfiguration *DiskVolumeConfiguration `json:"recommendedConfiguration,omitempty"` + SupportedConfigurations *[]DiskDetails `json:"supportedConfigurations,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_sapdiskconfigurationsrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_sapdiskconfigurationsrequest.go new file mode 100644 index 000000000000..5ef2ae1229ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_sapdiskconfigurationsrequest.go @@ -0,0 +1,13 @@ +package sapdiskconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDiskConfigurationsRequest struct { + AppLocation string `json:"appLocation"` + DatabaseType SAPDatabaseType `json:"databaseType"` + DbVMSku string `json:"dbVmSku"` + DeploymentType SAPDeploymentType `json:"deploymentType"` + Environment SAPEnvironmentType `json:"environment"` + SapProduct SAPProductType `json:"sapProduct"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_sapdiskconfigurationsresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_sapdiskconfigurationsresult.go new file mode 100644 index 000000000000..be6ff548ebe3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/model_sapdiskconfigurationsresult.go @@ -0,0 +1,8 @@ +package sapdiskconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDiskConfigurationsResult struct { + VolumeConfigurations *map[string]SAPDiskConfiguration `json:"volumeConfigurations,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/version.go new file mode 100644 index 000000000000..93987390c170 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations/version.go @@ -0,0 +1,12 @@ +package sapdiskconfigurations + +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 = "2023-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sapdiskconfigurations/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/README.md new file mode 100644 index 000000000000..4df82c805269 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor` Documentation + +The `saplandscapemonitor` SDK allows for interaction with the Azure Resource Manager Service `workloads` (API Version `2023-04-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/workloads/2023-04-01/saplandscapemonitor" +``` + + +### Client Initialization + +```go +client := saplandscapemonitor.NewSapLandscapeMonitorClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SapLandscapeMonitorClient.Create` + +```go +ctx := context.TODO() +id := saplandscapemonitor.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +payload := saplandscapemonitor.SapLandscapeMonitor{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SapLandscapeMonitorClient.Delete` + +```go +ctx := context.TODO() +id := saplandscapemonitor.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +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: `SapLandscapeMonitorClient.Get` + +```go +ctx := context.TODO() +id := saplandscapemonitor.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +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: `SapLandscapeMonitorClient.List` + +```go +ctx := context.TODO() +id := saplandscapemonitor.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SapLandscapeMonitorClient.Update` + +```go +ctx := context.TODO() +id := saplandscapemonitor.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +payload := saplandscapemonitor.SapLandscapeMonitor{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/client.go new file mode 100644 index 000000000000..36dc90431720 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/client.go @@ -0,0 +1,26 @@ +package saplandscapemonitor + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SapLandscapeMonitorClient struct { + Client *resourcemanager.Client +} + +func NewSapLandscapeMonitorClientWithBaseURI(sdkApi sdkEnv.Api) (*SapLandscapeMonitorClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "saplandscapemonitor", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SapLandscapeMonitorClient: %+v", err) + } + + return &SapLandscapeMonitorClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/constants.go new file mode 100644 index 000000000000..b9d74ff56d5f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/constants.go @@ -0,0 +1,60 @@ +package saplandscapemonitor + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SapLandscapeMonitorProvisioningState string + +const ( + SapLandscapeMonitorProvisioningStateAccepted SapLandscapeMonitorProvisioningState = "Accepted" + SapLandscapeMonitorProvisioningStateCanceled SapLandscapeMonitorProvisioningState = "Canceled" + SapLandscapeMonitorProvisioningStateCreated SapLandscapeMonitorProvisioningState = "Created" + SapLandscapeMonitorProvisioningStateFailed SapLandscapeMonitorProvisioningState = "Failed" + SapLandscapeMonitorProvisioningStateSucceeded SapLandscapeMonitorProvisioningState = "Succeeded" +) + +func PossibleValuesForSapLandscapeMonitorProvisioningState() []string { + return []string{ + string(SapLandscapeMonitorProvisioningStateAccepted), + string(SapLandscapeMonitorProvisioningStateCanceled), + string(SapLandscapeMonitorProvisioningStateCreated), + string(SapLandscapeMonitorProvisioningStateFailed), + string(SapLandscapeMonitorProvisioningStateSucceeded), + } +} + +func (s *SapLandscapeMonitorProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSapLandscapeMonitorProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSapLandscapeMonitorProvisioningState(input string) (*SapLandscapeMonitorProvisioningState, error) { + vals := map[string]SapLandscapeMonitorProvisioningState{ + "accepted": SapLandscapeMonitorProvisioningStateAccepted, + "canceled": SapLandscapeMonitorProvisioningStateCanceled, + "created": SapLandscapeMonitorProvisioningStateCreated, + "failed": SapLandscapeMonitorProvisioningStateFailed, + "succeeded": SapLandscapeMonitorProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SapLandscapeMonitorProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/id_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/id_monitor.go new file mode 100644 index 000000000000..8a48c6c7886d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/id_monitor.go @@ -0,0 +1,125 @@ +package saplandscapemonitor + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &MonitorId{} + +// MonitorId is a struct representing the Resource ID for a Monitor +type MonitorId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string +} + +// NewMonitorID returns a new MonitorId struct +func NewMonitorID(subscriptionId string, resourceGroupName string, monitorName string) MonitorId { + return MonitorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + } +} + +// ParseMonitorID parses 'input' into a MonitorId +func ParseMonitorID(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(&MonitorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseMonitorIDInsensitively parses 'input' case-insensitively into a MonitorId +// note: this method should only be used for API response data and not user input +func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(&MonitorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MonitorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) + } + + return nil +} + +// ValidateMonitorID checks that 'input' can be parsed as a Monitor ID +func ValidateMonitorID(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 := ParseMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Monitor ID +func (id MonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Workloads/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Monitor ID +func (id MonitorId) 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("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + } +} + +// String returns a human-readable description of this Monitor ID +func (id MonitorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + } + return fmt.Sprintf("Monitor (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_create.go new file mode 100644 index 000000000000..40f00c0103b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_create.go @@ -0,0 +1,60 @@ +package saplandscapemonitor + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SapLandscapeMonitor +} + +// Create ... +func (c SapLandscapeMonitorClient) Create(ctx context.Context, id MonitorId, input SapLandscapeMonitor) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/sapLandscapeMonitor/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SapLandscapeMonitor + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_delete.go new file mode 100644 index 000000000000..c5e0dbd6ce7f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_delete.go @@ -0,0 +1,48 @@ +package saplandscapemonitor + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c SapLandscapeMonitorClient) Delete(ctx context.Context, id MonitorId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/sapLandscapeMonitor/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_get.go new file mode 100644 index 000000000000..94e551c1abd1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_get.go @@ -0,0 +1,55 @@ +package saplandscapemonitor + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SapLandscapeMonitor +} + +// Get ... +func (c SapLandscapeMonitorClient) Get(ctx context.Context, id MonitorId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/sapLandscapeMonitor/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SapLandscapeMonitor + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_list.go new file mode 100644 index 000000000000..29705018e26f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_list.go @@ -0,0 +1,91 @@ +package saplandscapemonitor + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SapLandscapeMonitor +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []SapLandscapeMonitor +} + +// List ... +func (c SapLandscapeMonitorClient) List(ctx context.Context, id MonitorId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/sapLandscapeMonitor", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SapLandscapeMonitor `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c SapLandscapeMonitorClient) ListComplete(ctx context.Context, id MonitorId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, SapLandscapeMonitorOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SapLandscapeMonitorClient) ListCompleteMatchingPredicate(ctx context.Context, id MonitorId, predicate SapLandscapeMonitorOperationPredicate) (result ListCompleteResult, err error) { + items := make([]SapLandscapeMonitor, 0) + + resp, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_update.go new file mode 100644 index 000000000000..bcb5e7387b3d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/method_update.go @@ -0,0 +1,59 @@ +package saplandscapemonitor + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SapLandscapeMonitor +} + +// Update ... +func (c SapLandscapeMonitorClient) Update(ctx context.Context, id MonitorId, input SapLandscapeMonitor) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/sapLandscapeMonitor/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SapLandscapeMonitor + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitor.go new file mode 100644 index 000000000000..4adbb5a0c748 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitor.go @@ -0,0 +1,16 @@ +package saplandscapemonitor + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SapLandscapeMonitor struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SapLandscapeMonitorProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitormetricthresholds.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitormetricthresholds.go new file mode 100644 index 000000000000..dfce3656c01f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitormetricthresholds.go @@ -0,0 +1,11 @@ +package saplandscapemonitor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SapLandscapeMonitorMetricThresholds struct { + Green *float64 `json:"green,omitempty"` + Name *string `json:"name,omitempty"` + Red *float64 `json:"red,omitempty"` + Yellow *float64 `json:"yellow,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitorproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitorproperties.go new file mode 100644 index 000000000000..6ec3a2aafea0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitorproperties.go @@ -0,0 +1,10 @@ +package saplandscapemonitor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SapLandscapeMonitorProperties struct { + Grouping *SapLandscapeMonitorPropertiesGrouping `json:"grouping,omitempty"` + ProvisioningState *SapLandscapeMonitorProvisioningState `json:"provisioningState,omitempty"` + TopMetricsThresholds *[]SapLandscapeMonitorMetricThresholds `json:"topMetricsThresholds,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitorpropertiesgrouping.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitorpropertiesgrouping.go new file mode 100644 index 000000000000..ab26dedb6cb6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitorpropertiesgrouping.go @@ -0,0 +1,9 @@ +package saplandscapemonitor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SapLandscapeMonitorPropertiesGrouping struct { + Landscape *[]SapLandscapeMonitorSidMapping `json:"landscape,omitempty"` + SapApplication *[]SapLandscapeMonitorSidMapping `json:"sapApplication,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitorsidmapping.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitorsidmapping.go new file mode 100644 index 000000000000..b0cabfc5a280 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/model_saplandscapemonitorsidmapping.go @@ -0,0 +1,9 @@ +package saplandscapemonitor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SapLandscapeMonitorSidMapping struct { + Name *string `json:"name,omitempty"` + TopSid *[]string `json:"topSid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/predicates.go new file mode 100644 index 000000000000..50d66c852f0f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/predicates.go @@ -0,0 +1,27 @@ +package saplandscapemonitor + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SapLandscapeMonitorOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SapLandscapeMonitorOperationPredicate) Matches(input SapLandscapeMonitor) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/version.go new file mode 100644 index 000000000000..d89a5f15a1d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor/version.go @@ -0,0 +1,12 @@ +package saplandscapemonitor + +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 = "2023-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/saplandscapemonitor/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/README.md new file mode 100644 index 000000000000..74564d3cd54f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/README.md @@ -0,0 +1,41 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations` Documentation + +The `saprecommendations` SDK allows for interaction with the Azure Resource Manager Service `workloads` (API Version `2023-04-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/workloads/2023-04-01/saprecommendations" +``` + + +### Client Initialization + +```go +client := saprecommendations.NewSAPRecommendationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SAPRecommendationsClient.SAPSizingRecommendations` + +```go +ctx := context.TODO() +id := saprecommendations.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +payload := saprecommendations.SAPSizingRecommendationRequest{ + // ... +} + + +read, err := client.SAPSizingRecommendations(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/client.go new file mode 100644 index 000000000000..8a1af72250fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/client.go @@ -0,0 +1,26 @@ +package saprecommendations + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPRecommendationsClient struct { + Client *resourcemanager.Client +} + +func NewSAPRecommendationsClientWithBaseURI(sdkApi sdkEnv.Api) (*SAPRecommendationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "saprecommendations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SAPRecommendationsClient: %+v", err) + } + + return &SAPRecommendationsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/constants.go new file mode 100644 index 000000000000..fd1aa9cde23a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/constants.go @@ -0,0 +1,256 @@ +package saprecommendations + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDatabaseScaleMethod string + +const ( + SAPDatabaseScaleMethodScaleUp SAPDatabaseScaleMethod = "ScaleUp" +) + +func PossibleValuesForSAPDatabaseScaleMethod() []string { + return []string{ + string(SAPDatabaseScaleMethodScaleUp), + } +} + +func (s *SAPDatabaseScaleMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPDatabaseScaleMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPDatabaseScaleMethod(input string) (*SAPDatabaseScaleMethod, error) { + vals := map[string]SAPDatabaseScaleMethod{ + "scaleup": SAPDatabaseScaleMethodScaleUp, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPDatabaseScaleMethod(input) + return &out, nil +} + +type SAPDatabaseType string + +const ( + SAPDatabaseTypeDBTwo SAPDatabaseType = "DB2" + SAPDatabaseTypeHANA SAPDatabaseType = "HANA" +) + +func PossibleValuesForSAPDatabaseType() []string { + return []string{ + string(SAPDatabaseTypeDBTwo), + string(SAPDatabaseTypeHANA), + } +} + +func (s *SAPDatabaseType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPDatabaseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPDatabaseType(input string) (*SAPDatabaseType, error) { + vals := map[string]SAPDatabaseType{ + "db2": SAPDatabaseTypeDBTwo, + "hana": SAPDatabaseTypeHANA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPDatabaseType(input) + return &out, nil +} + +type SAPDeploymentType string + +const ( + SAPDeploymentTypeSingleServer SAPDeploymentType = "SingleServer" + SAPDeploymentTypeThreeTier SAPDeploymentType = "ThreeTier" +) + +func PossibleValuesForSAPDeploymentType() []string { + return []string{ + string(SAPDeploymentTypeSingleServer), + string(SAPDeploymentTypeThreeTier), + } +} + +func (s *SAPDeploymentType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPDeploymentType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPDeploymentType(input string) (*SAPDeploymentType, error) { + vals := map[string]SAPDeploymentType{ + "singleserver": SAPDeploymentTypeSingleServer, + "threetier": SAPDeploymentTypeThreeTier, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPDeploymentType(input) + return &out, nil +} + +type SAPEnvironmentType string + +const ( + SAPEnvironmentTypeNonProd SAPEnvironmentType = "NonProd" + SAPEnvironmentTypeProd SAPEnvironmentType = "Prod" +) + +func PossibleValuesForSAPEnvironmentType() []string { + return []string{ + string(SAPEnvironmentTypeNonProd), + string(SAPEnvironmentTypeProd), + } +} + +func (s *SAPEnvironmentType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPEnvironmentType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPEnvironmentType(input string) (*SAPEnvironmentType, error) { + vals := map[string]SAPEnvironmentType{ + "nonprod": SAPEnvironmentTypeNonProd, + "prod": SAPEnvironmentTypeProd, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPEnvironmentType(input) + return &out, nil +} + +type SAPHighAvailabilityType string + +const ( + SAPHighAvailabilityTypeAvailabilitySet SAPHighAvailabilityType = "AvailabilitySet" + SAPHighAvailabilityTypeAvailabilityZone SAPHighAvailabilityType = "AvailabilityZone" +) + +func PossibleValuesForSAPHighAvailabilityType() []string { + return []string{ + string(SAPHighAvailabilityTypeAvailabilitySet), + string(SAPHighAvailabilityTypeAvailabilityZone), + } +} + +func (s *SAPHighAvailabilityType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPHighAvailabilityType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPHighAvailabilityType(input string) (*SAPHighAvailabilityType, error) { + vals := map[string]SAPHighAvailabilityType{ + "availabilityset": SAPHighAvailabilityTypeAvailabilitySet, + "availabilityzone": SAPHighAvailabilityTypeAvailabilityZone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPHighAvailabilityType(input) + return &out, nil +} + +type SAPProductType string + +const ( + SAPProductTypeECC SAPProductType = "ECC" + SAPProductTypeOther SAPProductType = "Other" + SAPProductTypeSFourHANA SAPProductType = "S4HANA" +) + +func PossibleValuesForSAPProductType() []string { + return []string{ + string(SAPProductTypeECC), + string(SAPProductTypeOther), + string(SAPProductTypeSFourHANA), + } +} + +func (s *SAPProductType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPProductType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPProductType(input string) (*SAPProductType, error) { + vals := map[string]SAPProductType{ + "ecc": SAPProductTypeECC, + "other": SAPProductTypeOther, + "s4hana": SAPProductTypeSFourHANA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPProductType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/id_location.go new file mode 100644 index 000000000000..3094f0882fb6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/id_location.go @@ -0,0 +1,116 @@ +package saprecommendations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(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 := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Workloads/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/method_sapsizingrecommendations.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/method_sapsizingrecommendations.go new file mode 100644 index 000000000000..e69cc36efa0a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/method_sapsizingrecommendations.go @@ -0,0 +1,63 @@ +package saprecommendations + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPSizingRecommendationsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SAPSizingRecommendationResult +} + +// SAPSizingRecommendations ... +func (c SAPRecommendationsClient) SAPSizingRecommendations(ctx context.Context, id LocationId, input SAPSizingRecommendationRequest) (result SAPSizingRecommendationsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/sapVirtualInstanceMetadata/default/getSizingRecommendations", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var respObj json.RawMessage + if err = resp.Unmarshal(&respObj); err != nil { + return + } + model, err := unmarshalSAPSizingRecommendationResultImplementation(respObj) + if err != nil { + return + } + result.Model = &model + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_sapsizingrecommendationrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_sapsizingrecommendationrequest.go new file mode 100644 index 000000000000..57e77ff296d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_sapsizingrecommendationrequest.go @@ -0,0 +1,16 @@ +package saprecommendations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPSizingRecommendationRequest struct { + AppLocation string `json:"appLocation"` + DatabaseType SAPDatabaseType `json:"databaseType"` + DbMemory int64 `json:"dbMemory"` + DbScaleMethod *SAPDatabaseScaleMethod `json:"dbScaleMethod,omitempty"` + DeploymentType SAPDeploymentType `json:"deploymentType"` + Environment SAPEnvironmentType `json:"environment"` + HighAvailabilityType *SAPHighAvailabilityType `json:"highAvailabilityType,omitempty"` + SapProduct SAPProductType `json:"sapProduct"` + Saps int64 `json:"saps"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_sapsizingrecommendationresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_sapsizingrecommendationresult.go new file mode 100644 index 000000000000..9aefdce8c29a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_sapsizingrecommendationresult.go @@ -0,0 +1,61 @@ +package saprecommendations + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPSizingRecommendationResult interface { +} + +// RawSAPSizingRecommendationResultImpl is returned when the Discriminated Value +// doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawSAPSizingRecommendationResultImpl struct { + Type string + Values map[string]interface{} +} + +func unmarshalSAPSizingRecommendationResultImplementation(input []byte) (SAPSizingRecommendationResult, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling SAPSizingRecommendationResult into map[string]interface: %+v", err) + } + + value, ok := temp["deploymentType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "SingleServer") { + var out SingleServerRecommendationResult + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SingleServerRecommendationResult: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ThreeTier") { + var out ThreeTierRecommendationResult + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ThreeTierRecommendationResult: %+v", err) + } + return out, nil + } + + out := RawSAPSizingRecommendationResultImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_singleserverrecommendationresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_singleserverrecommendationresult.go new file mode 100644 index 000000000000..c0b6380ad7a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_singleserverrecommendationresult.go @@ -0,0 +1,41 @@ +package saprecommendations + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SAPSizingRecommendationResult = SingleServerRecommendationResult{} + +type SingleServerRecommendationResult struct { + VMSku *string `json:"vmSku,omitempty"` + + // Fields inherited from SAPSizingRecommendationResult +} + +var _ json.Marshaler = SingleServerRecommendationResult{} + +func (s SingleServerRecommendationResult) MarshalJSON() ([]byte, error) { + type wrapper SingleServerRecommendationResult + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SingleServerRecommendationResult: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SingleServerRecommendationResult: %+v", err) + } + decoded["deploymentType"] = "SingleServer" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SingleServerRecommendationResult: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_threetierrecommendationresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_threetierrecommendationresult.go new file mode 100644 index 000000000000..27360b7cc67d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/model_threetierrecommendationresult.go @@ -0,0 +1,46 @@ +package saprecommendations + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SAPSizingRecommendationResult = ThreeTierRecommendationResult{} + +type ThreeTierRecommendationResult struct { + ApplicationServerInstanceCount *int64 `json:"applicationServerInstanceCount,omitempty"` + ApplicationServerVMSku *string `json:"applicationServerVmSku,omitempty"` + CentralServerInstanceCount *int64 `json:"centralServerInstanceCount,omitempty"` + CentralServerVMSku *string `json:"centralServerVmSku,omitempty"` + DatabaseInstanceCount *int64 `json:"databaseInstanceCount,omitempty"` + DbVMSku *string `json:"dbVmSku,omitempty"` + + // Fields inherited from SAPSizingRecommendationResult +} + +var _ json.Marshaler = ThreeTierRecommendationResult{} + +func (s ThreeTierRecommendationResult) MarshalJSON() ([]byte, error) { + type wrapper ThreeTierRecommendationResult + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ThreeTierRecommendationResult: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ThreeTierRecommendationResult: %+v", err) + } + decoded["deploymentType"] = "ThreeTier" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ThreeTierRecommendationResult: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/version.go new file mode 100644 index 000000000000..b91a7baeb518 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations/version.go @@ -0,0 +1,12 @@ +package saprecommendations + +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 = "2023-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/saprecommendations/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/README.md new file mode 100644 index 000000000000..ed1e39c26994 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/README.md @@ -0,0 +1,41 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku` Documentation + +The `sapsupportedsku` SDK allows for interaction with the Azure Resource Manager Service `workloads` (API Version `2023-04-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/workloads/2023-04-01/sapsupportedsku" +``` + + +### Client Initialization + +```go +client := sapsupportedsku.NewSAPSupportedSkuClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SAPSupportedSkuClient.SAPSupportedSku` + +```go +ctx := context.TODO() +id := sapsupportedsku.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +payload := sapsupportedsku.SAPSupportedSkusRequest{ + // ... +} + + +read, err := client.SAPSupportedSku(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/client.go new file mode 100644 index 000000000000..8011ac22b2ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/client.go @@ -0,0 +1,26 @@ +package sapsupportedsku + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPSupportedSkuClient struct { + Client *resourcemanager.Client +} + +func NewSAPSupportedSkuClientWithBaseURI(sdkApi sdkEnv.Api) (*SAPSupportedSkuClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "sapsupportedsku", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SAPSupportedSkuClient: %+v", err) + } + + return &SAPSupportedSkuClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/constants.go new file mode 100644 index 000000000000..704d4ed5870e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/constants.go @@ -0,0 +1,218 @@ +package sapsupportedsku + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPDatabaseType string + +const ( + SAPDatabaseTypeDBTwo SAPDatabaseType = "DB2" + SAPDatabaseTypeHANA SAPDatabaseType = "HANA" +) + +func PossibleValuesForSAPDatabaseType() []string { + return []string{ + string(SAPDatabaseTypeDBTwo), + string(SAPDatabaseTypeHANA), + } +} + +func (s *SAPDatabaseType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPDatabaseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPDatabaseType(input string) (*SAPDatabaseType, error) { + vals := map[string]SAPDatabaseType{ + "db2": SAPDatabaseTypeDBTwo, + "hana": SAPDatabaseTypeHANA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPDatabaseType(input) + return &out, nil +} + +type SAPDeploymentType string + +const ( + SAPDeploymentTypeSingleServer SAPDeploymentType = "SingleServer" + SAPDeploymentTypeThreeTier SAPDeploymentType = "ThreeTier" +) + +func PossibleValuesForSAPDeploymentType() []string { + return []string{ + string(SAPDeploymentTypeSingleServer), + string(SAPDeploymentTypeThreeTier), + } +} + +func (s *SAPDeploymentType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPDeploymentType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPDeploymentType(input string) (*SAPDeploymentType, error) { + vals := map[string]SAPDeploymentType{ + "singleserver": SAPDeploymentTypeSingleServer, + "threetier": SAPDeploymentTypeThreeTier, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPDeploymentType(input) + return &out, nil +} + +type SAPEnvironmentType string + +const ( + SAPEnvironmentTypeNonProd SAPEnvironmentType = "NonProd" + SAPEnvironmentTypeProd SAPEnvironmentType = "Prod" +) + +func PossibleValuesForSAPEnvironmentType() []string { + return []string{ + string(SAPEnvironmentTypeNonProd), + string(SAPEnvironmentTypeProd), + } +} + +func (s *SAPEnvironmentType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPEnvironmentType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPEnvironmentType(input string) (*SAPEnvironmentType, error) { + vals := map[string]SAPEnvironmentType{ + "nonprod": SAPEnvironmentTypeNonProd, + "prod": SAPEnvironmentTypeProd, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPEnvironmentType(input) + return &out, nil +} + +type SAPHighAvailabilityType string + +const ( + SAPHighAvailabilityTypeAvailabilitySet SAPHighAvailabilityType = "AvailabilitySet" + SAPHighAvailabilityTypeAvailabilityZone SAPHighAvailabilityType = "AvailabilityZone" +) + +func PossibleValuesForSAPHighAvailabilityType() []string { + return []string{ + string(SAPHighAvailabilityTypeAvailabilitySet), + string(SAPHighAvailabilityTypeAvailabilityZone), + } +} + +func (s *SAPHighAvailabilityType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPHighAvailabilityType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPHighAvailabilityType(input string) (*SAPHighAvailabilityType, error) { + vals := map[string]SAPHighAvailabilityType{ + "availabilityset": SAPHighAvailabilityTypeAvailabilitySet, + "availabilityzone": SAPHighAvailabilityTypeAvailabilityZone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPHighAvailabilityType(input) + return &out, nil +} + +type SAPProductType string + +const ( + SAPProductTypeECC SAPProductType = "ECC" + SAPProductTypeOther SAPProductType = "Other" + SAPProductTypeSFourHANA SAPProductType = "S4HANA" +) + +func PossibleValuesForSAPProductType() []string { + return []string{ + string(SAPProductTypeECC), + string(SAPProductTypeOther), + string(SAPProductTypeSFourHANA), + } +} + +func (s *SAPProductType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPProductType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPProductType(input string) (*SAPProductType, error) { + vals := map[string]SAPProductType{ + "ecc": SAPProductTypeECC, + "other": SAPProductTypeOther, + "s4hana": SAPProductTypeSFourHANA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPProductType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/id_location.go new file mode 100644 index 000000000000..258ff80da478 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/id_location.go @@ -0,0 +1,116 @@ +package sapsupportedsku + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(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 := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Workloads/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/method_sapsupportedsku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/method_sapsupportedsku.go new file mode 100644 index 000000000000..5be4b86862b4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/method_sapsupportedsku.go @@ -0,0 +1,59 @@ +package sapsupportedsku + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPSupportedSkuOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SAPSupportedResourceSkusResult +} + +// SAPSupportedSku ... +func (c SAPSupportedSkuClient) SAPSupportedSku(ctx context.Context, id LocationId, input SAPSupportedSkusRequest) (result SAPSupportedSkuOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/sapVirtualInstanceMetadata/default/getSapSupportedSku", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SAPSupportedResourceSkusResult + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/model_sapsupportedresourceskusresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/model_sapsupportedresourceskusresult.go new file mode 100644 index 000000000000..ae8576b148d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/model_sapsupportedresourceskusresult.go @@ -0,0 +1,8 @@ +package sapsupportedsku + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPSupportedResourceSkusResult struct { + SupportedSkus *[]SAPSupportedSku `json:"supportedSkus,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/model_sapsupportedsku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/model_sapsupportedsku.go new file mode 100644 index 000000000000..6f5ff27b191d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/model_sapsupportedsku.go @@ -0,0 +1,10 @@ +package sapsupportedsku + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPSupportedSku struct { + IsAppServerCertified *bool `json:"isAppServerCertified,omitempty"` + IsDatabaseCertified *bool `json:"isDatabaseCertified,omitempty"` + VMSku *string `json:"vmSku,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/model_sapsupportedskusrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/model_sapsupportedskusrequest.go new file mode 100644 index 000000000000..56355f1f2e80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/model_sapsupportedskusrequest.go @@ -0,0 +1,13 @@ +package sapsupportedsku + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPSupportedSkusRequest struct { + AppLocation string `json:"appLocation"` + DatabaseType SAPDatabaseType `json:"databaseType"` + DeploymentType SAPDeploymentType `json:"deploymentType"` + Environment SAPEnvironmentType `json:"environment"` + HighAvailabilityType *SAPHighAvailabilityType `json:"highAvailabilityType,omitempty"` + SapProduct SAPProductType `json:"sapProduct"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/version.go new file mode 100644 index 000000000000..d1324c82032d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku/version.go @@ -0,0 +1,12 @@ +package sapsupportedsku + +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 = "2023-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sapsupportedsku/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/README.md new file mode 100644 index 000000000000..956682388255 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/README.md @@ -0,0 +1,150 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances` Documentation + +The `sapvirtualinstances` SDK allows for interaction with the Azure Resource Manager Service `workloads` (API Version `2023-04-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances" +``` + + +### Client Initialization + +```go +client := sapvirtualinstances.NewSAPVirtualInstancesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SAPVirtualInstancesClient.Create` + +```go +ctx := context.TODO() +id := sapvirtualinstances.NewSapVirtualInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue") + +payload := sapvirtualinstances.SAPVirtualInstance{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPVirtualInstancesClient.Delete` + +```go +ctx := context.TODO() +id := sapvirtualinstances.NewSapVirtualInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPVirtualInstancesClient.Get` + +```go +ctx := context.TODO() +id := sapvirtualinstances.NewSapVirtualInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue") + +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: `SAPVirtualInstancesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SAPVirtualInstancesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SAPVirtualInstancesClient.Start` + +```go +ctx := context.TODO() +id := sapvirtualinstances.NewSapVirtualInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue") + +if err := client.StartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPVirtualInstancesClient.Stop` + +```go +ctx := context.TODO() +id := sapvirtualinstances.NewSapVirtualInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue") + +payload := sapvirtualinstances.StopRequest{ + // ... +} + + +if err := client.StopThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SAPVirtualInstancesClient.Update` + +```go +ctx := context.TODO() +id := sapvirtualinstances.NewSapVirtualInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sapVirtualInstanceValue") + +payload := sapvirtualinstances.UpdateSAPVirtualInstanceRequest{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/client.go new file mode 100644 index 000000000000..db3692232a20 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/client.go @@ -0,0 +1,26 @@ +package sapvirtualinstances + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPVirtualInstancesClient struct { + Client *resourcemanager.Client +} + +func NewSAPVirtualInstancesClientWithBaseURI(sdkApi sdkEnv.Api) (*SAPVirtualInstancesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "sapvirtualinstances", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SAPVirtualInstancesClient: %+v", err) + } + + return &SAPVirtualInstancesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/constants.go new file mode 100644 index 000000000000..e3c23e82486b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/constants.go @@ -0,0 +1,709 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationType string + +const ( + ConfigurationTypeCreateAndMount ConfigurationType = "CreateAndMount" + ConfigurationTypeMount ConfigurationType = "Mount" + ConfigurationTypeSkip ConfigurationType = "Skip" +) + +func PossibleValuesForConfigurationType() []string { + return []string{ + string(ConfigurationTypeCreateAndMount), + string(ConfigurationTypeMount), + string(ConfigurationTypeSkip), + } +} + +func (s *ConfigurationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConfigurationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConfigurationType(input string) (*ConfigurationType, error) { + vals := map[string]ConfigurationType{ + "createandmount": ConfigurationTypeCreateAndMount, + "mount": ConfigurationTypeMount, + "skip": ConfigurationTypeSkip, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConfigurationType(input) + return &out, nil +} + +type DiskSkuName string + +const ( + DiskSkuNamePremiumLRS DiskSkuName = "Premium_LRS" + DiskSkuNamePremiumVTwoLRS DiskSkuName = "PremiumV2_LRS" + DiskSkuNamePremiumZRS DiskSkuName = "Premium_ZRS" + DiskSkuNameStandardLRS DiskSkuName = "Standard_LRS" + DiskSkuNameStandardSSDLRS DiskSkuName = "StandardSSD_LRS" + DiskSkuNameStandardSSDZRS DiskSkuName = "StandardSSD_ZRS" + DiskSkuNameUltraSSDLRS DiskSkuName = "UltraSSD_LRS" +) + +func PossibleValuesForDiskSkuName() []string { + return []string{ + string(DiskSkuNamePremiumLRS), + string(DiskSkuNamePremiumVTwoLRS), + string(DiskSkuNamePremiumZRS), + string(DiskSkuNameStandardLRS), + string(DiskSkuNameStandardSSDLRS), + string(DiskSkuNameStandardSSDZRS), + string(DiskSkuNameUltraSSDLRS), + } +} + +func (s *DiskSkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskSkuName(input string) (*DiskSkuName, error) { + vals := map[string]DiskSkuName{ + "premium_lrs": DiskSkuNamePremiumLRS, + "premiumv2_lrs": DiskSkuNamePremiumVTwoLRS, + "premium_zrs": DiskSkuNamePremiumZRS, + "standard_lrs": DiskSkuNameStandardLRS, + "standardssd_lrs": DiskSkuNameStandardSSDLRS, + "standardssd_zrs": DiskSkuNameStandardSSDZRS, + "ultrassd_lrs": DiskSkuNameUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskSkuName(input) + return &out, nil +} + +type NamingPatternType string + +const ( + NamingPatternTypeFullResourceName NamingPatternType = "FullResourceName" +) + +func PossibleValuesForNamingPatternType() []string { + return []string{ + string(NamingPatternTypeFullResourceName), + } +} + +func (s *NamingPatternType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNamingPatternType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNamingPatternType(input string) (*NamingPatternType, error) { + vals := map[string]NamingPatternType{ + "fullresourcename": NamingPatternTypeFullResourceName, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NamingPatternType(input) + return &out, nil +} + +type OSType string + +const ( + OSTypeLinux OSType = "Linux" + OSTypeWindows OSType = "Windows" +) + +func PossibleValuesForOSType() []string { + return []string{ + string(OSTypeLinux), + string(OSTypeWindows), + } +} + +func (s *OSType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOSType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOSType(input string) (*OSType, error) { + vals := map[string]OSType{ + "linux": OSTypeLinux, + "windows": OSTypeWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OSType(input) + return &out, nil +} + +type SAPConfigurationType string + +const ( + SAPConfigurationTypeDeployment SAPConfigurationType = "Deployment" + SAPConfigurationTypeDeploymentWithOSConfig SAPConfigurationType = "DeploymentWithOSConfig" + SAPConfigurationTypeDiscovery SAPConfigurationType = "Discovery" +) + +func PossibleValuesForSAPConfigurationType() []string { + return []string{ + string(SAPConfigurationTypeDeployment), + string(SAPConfigurationTypeDeploymentWithOSConfig), + string(SAPConfigurationTypeDiscovery), + } +} + +func (s *SAPConfigurationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPConfigurationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPConfigurationType(input string) (*SAPConfigurationType, error) { + vals := map[string]SAPConfigurationType{ + "deployment": SAPConfigurationTypeDeployment, + "deploymentwithosconfig": SAPConfigurationTypeDeploymentWithOSConfig, + "discovery": SAPConfigurationTypeDiscovery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPConfigurationType(input) + return &out, nil +} + +type SAPDatabaseType string + +const ( + SAPDatabaseTypeDBTwo SAPDatabaseType = "DB2" + SAPDatabaseTypeHANA SAPDatabaseType = "HANA" +) + +func PossibleValuesForSAPDatabaseType() []string { + return []string{ + string(SAPDatabaseTypeDBTwo), + string(SAPDatabaseTypeHANA), + } +} + +func (s *SAPDatabaseType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPDatabaseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPDatabaseType(input string) (*SAPDatabaseType, error) { + vals := map[string]SAPDatabaseType{ + "db2": SAPDatabaseTypeDBTwo, + "hana": SAPDatabaseTypeHANA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPDatabaseType(input) + return &out, nil +} + +type SAPDeploymentType string + +const ( + SAPDeploymentTypeSingleServer SAPDeploymentType = "SingleServer" + SAPDeploymentTypeThreeTier SAPDeploymentType = "ThreeTier" +) + +func PossibleValuesForSAPDeploymentType() []string { + return []string{ + string(SAPDeploymentTypeSingleServer), + string(SAPDeploymentTypeThreeTier), + } +} + +func (s *SAPDeploymentType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPDeploymentType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPDeploymentType(input string) (*SAPDeploymentType, error) { + vals := map[string]SAPDeploymentType{ + "singleserver": SAPDeploymentTypeSingleServer, + "threetier": SAPDeploymentTypeThreeTier, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPDeploymentType(input) + return &out, nil +} + +type SAPEnvironmentType string + +const ( + SAPEnvironmentTypeNonProd SAPEnvironmentType = "NonProd" + SAPEnvironmentTypeProd SAPEnvironmentType = "Prod" +) + +func PossibleValuesForSAPEnvironmentType() []string { + return []string{ + string(SAPEnvironmentTypeNonProd), + string(SAPEnvironmentTypeProd), + } +} + +func (s *SAPEnvironmentType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPEnvironmentType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPEnvironmentType(input string) (*SAPEnvironmentType, error) { + vals := map[string]SAPEnvironmentType{ + "nonprod": SAPEnvironmentTypeNonProd, + "prod": SAPEnvironmentTypeProd, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPEnvironmentType(input) + return &out, nil +} + +type SAPHealthState string + +const ( + SAPHealthStateDegraded SAPHealthState = "Degraded" + SAPHealthStateHealthy SAPHealthState = "Healthy" + SAPHealthStateUnhealthy SAPHealthState = "Unhealthy" + SAPHealthStateUnknown SAPHealthState = "Unknown" +) + +func PossibleValuesForSAPHealthState() []string { + return []string{ + string(SAPHealthStateDegraded), + string(SAPHealthStateHealthy), + string(SAPHealthStateUnhealthy), + string(SAPHealthStateUnknown), + } +} + +func (s *SAPHealthState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPHealthState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPHealthState(input string) (*SAPHealthState, error) { + vals := map[string]SAPHealthState{ + "degraded": SAPHealthStateDegraded, + "healthy": SAPHealthStateHealthy, + "unhealthy": SAPHealthStateUnhealthy, + "unknown": SAPHealthStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPHealthState(input) + return &out, nil +} + +type SAPHighAvailabilityType string + +const ( + SAPHighAvailabilityTypeAvailabilitySet SAPHighAvailabilityType = "AvailabilitySet" + SAPHighAvailabilityTypeAvailabilityZone SAPHighAvailabilityType = "AvailabilityZone" +) + +func PossibleValuesForSAPHighAvailabilityType() []string { + return []string{ + string(SAPHighAvailabilityTypeAvailabilitySet), + string(SAPHighAvailabilityTypeAvailabilityZone), + } +} + +func (s *SAPHighAvailabilityType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPHighAvailabilityType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPHighAvailabilityType(input string) (*SAPHighAvailabilityType, error) { + vals := map[string]SAPHighAvailabilityType{ + "availabilityset": SAPHighAvailabilityTypeAvailabilitySet, + "availabilityzone": SAPHighAvailabilityTypeAvailabilityZone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPHighAvailabilityType(input) + return &out, nil +} + +type SAPProductType string + +const ( + SAPProductTypeECC SAPProductType = "ECC" + SAPProductTypeOther SAPProductType = "Other" + SAPProductTypeSFourHANA SAPProductType = "S4HANA" +) + +func PossibleValuesForSAPProductType() []string { + return []string{ + string(SAPProductTypeECC), + string(SAPProductTypeOther), + string(SAPProductTypeSFourHANA), + } +} + +func (s *SAPProductType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPProductType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPProductType(input string) (*SAPProductType, error) { + vals := map[string]SAPProductType{ + "ecc": SAPProductTypeECC, + "other": SAPProductTypeOther, + "s4hana": SAPProductTypeSFourHANA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPProductType(input) + return &out, nil +} + +type SAPSoftwareInstallationType string + +const ( + SAPSoftwareInstallationTypeExternal SAPSoftwareInstallationType = "External" + SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig SAPSoftwareInstallationType = "SAPInstallWithoutOSConfig" + SAPSoftwareInstallationTypeServiceInitiated SAPSoftwareInstallationType = "ServiceInitiated" +) + +func PossibleValuesForSAPSoftwareInstallationType() []string { + return []string{ + string(SAPSoftwareInstallationTypeExternal), + string(SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig), + string(SAPSoftwareInstallationTypeServiceInitiated), + } +} + +func (s *SAPSoftwareInstallationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPSoftwareInstallationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPSoftwareInstallationType(input string) (*SAPSoftwareInstallationType, error) { + vals := map[string]SAPSoftwareInstallationType{ + "external": SAPSoftwareInstallationTypeExternal, + "sapinstallwithoutosconfig": SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig, + "serviceinitiated": SAPSoftwareInstallationTypeServiceInitiated, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPSoftwareInstallationType(input) + return &out, nil +} + +type SAPVirtualInstanceState string + +const ( + SAPVirtualInstanceStateDiscoveryFailed SAPVirtualInstanceState = "DiscoveryFailed" + SAPVirtualInstanceStateDiscoveryInProgress SAPVirtualInstanceState = "DiscoveryInProgress" + SAPVirtualInstanceStateDiscoveryPending SAPVirtualInstanceState = "DiscoveryPending" + SAPVirtualInstanceStateInfrastructureDeploymentFailed SAPVirtualInstanceState = "InfrastructureDeploymentFailed" + SAPVirtualInstanceStateInfrastructureDeploymentInProgress SAPVirtualInstanceState = "InfrastructureDeploymentInProgress" + SAPVirtualInstanceStateInfrastructureDeploymentPending SAPVirtualInstanceState = "InfrastructureDeploymentPending" + SAPVirtualInstanceStateRegistrationComplete SAPVirtualInstanceState = "RegistrationComplete" + SAPVirtualInstanceStateSoftwareDetectionFailed SAPVirtualInstanceState = "SoftwareDetectionFailed" + SAPVirtualInstanceStateSoftwareDetectionInProgress SAPVirtualInstanceState = "SoftwareDetectionInProgress" + SAPVirtualInstanceStateSoftwareInstallationFailed SAPVirtualInstanceState = "SoftwareInstallationFailed" + SAPVirtualInstanceStateSoftwareInstallationInProgress SAPVirtualInstanceState = "SoftwareInstallationInProgress" + SAPVirtualInstanceStateSoftwareInstallationPending SAPVirtualInstanceState = "SoftwareInstallationPending" +) + +func PossibleValuesForSAPVirtualInstanceState() []string { + return []string{ + string(SAPVirtualInstanceStateDiscoveryFailed), + string(SAPVirtualInstanceStateDiscoveryInProgress), + string(SAPVirtualInstanceStateDiscoveryPending), + string(SAPVirtualInstanceStateInfrastructureDeploymentFailed), + string(SAPVirtualInstanceStateInfrastructureDeploymentInProgress), + string(SAPVirtualInstanceStateInfrastructureDeploymentPending), + string(SAPVirtualInstanceStateRegistrationComplete), + string(SAPVirtualInstanceStateSoftwareDetectionFailed), + string(SAPVirtualInstanceStateSoftwareDetectionInProgress), + string(SAPVirtualInstanceStateSoftwareInstallationFailed), + string(SAPVirtualInstanceStateSoftwareInstallationInProgress), + string(SAPVirtualInstanceStateSoftwareInstallationPending), + } +} + +func (s *SAPVirtualInstanceState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPVirtualInstanceState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPVirtualInstanceState(input string) (*SAPVirtualInstanceState, error) { + vals := map[string]SAPVirtualInstanceState{ + "discoveryfailed": SAPVirtualInstanceStateDiscoveryFailed, + "discoveryinprogress": SAPVirtualInstanceStateDiscoveryInProgress, + "discoverypending": SAPVirtualInstanceStateDiscoveryPending, + "infrastructuredeploymentfailed": SAPVirtualInstanceStateInfrastructureDeploymentFailed, + "infrastructuredeploymentinprogress": SAPVirtualInstanceStateInfrastructureDeploymentInProgress, + "infrastructuredeploymentpending": SAPVirtualInstanceStateInfrastructureDeploymentPending, + "registrationcomplete": SAPVirtualInstanceStateRegistrationComplete, + "softwaredetectionfailed": SAPVirtualInstanceStateSoftwareDetectionFailed, + "softwaredetectioninprogress": SAPVirtualInstanceStateSoftwareDetectionInProgress, + "softwareinstallationfailed": SAPVirtualInstanceStateSoftwareInstallationFailed, + "softwareinstallationinprogress": SAPVirtualInstanceStateSoftwareInstallationInProgress, + "softwareinstallationpending": SAPVirtualInstanceStateSoftwareInstallationPending, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPVirtualInstanceState(input) + return &out, nil +} + +type SAPVirtualInstanceStatus string + +const ( + SAPVirtualInstanceStatusOffline SAPVirtualInstanceStatus = "Offline" + SAPVirtualInstanceStatusPartiallyRunning SAPVirtualInstanceStatus = "PartiallyRunning" + SAPVirtualInstanceStatusRunning SAPVirtualInstanceStatus = "Running" + SAPVirtualInstanceStatusSoftShutdown SAPVirtualInstanceStatus = "SoftShutdown" + SAPVirtualInstanceStatusStarting SAPVirtualInstanceStatus = "Starting" + SAPVirtualInstanceStatusStopping SAPVirtualInstanceStatus = "Stopping" + SAPVirtualInstanceStatusUnavailable SAPVirtualInstanceStatus = "Unavailable" +) + +func PossibleValuesForSAPVirtualInstanceStatus() []string { + return []string{ + string(SAPVirtualInstanceStatusOffline), + string(SAPVirtualInstanceStatusPartiallyRunning), + string(SAPVirtualInstanceStatusRunning), + string(SAPVirtualInstanceStatusSoftShutdown), + string(SAPVirtualInstanceStatusStarting), + string(SAPVirtualInstanceStatusStopping), + string(SAPVirtualInstanceStatusUnavailable), + } +} + +func (s *SAPVirtualInstanceStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSAPVirtualInstanceStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSAPVirtualInstanceStatus(input string) (*SAPVirtualInstanceStatus, error) { + vals := map[string]SAPVirtualInstanceStatus{ + "offline": SAPVirtualInstanceStatusOffline, + "partiallyrunning": SAPVirtualInstanceStatusPartiallyRunning, + "running": SAPVirtualInstanceStatusRunning, + "softshutdown": SAPVirtualInstanceStatusSoftShutdown, + "starting": SAPVirtualInstanceStatusStarting, + "stopping": SAPVirtualInstanceStatusStopping, + "unavailable": SAPVirtualInstanceStatusUnavailable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SAPVirtualInstanceStatus(input) + return &out, nil +} + +type SapVirtualInstanceProvisioningState string + +const ( + SapVirtualInstanceProvisioningStateCreating SapVirtualInstanceProvisioningState = "Creating" + SapVirtualInstanceProvisioningStateDeleting SapVirtualInstanceProvisioningState = "Deleting" + SapVirtualInstanceProvisioningStateFailed SapVirtualInstanceProvisioningState = "Failed" + SapVirtualInstanceProvisioningStateSucceeded SapVirtualInstanceProvisioningState = "Succeeded" + SapVirtualInstanceProvisioningStateUpdating SapVirtualInstanceProvisioningState = "Updating" +) + +func PossibleValuesForSapVirtualInstanceProvisioningState() []string { + return []string{ + string(SapVirtualInstanceProvisioningStateCreating), + string(SapVirtualInstanceProvisioningStateDeleting), + string(SapVirtualInstanceProvisioningStateFailed), + string(SapVirtualInstanceProvisioningStateSucceeded), + string(SapVirtualInstanceProvisioningStateUpdating), + } +} + +func (s *SapVirtualInstanceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSapVirtualInstanceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSapVirtualInstanceProvisioningState(input string) (*SapVirtualInstanceProvisioningState, error) { + vals := map[string]SapVirtualInstanceProvisioningState{ + "creating": SapVirtualInstanceProvisioningStateCreating, + "deleting": SapVirtualInstanceProvisioningStateDeleting, + "failed": SapVirtualInstanceProvisioningStateFailed, + "succeeded": SapVirtualInstanceProvisioningStateSucceeded, + "updating": SapVirtualInstanceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SapVirtualInstanceProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/id_sapvirtualinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/id_sapvirtualinstance.go new file mode 100644 index 000000000000..5be70e9d470f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/id_sapvirtualinstance.go @@ -0,0 +1,125 @@ +package sapvirtualinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &SapVirtualInstanceId{} + +// SapVirtualInstanceId is a struct representing the Resource ID for a Sap Virtual Instance +type SapVirtualInstanceId struct { + SubscriptionId string + ResourceGroupName string + SapVirtualInstanceName string +} + +// NewSapVirtualInstanceID returns a new SapVirtualInstanceId struct +func NewSapVirtualInstanceID(subscriptionId string, resourceGroupName string, sapVirtualInstanceName string) SapVirtualInstanceId { + return SapVirtualInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SapVirtualInstanceName: sapVirtualInstanceName, + } +} + +// ParseSapVirtualInstanceID parses 'input' into a SapVirtualInstanceId +func ParseSapVirtualInstanceID(input string) (*SapVirtualInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&SapVirtualInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSapVirtualInstanceIDInsensitively parses 'input' case-insensitively into a SapVirtualInstanceId +// note: this method should only be used for API response data and not user input +func ParseSapVirtualInstanceIDInsensitively(input string) (*SapVirtualInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(&SapVirtualInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SapVirtualInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) + } + + return nil +} + +// ValidateSapVirtualInstanceID checks that 'input' can be parsed as a Sap Virtual Instance ID +func ValidateSapVirtualInstanceID(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 := ParseSapVirtualInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sap Virtual Instance ID +func (id SapVirtualInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Workloads/sapVirtualInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SapVirtualInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sap Virtual Instance ID +func (id SapVirtualInstanceId) 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("staticMicrosoftWorkloads", "Microsoft.Workloads", "Microsoft.Workloads"), + resourceids.StaticSegment("staticSapVirtualInstances", "sapVirtualInstances", "sapVirtualInstances"), + resourceids.UserSpecifiedSegment("sapVirtualInstanceName", "sapVirtualInstanceValue"), + } +} + +// String returns a human-readable description of this Sap Virtual Instance ID +func (id SapVirtualInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Sap Virtual Instance Name: %q", id.SapVirtualInstanceName), + } + return fmt.Sprintf("Sap Virtual Instance (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_create.go new file mode 100644 index 000000000000..cf665a1c878a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_create.go @@ -0,0 +1,75 @@ +package sapvirtualinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *SAPVirtualInstance +} + +// Create ... +func (c SAPVirtualInstancesClient) Create(ctx context.Context, id SapVirtualInstanceId, input SAPVirtualInstance) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c SAPVirtualInstancesClient) CreateThenPoll(ctx context.Context, id SapVirtualInstanceId, input SAPVirtualInstance) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_delete.go new file mode 100644 index 000000000000..272599c0a96f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_delete.go @@ -0,0 +1,72 @@ +package sapvirtualinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// Delete ... +func (c SAPVirtualInstancesClient) Delete(ctx context.Context, id SapVirtualInstanceId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SAPVirtualInstancesClient) DeleteThenPoll(ctx context.Context, id SapVirtualInstanceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_get.go new file mode 100644 index 000000000000..f907040f3e44 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_get.go @@ -0,0 +1,54 @@ +package sapvirtualinstances + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SAPVirtualInstance +} + +// Get ... +func (c SAPVirtualInstancesClient) Get(ctx context.Context, id SapVirtualInstanceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SAPVirtualInstance + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_listbyresourcegroup.go new file mode 100644 index 000000000000..20f081580d52 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package sapvirtualinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SAPVirtualInstance +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []SAPVirtualInstance +} + +// ListByResourceGroup ... +func (c SAPVirtualInstancesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Workloads/sapVirtualInstances", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SAPVirtualInstance `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c SAPVirtualInstancesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SAPVirtualInstanceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SAPVirtualInstancesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SAPVirtualInstanceOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]SAPVirtualInstance, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_listbysubscription.go new file mode 100644 index 000000000000..87632e143ec6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_listbysubscription.go @@ -0,0 +1,92 @@ +package sapvirtualinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SAPVirtualInstance +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []SAPVirtualInstance +} + +// ListBySubscription ... +func (c SAPVirtualInstancesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Workloads/sapVirtualInstances", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SAPVirtualInstance `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c SAPVirtualInstancesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, SAPVirtualInstanceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SAPVirtualInstancesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SAPVirtualInstanceOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]SAPVirtualInstance, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_start.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_start.go new file mode 100644 index 000000000000..fe688f0bcc2b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_start.go @@ -0,0 +1,71 @@ +package sapvirtualinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// Start ... +func (c SAPVirtualInstancesClient) Start(ctx context.Context, id SapVirtualInstanceId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StartThenPoll performs Start then polls until it's completed +func (c SAPVirtualInstancesClient) StartThenPoll(ctx context.Context, id SapVirtualInstanceId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_stop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_stop.go new file mode 100644 index 000000000000..aac10878a2bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_stop.go @@ -0,0 +1,75 @@ +package sapvirtualinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OperationStatusResult +} + +// Stop ... +func (c SAPVirtualInstancesClient) Stop(ctx context.Context, id SapVirtualInstanceId, input StopRequest) (result StopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StopThenPoll performs Stop then polls until it's completed +func (c SAPVirtualInstancesClient) StopThenPoll(ctx context.Context, id SapVirtualInstanceId, input StopRequest) error { + result, err := c.Stop(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Stop: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Stop: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_update.go new file mode 100644 index 000000000000..73002adae599 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/method_update.go @@ -0,0 +1,58 @@ +package sapvirtualinstances + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SAPVirtualInstance +} + +// Update ... +func (c SAPVirtualInstancesClient) Update(ctx context.Context, id SapVirtualInstanceId, input UpdateSAPVirtualInstanceRequest) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SAPVirtualInstance + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_applicationserverconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_applicationserverconfiguration.go new file mode 100644 index 000000000000..16e4d301f4c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_applicationserverconfiguration.go @@ -0,0 +1,10 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationServerConfiguration struct { + InstanceCount int64 `json:"instanceCount"` + SubnetId string `json:"subnetId"` + VirtualMachineConfiguration VirtualMachineConfiguration `json:"virtualMachineConfiguration"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_applicationserverfullresourcenames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_applicationserverfullresourcenames.go new file mode 100644 index 000000000000..2b99b68a4231 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_applicationserverfullresourcenames.go @@ -0,0 +1,9 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationServerFullResourceNames struct { + AvailabilitySetName *string `json:"availabilitySetName,omitempty"` + VirtualMachines *[]VirtualMachineResourceNames `json:"virtualMachines,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_centralserverconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_centralserverconfiguration.go new file mode 100644 index 000000000000..691fffbf2c71 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_centralserverconfiguration.go @@ -0,0 +1,10 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CentralServerConfiguration struct { + InstanceCount int64 `json:"instanceCount"` + SubnetId string `json:"subnetId"` + VirtualMachineConfiguration VirtualMachineConfiguration `json:"virtualMachineConfiguration"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_centralserverfullresourcenames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_centralserverfullresourcenames.go new file mode 100644 index 000000000000..c3a013c0f525 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_centralserverfullresourcenames.go @@ -0,0 +1,10 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CentralServerFullResourceNames struct { + AvailabilitySetName *string `json:"availabilitySetName,omitempty"` + LoadBalancer *LoadBalancerResourceNames `json:"loadBalancer,omitempty"` + VirtualMachines *[]VirtualMachineResourceNames `json:"virtualMachines,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_createandmountfileshareconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_createandmountfileshareconfiguration.go new file mode 100644 index 000000000000..ea44f0fd7e31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_createandmountfileshareconfiguration.go @@ -0,0 +1,42 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ FileShareConfiguration = CreateAndMountFileShareConfiguration{} + +type CreateAndMountFileShareConfiguration struct { + ResourceGroup *string `json:"resourceGroup,omitempty"` + StorageAccountName *string `json:"storageAccountName,omitempty"` + + // Fields inherited from FileShareConfiguration +} + +var _ json.Marshaler = CreateAndMountFileShareConfiguration{} + +func (s CreateAndMountFileShareConfiguration) MarshalJSON() ([]byte, error) { + type wrapper CreateAndMountFileShareConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CreateAndMountFileShareConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CreateAndMountFileShareConfiguration: %+v", err) + } + decoded["configurationType"] = "CreateAndMount" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CreateAndMountFileShareConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_databaseconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_databaseconfiguration.go new file mode 100644 index 000000000000..3777d01e9b8f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_databaseconfiguration.go @@ -0,0 +1,12 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseConfiguration struct { + DatabaseType *SAPDatabaseType `json:"databaseType,omitempty"` + DiskConfiguration *DiskConfiguration `json:"diskConfiguration,omitempty"` + InstanceCount int64 `json:"instanceCount"` + SubnetId string `json:"subnetId"` + VirtualMachineConfiguration VirtualMachineConfiguration `json:"virtualMachineConfiguration"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_databaseserverfullresourcenames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_databaseserverfullresourcenames.go new file mode 100644 index 000000000000..ee192d2c0468 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_databaseserverfullresourcenames.go @@ -0,0 +1,10 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseServerFullResourceNames struct { + AvailabilitySetName *string `json:"availabilitySetName,omitempty"` + LoadBalancer *LoadBalancerResourceNames `json:"loadBalancer,omitempty"` + VirtualMachines *[]VirtualMachineResourceNames `json:"virtualMachines,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_deployervmpackages.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_deployervmpackages.go new file mode 100644 index 000000000000..bfcd632981ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_deployervmpackages.go @@ -0,0 +1,9 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeployerVMPackages struct { + StorageAccountId *string `json:"storageAccountId,omitempty"` + Url *string `json:"url,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_deploymentconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_deploymentconfiguration.go new file mode 100644 index 000000000000..d85caa83fa17 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_deploymentconfiguration.go @@ -0,0 +1,77 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SAPConfiguration = DeploymentConfiguration{} + +type DeploymentConfiguration struct { + AppLocation *string `json:"appLocation,omitempty"` + InfrastructureConfiguration InfrastructureConfiguration `json:"infrastructureConfiguration"` + SoftwareConfiguration SoftwareConfiguration `json:"softwareConfiguration"` + + // Fields inherited from SAPConfiguration +} + +var _ json.Marshaler = DeploymentConfiguration{} + +func (s DeploymentConfiguration) MarshalJSON() ([]byte, error) { + type wrapper DeploymentConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeploymentConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeploymentConfiguration: %+v", err) + } + decoded["configurationType"] = "Deployment" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeploymentConfiguration: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &DeploymentConfiguration{} + +func (s *DeploymentConfiguration) UnmarshalJSON(bytes []byte) error { + type alias DeploymentConfiguration + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into DeploymentConfiguration: %+v", err) + } + + s.AppLocation = decoded.AppLocation + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling DeploymentConfiguration into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["infrastructureConfiguration"]; ok { + impl, err := unmarshalInfrastructureConfigurationImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'InfrastructureConfiguration' for 'DeploymentConfiguration': %+v", err) + } + s.InfrastructureConfiguration = impl + } + + if v, ok := temp["softwareConfiguration"]; ok { + impl, err := unmarshalSoftwareConfigurationImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'SoftwareConfiguration' for 'DeploymentConfiguration': %+v", err) + } + s.SoftwareConfiguration = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_deploymentwithosconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_deploymentwithosconfiguration.go new file mode 100644 index 000000000000..883594a67615 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_deploymentwithosconfiguration.go @@ -0,0 +1,79 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SAPConfiguration = DeploymentWithOSConfiguration{} + +type DeploymentWithOSConfiguration struct { + AppLocation *string `json:"appLocation,omitempty"` + InfrastructureConfiguration InfrastructureConfiguration `json:"infrastructureConfiguration"` + OsSapConfiguration *OsSapConfiguration `json:"osSapConfiguration,omitempty"` + SoftwareConfiguration SoftwareConfiguration `json:"softwareConfiguration"` + + // Fields inherited from SAPConfiguration +} + +var _ json.Marshaler = DeploymentWithOSConfiguration{} + +func (s DeploymentWithOSConfiguration) MarshalJSON() ([]byte, error) { + type wrapper DeploymentWithOSConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeploymentWithOSConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeploymentWithOSConfiguration: %+v", err) + } + decoded["configurationType"] = "DeploymentWithOSConfig" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeploymentWithOSConfiguration: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &DeploymentWithOSConfiguration{} + +func (s *DeploymentWithOSConfiguration) UnmarshalJSON(bytes []byte) error { + type alias DeploymentWithOSConfiguration + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into DeploymentWithOSConfiguration: %+v", err) + } + + s.AppLocation = decoded.AppLocation + s.OsSapConfiguration = decoded.OsSapConfiguration + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling DeploymentWithOSConfiguration into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["infrastructureConfiguration"]; ok { + impl, err := unmarshalInfrastructureConfigurationImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'InfrastructureConfiguration' for 'DeploymentWithOSConfiguration': %+v", err) + } + s.InfrastructureConfiguration = impl + } + + if v, ok := temp["softwareConfiguration"]; ok { + impl, err := unmarshalSoftwareConfigurationImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'SoftwareConfiguration' for 'DeploymentWithOSConfiguration': %+v", err) + } + s.SoftwareConfiguration = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_discoveryconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_discoveryconfiguration.go new file mode 100644 index 000000000000..a6c63c24ee4d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_discoveryconfiguration.go @@ -0,0 +1,43 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SAPConfiguration = DiscoveryConfiguration{} + +type DiscoveryConfiguration struct { + AppLocation *string `json:"appLocation,omitempty"` + CentralServerVMId *string `json:"centralServerVmId,omitempty"` + ManagedRgStorageAccountName *string `json:"managedRgStorageAccountName,omitempty"` + + // Fields inherited from SAPConfiguration +} + +var _ json.Marshaler = DiscoveryConfiguration{} + +func (s DiscoveryConfiguration) MarshalJSON() ([]byte, error) { + type wrapper DiscoveryConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DiscoveryConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DiscoveryConfiguration: %+v", err) + } + decoded["configurationType"] = "Discovery" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DiscoveryConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_diskconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_diskconfiguration.go new file mode 100644 index 000000000000..b9fada01e2ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_diskconfiguration.go @@ -0,0 +1,8 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskConfiguration struct { + DiskVolumeConfigurations *map[string]DiskVolumeConfiguration `json:"diskVolumeConfigurations,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_disksku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_disksku.go new file mode 100644 index 000000000000..4ad14b3416e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_disksku.go @@ -0,0 +1,8 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskSku struct { + Name *DiskSkuName `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_diskvolumeconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_diskvolumeconfiguration.go new file mode 100644 index 000000000000..ddc92a369c70 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_diskvolumeconfiguration.go @@ -0,0 +1,10 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskVolumeConfiguration struct { + Count *int64 `json:"count,omitempty"` + SizeGB *int64 `json:"sizeGB,omitempty"` + Sku *DiskSku `json:"sku,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_erroradditionalinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_erroradditionalinfo.go new file mode 100644 index 000000000000..18c075c9e04f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_errordefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_errordefinition.go new file mode 100644 index 000000000000..becaed0cda35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_errordefinition.go @@ -0,0 +1,10 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDefinition struct { + Code *string `json:"code,omitempty"` + Details *[]ErrorDefinition `json:"details,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_errordetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_errordetail.go new file mode 100644 index 000000000000..23a41b56090f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_errordetail.go @@ -0,0 +1,12 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDetail struct { + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_externalinstallationsoftwareconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_externalinstallationsoftwareconfiguration.go new file mode 100644 index 000000000000..6805c0db671c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_externalinstallationsoftwareconfiguration.go @@ -0,0 +1,41 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SoftwareConfiguration = ExternalInstallationSoftwareConfiguration{} + +type ExternalInstallationSoftwareConfiguration struct { + CentralServerVMId *string `json:"centralServerVmId,omitempty"` + + // Fields inherited from SoftwareConfiguration +} + +var _ json.Marshaler = ExternalInstallationSoftwareConfiguration{} + +func (s ExternalInstallationSoftwareConfiguration) MarshalJSON() ([]byte, error) { + type wrapper ExternalInstallationSoftwareConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ExternalInstallationSoftwareConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ExternalInstallationSoftwareConfiguration: %+v", err) + } + decoded["softwareInstallationType"] = "External" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ExternalInstallationSoftwareConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_fileshareconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_fileshareconfiguration.go new file mode 100644 index 000000000000..115d03e06dd8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_fileshareconfiguration.go @@ -0,0 +1,69 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FileShareConfiguration interface { +} + +// RawFileShareConfigurationImpl is returned when the Discriminated Value +// doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawFileShareConfigurationImpl struct { + Type string + Values map[string]interface{} +} + +func unmarshalFileShareConfigurationImplementation(input []byte) (FileShareConfiguration, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling FileShareConfiguration into map[string]interface: %+v", err) + } + + value, ok := temp["configurationType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "CreateAndMount") { + var out CreateAndMountFileShareConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CreateAndMountFileShareConfiguration: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Mount") { + var out MountFileShareConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into MountFileShareConfiguration: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Skip") { + var out SkipFileShareConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SkipFileShareConfiguration: %+v", err) + } + return out, nil + } + + out := RawFileShareConfigurationImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_highavailabilityconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_highavailabilityconfiguration.go new file mode 100644 index 000000000000..d9ce01fc8b18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_highavailabilityconfiguration.go @@ -0,0 +1,8 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HighAvailabilityConfiguration struct { + HighAvailabilityType SAPHighAvailabilityType `json:"highAvailabilityType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_highavailabilitysoftwareconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_highavailabilitysoftwareconfiguration.go new file mode 100644 index 000000000000..8d8583b37b30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_highavailabilitysoftwareconfiguration.go @@ -0,0 +1,9 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HighAvailabilitySoftwareConfiguration struct { + FencingClientId string `json:"fencingClientId"` + FencingClientPassword string `json:"fencingClientPassword"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_imagereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_imagereference.go new file mode 100644 index 000000000000..3266369f6198 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_imagereference.go @@ -0,0 +1,11 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageReference struct { + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_infrastructureconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_infrastructureconfiguration.go new file mode 100644 index 000000000000..a0f9a0fee748 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_infrastructureconfiguration.go @@ -0,0 +1,61 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InfrastructureConfiguration interface { +} + +// RawInfrastructureConfigurationImpl is returned when the Discriminated Value +// doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawInfrastructureConfigurationImpl struct { + Type string + Values map[string]interface{} +} + +func unmarshalInfrastructureConfigurationImplementation(input []byte) (InfrastructureConfiguration, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling InfrastructureConfiguration into map[string]interface: %+v", err) + } + + value, ok := temp["deploymentType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "SingleServer") { + var out SingleServerConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SingleServerConfiguration: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ThreeTier") { + var out ThreeTierConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ThreeTierConfiguration: %+v", err) + } + return out, nil + } + + out := RawInfrastructureConfigurationImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_linuxconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_linuxconfiguration.go new file mode 100644 index 000000000000..c41104d4a160 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_linuxconfiguration.go @@ -0,0 +1,43 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ OSConfiguration = LinuxConfiguration{} + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` + SshKeyPair *SshKeyPair `json:"sshKeyPair,omitempty"` + + // Fields inherited from OSConfiguration +} + +var _ json.Marshaler = LinuxConfiguration{} + +func (s LinuxConfiguration) MarshalJSON() ([]byte, error) { + type wrapper LinuxConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling LinuxConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling LinuxConfiguration: %+v", err) + } + decoded["osType"] = "Linux" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling LinuxConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_loadbalancerresourcenames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_loadbalancerresourcenames.go new file mode 100644 index 000000000000..7789f0e83515 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_loadbalancerresourcenames.go @@ -0,0 +1,11 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadBalancerResourceNames struct { + BackendPoolNames *[]string `json:"backendPoolNames,omitempty"` + FrontendIPConfigurationNames *[]string `json:"frontendIpConfigurationNames,omitempty"` + HealthProbeNames *[]string `json:"healthProbeNames,omitempty"` + LoadBalancerName *string `json:"loadBalancerName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_managedrgconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_managedrgconfiguration.go new file mode 100644 index 000000000000..8d7002377ffc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_managedrgconfiguration.go @@ -0,0 +1,8 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRGConfiguration struct { + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_mountfileshareconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_mountfileshareconfiguration.go new file mode 100644 index 000000000000..c47dae32d2c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_mountfileshareconfiguration.go @@ -0,0 +1,42 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ FileShareConfiguration = MountFileShareConfiguration{} + +type MountFileShareConfiguration struct { + Id string `json:"id"` + PrivateEndpointId string `json:"privateEndpointId"` + + // Fields inherited from FileShareConfiguration +} + +var _ json.Marshaler = MountFileShareConfiguration{} + +func (s MountFileShareConfiguration) MarshalJSON() ([]byte, error) { + type wrapper MountFileShareConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling MountFileShareConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling MountFileShareConfiguration: %+v", err) + } + decoded["configurationType"] = "Mount" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling MountFileShareConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_networkconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_networkconfiguration.go new file mode 100644 index 000000000000..3805e428087a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_networkconfiguration.go @@ -0,0 +1,8 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkConfiguration struct { + IsSecondaryIPEnabled *bool `json:"isSecondaryIpEnabled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_networkinterfaceresourcenames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_networkinterfaceresourcenames.go new file mode 100644 index 000000000000..0116cdb0dc28 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_networkinterfaceresourcenames.go @@ -0,0 +1,8 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceResourceNames struct { + NetworkInterfaceName *string `json:"networkInterfaceName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_operationstatusresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_operationstatusresult.go new file mode 100644 index 000000000000..7e330b6d9cdc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_operationstatusresult.go @@ -0,0 +1,45 @@ +package sapvirtualinstances + +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 OperationStatusResult struct { + EndTime *string `json:"endTime,omitempty"` + Error *ErrorDetail `json:"error,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Operations *[]OperationStatusResult `json:"operations,omitempty"` + PercentComplete *float64 `json:"percentComplete,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status string `json:"status"` +} + +func (o *OperationStatusResult) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *OperationStatusResult) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatusResult) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_osconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_osconfiguration.go new file mode 100644 index 000000000000..ac3111e872f6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_osconfiguration.go @@ -0,0 +1,61 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSConfiguration interface { +} + +// RawOSConfigurationImpl is returned when the Discriminated Value +// doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawOSConfigurationImpl struct { + Type string + Values map[string]interface{} +} + +func unmarshalOSConfigurationImplementation(input []byte) (OSConfiguration, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling OSConfiguration into map[string]interface: %+v", err) + } + + value, ok := temp["osType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "Linux") { + var out LinuxConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into LinuxConfiguration: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Windows") { + var out WindowsConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into WindowsConfiguration: %+v", err) + } + return out, nil + } + + out := RawOSConfigurationImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_osprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_osprofile.go new file mode 100644 index 000000000000..faf6dbd93032 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_osprofile.go @@ -0,0 +1,42 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + OsConfiguration OSConfiguration `json:"osConfiguration"` +} + +var _ json.Unmarshaler = &OSProfile{} + +func (s *OSProfile) UnmarshalJSON(bytes []byte) error { + type alias OSProfile + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into OSProfile: %+v", err) + } + + s.AdminPassword = decoded.AdminPassword + s.AdminUsername = decoded.AdminUsername + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling OSProfile into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["osConfiguration"]; ok { + impl, err := unmarshalOSConfigurationImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'OsConfiguration' for 'OSProfile': %+v", err) + } + s.OsConfiguration = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_ossapconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_ossapconfiguration.go new file mode 100644 index 000000000000..d5a1d18b2852 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_ossapconfiguration.go @@ -0,0 +1,9 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OsSapConfiguration struct { + DeployerVMPackages *DeployerVMPackages `json:"deployerVmPackages,omitempty"` + SapFqdn *string `json:"sapFqdn,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapconfiguration.go new file mode 100644 index 000000000000..5cbf8ec6874e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapconfiguration.go @@ -0,0 +1,69 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPConfiguration interface { +} + +// RawSAPConfigurationImpl is returned when the Discriminated Value +// doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawSAPConfigurationImpl struct { + Type string + Values map[string]interface{} +} + +func unmarshalSAPConfigurationImplementation(input []byte) (SAPConfiguration, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling SAPConfiguration into map[string]interface: %+v", err) + } + + value, ok := temp["configurationType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "Deployment") { + var out DeploymentConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeploymentConfiguration: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "DeploymentWithOSConfig") { + var out DeploymentWithOSConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeploymentWithOSConfiguration: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Discovery") { + var out DiscoveryConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DiscoveryConfiguration: %+v", err) + } + return out, nil + } + + out := RawSAPConfigurationImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapinstallwithoutosconfigsoftwareconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapinstallwithoutosconfigsoftwareconfiguration.go new file mode 100644 index 000000000000..ba8a4310c7cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapinstallwithoutosconfigsoftwareconfiguration.go @@ -0,0 +1,44 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SoftwareConfiguration = SAPInstallWithoutOSConfigSoftwareConfiguration{} + +type SAPInstallWithoutOSConfigSoftwareConfiguration struct { + BomUrl string `json:"bomUrl"` + HighAvailabilitySoftwareConfiguration *HighAvailabilitySoftwareConfiguration `json:"highAvailabilitySoftwareConfiguration,omitempty"` + SapBitsStorageAccountId string `json:"sapBitsStorageAccountId"` + SoftwareVersion string `json:"softwareVersion"` + + // Fields inherited from SoftwareConfiguration +} + +var _ json.Marshaler = SAPInstallWithoutOSConfigSoftwareConfiguration{} + +func (s SAPInstallWithoutOSConfigSoftwareConfiguration) MarshalJSON() ([]byte, error) { + type wrapper SAPInstallWithoutOSConfigSoftwareConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SAPInstallWithoutOSConfigSoftwareConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SAPInstallWithoutOSConfigSoftwareConfiguration: %+v", err) + } + decoded["softwareInstallationType"] = "SAPInstallWithoutOSConfig" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SAPInstallWithoutOSConfigSoftwareConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapvirtualinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapvirtualinstance.go new file mode 100644 index 000000000000..608227eecd4b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapvirtualinstance.go @@ -0,0 +1,20 @@ +package sapvirtualinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPVirtualInstance struct { + Id *string `json:"id,omitempty"` + Identity *identity.UserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties SAPVirtualInstanceProperties `json:"properties"` + SystemData *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/workloads/2023-04-01/sapvirtualinstances/model_sapvirtualinstanceerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapvirtualinstanceerror.go new file mode 100644 index 000000000000..b473f684fcca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapvirtualinstanceerror.go @@ -0,0 +1,8 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPVirtualInstanceError struct { + Properties *ErrorDefinition `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapvirtualinstanceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapvirtualinstanceproperties.go new file mode 100644 index 000000000000..9df9160efa47 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sapvirtualinstanceproperties.go @@ -0,0 +1,54 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPVirtualInstanceProperties struct { + Configuration SAPConfiguration `json:"configuration"` + Environment SAPEnvironmentType `json:"environment"` + Errors *SAPVirtualInstanceError `json:"errors,omitempty"` + Health *SAPHealthState `json:"health,omitempty"` + ManagedResourceGroupConfiguration *ManagedRGConfiguration `json:"managedResourceGroupConfiguration,omitempty"` + ProvisioningState *SapVirtualInstanceProvisioningState `json:"provisioningState,omitempty"` + SapProduct SAPProductType `json:"sapProduct"` + State *SAPVirtualInstanceState `json:"state,omitempty"` + Status *SAPVirtualInstanceStatus `json:"status,omitempty"` +} + +var _ json.Unmarshaler = &SAPVirtualInstanceProperties{} + +func (s *SAPVirtualInstanceProperties) UnmarshalJSON(bytes []byte) error { + type alias SAPVirtualInstanceProperties + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into SAPVirtualInstanceProperties: %+v", err) + } + + s.Environment = decoded.Environment + s.Errors = decoded.Errors + s.Health = decoded.Health + s.ManagedResourceGroupConfiguration = decoded.ManagedResourceGroupConfiguration + s.ProvisioningState = decoded.ProvisioningState + s.SapProduct = decoded.SapProduct + s.State = decoded.State + s.Status = decoded.Status + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling SAPVirtualInstanceProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["configuration"]; ok { + impl, err := unmarshalSAPConfigurationImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Configuration' for 'SAPVirtualInstanceProperties': %+v", err) + } + s.Configuration = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_serviceinitiatedsoftwareconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_serviceinitiatedsoftwareconfiguration.go new file mode 100644 index 000000000000..55d76f5ab59f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_serviceinitiatedsoftwareconfiguration.go @@ -0,0 +1,46 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SoftwareConfiguration = ServiceInitiatedSoftwareConfiguration{} + +type ServiceInitiatedSoftwareConfiguration struct { + BomUrl string `json:"bomUrl"` + HighAvailabilitySoftwareConfiguration *HighAvailabilitySoftwareConfiguration `json:"highAvailabilitySoftwareConfiguration,omitempty"` + SapBitsStorageAccountId string `json:"sapBitsStorageAccountId"` + SapFqdn string `json:"sapFqdn"` + SoftwareVersion string `json:"softwareVersion"` + SshPrivateKey string `json:"sshPrivateKey"` + + // Fields inherited from SoftwareConfiguration +} + +var _ json.Marshaler = ServiceInitiatedSoftwareConfiguration{} + +func (s ServiceInitiatedSoftwareConfiguration) MarshalJSON() ([]byte, error) { + type wrapper ServiceInitiatedSoftwareConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServiceInitiatedSoftwareConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServiceInitiatedSoftwareConfiguration: %+v", err) + } + decoded["softwareInstallationType"] = "ServiceInitiated" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServiceInitiatedSoftwareConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sharedstorageresourcenames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sharedstorageresourcenames.go new file mode 100644 index 000000000000..0a5c9dd1dda1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sharedstorageresourcenames.go @@ -0,0 +1,9 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedStorageResourceNames struct { + SharedStorageAccountName *string `json:"sharedStorageAccountName,omitempty"` + SharedStorageAccountPrivateEndPointName *string `json:"sharedStorageAccountPrivateEndPointName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_singleserverconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_singleserverconfiguration.go new file mode 100644 index 000000000000..441b04b16288 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_singleserverconfiguration.go @@ -0,0 +1,78 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ InfrastructureConfiguration = SingleServerConfiguration{} + +type SingleServerConfiguration struct { + CustomResourceNames SingleServerCustomResourceNames `json:"customResourceNames"` + DatabaseType *SAPDatabaseType `json:"databaseType,omitempty"` + DbDiskConfiguration *DiskConfiguration `json:"dbDiskConfiguration,omitempty"` + NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` + SubnetId string `json:"subnetId"` + VirtualMachineConfiguration VirtualMachineConfiguration `json:"virtualMachineConfiguration"` + + // Fields inherited from InfrastructureConfiguration + AppResourceGroup string `json:"appResourceGroup"` +} + +var _ json.Marshaler = SingleServerConfiguration{} + +func (s SingleServerConfiguration) MarshalJSON() ([]byte, error) { + type wrapper SingleServerConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SingleServerConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SingleServerConfiguration: %+v", err) + } + decoded["deploymentType"] = "SingleServer" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SingleServerConfiguration: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &SingleServerConfiguration{} + +func (s *SingleServerConfiguration) UnmarshalJSON(bytes []byte) error { + type alias SingleServerConfiguration + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into SingleServerConfiguration: %+v", err) + } + + s.AppResourceGroup = decoded.AppResourceGroup + s.DatabaseType = decoded.DatabaseType + s.DbDiskConfiguration = decoded.DbDiskConfiguration + s.NetworkConfiguration = decoded.NetworkConfiguration + s.SubnetId = decoded.SubnetId + s.VirtualMachineConfiguration = decoded.VirtualMachineConfiguration + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling SingleServerConfiguration into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["customResourceNames"]; ok { + impl, err := unmarshalSingleServerCustomResourceNamesImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'CustomResourceNames' for 'SingleServerConfiguration': %+v", err) + } + s.CustomResourceNames = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_singleservercustomresourcenames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_singleservercustomresourcenames.go new file mode 100644 index 000000000000..9b7b0814fe3a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_singleservercustomresourcenames.go @@ -0,0 +1,53 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SingleServerCustomResourceNames interface { +} + +// RawSingleServerCustomResourceNamesImpl is returned when the Discriminated Value +// doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawSingleServerCustomResourceNamesImpl struct { + Type string + Values map[string]interface{} +} + +func unmarshalSingleServerCustomResourceNamesImplementation(input []byte) (SingleServerCustomResourceNames, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling SingleServerCustomResourceNames into map[string]interface: %+v", err) + } + + value, ok := temp["namingPatternType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "FullResourceName") { + var out SingleServerFullResourceNames + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SingleServerFullResourceNames: %+v", err) + } + return out, nil + } + + out := RawSingleServerCustomResourceNamesImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_singleserverfullresourcenames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_singleserverfullresourcenames.go new file mode 100644 index 000000000000..72c2cfdf3e6b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_singleserverfullresourcenames.go @@ -0,0 +1,41 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SingleServerCustomResourceNames = SingleServerFullResourceNames{} + +type SingleServerFullResourceNames struct { + VirtualMachine *VirtualMachineResourceNames `json:"virtualMachine,omitempty"` + + // Fields inherited from SingleServerCustomResourceNames +} + +var _ json.Marshaler = SingleServerFullResourceNames{} + +func (s SingleServerFullResourceNames) MarshalJSON() ([]byte, error) { + type wrapper SingleServerFullResourceNames + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SingleServerFullResourceNames: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SingleServerFullResourceNames: %+v", err) + } + decoded["namingPatternType"] = "FullResourceName" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SingleServerFullResourceNames: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_skipfileshareconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_skipfileshareconfiguration.go new file mode 100644 index 000000000000..764e4ad74716 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_skipfileshareconfiguration.go @@ -0,0 +1,40 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ FileShareConfiguration = SkipFileShareConfiguration{} + +type SkipFileShareConfiguration struct { + + // Fields inherited from FileShareConfiguration +} + +var _ json.Marshaler = SkipFileShareConfiguration{} + +func (s SkipFileShareConfiguration) MarshalJSON() ([]byte, error) { + type wrapper SkipFileShareConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SkipFileShareConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SkipFileShareConfiguration: %+v", err) + } + decoded["configurationType"] = "Skip" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SkipFileShareConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_softwareconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_softwareconfiguration.go new file mode 100644 index 000000000000..50f3ddb99cb7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_softwareconfiguration.go @@ -0,0 +1,69 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SoftwareConfiguration interface { +} + +// RawSoftwareConfigurationImpl is returned when the Discriminated Value +// doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawSoftwareConfigurationImpl struct { + Type string + Values map[string]interface{} +} + +func unmarshalSoftwareConfigurationImplementation(input []byte) (SoftwareConfiguration, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling SoftwareConfiguration into map[string]interface: %+v", err) + } + + value, ok := temp["softwareInstallationType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "External") { + var out ExternalInstallationSoftwareConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ExternalInstallationSoftwareConfiguration: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "SAPInstallWithoutOSConfig") { + var out SAPInstallWithoutOSConfigSoftwareConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SAPInstallWithoutOSConfigSoftwareConfiguration: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ServiceInitiated") { + var out ServiceInitiatedSoftwareConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServiceInitiatedSoftwareConfiguration: %+v", err) + } + return out, nil + } + + out := RawSoftwareConfigurationImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sshconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sshconfiguration.go new file mode 100644 index 000000000000..8aa35391df67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sshkeypair.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sshkeypair.go new file mode 100644 index 000000000000..c8c9f86c5358 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sshkeypair.go @@ -0,0 +1,9 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshKeyPair struct { + PrivateKey *string `json:"privateKey,omitempty"` + PublicKey *string `json:"publicKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sshpublickey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sshpublickey.go new file mode 100644 index 000000000000..4bd500694318 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_sshpublickey.go @@ -0,0 +1,8 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_stoprequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_stoprequest.go new file mode 100644 index 000000000000..372c6b2f2af5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_stoprequest.go @@ -0,0 +1,8 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopRequest struct { + SoftStopTimeoutSeconds *int64 `json:"softStopTimeoutSeconds,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_storageconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_storageconfiguration.go new file mode 100644 index 000000000000..2c688a25d7af --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_storageconfiguration.go @@ -0,0 +1,32 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageConfiguration struct { + TransportFileShareConfiguration FileShareConfiguration `json:"transportFileShareConfiguration"` +} + +var _ json.Unmarshaler = &StorageConfiguration{} + +func (s *StorageConfiguration) UnmarshalJSON(bytes []byte) error { + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling StorageConfiguration into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["transportFileShareConfiguration"]; ok { + impl, err := unmarshalFileShareConfigurationImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'TransportFileShareConfiguration' for 'StorageConfiguration': %+v", err) + } + s.TransportFileShareConfiguration = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_threetierconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_threetierconfiguration.go new file mode 100644 index 000000000000..6ae4e32a5c0b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_threetierconfiguration.go @@ -0,0 +1,80 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ InfrastructureConfiguration = ThreeTierConfiguration{} + +type ThreeTierConfiguration struct { + ApplicationServer ApplicationServerConfiguration `json:"applicationServer"` + CentralServer CentralServerConfiguration `json:"centralServer"` + CustomResourceNames ThreeTierCustomResourceNames `json:"customResourceNames"` + DatabaseServer DatabaseConfiguration `json:"databaseServer"` + HighAvailabilityConfig *HighAvailabilityConfiguration `json:"highAvailabilityConfig,omitempty"` + NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` + StorageConfiguration *StorageConfiguration `json:"storageConfiguration,omitempty"` + + // Fields inherited from InfrastructureConfiguration + AppResourceGroup string `json:"appResourceGroup"` +} + +var _ json.Marshaler = ThreeTierConfiguration{} + +func (s ThreeTierConfiguration) MarshalJSON() ([]byte, error) { + type wrapper ThreeTierConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ThreeTierConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ThreeTierConfiguration: %+v", err) + } + decoded["deploymentType"] = "ThreeTier" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ThreeTierConfiguration: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &ThreeTierConfiguration{} + +func (s *ThreeTierConfiguration) UnmarshalJSON(bytes []byte) error { + type alias ThreeTierConfiguration + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into ThreeTierConfiguration: %+v", err) + } + + s.AppResourceGroup = decoded.AppResourceGroup + s.ApplicationServer = decoded.ApplicationServer + s.CentralServer = decoded.CentralServer + s.DatabaseServer = decoded.DatabaseServer + s.HighAvailabilityConfig = decoded.HighAvailabilityConfig + s.NetworkConfiguration = decoded.NetworkConfiguration + s.StorageConfiguration = decoded.StorageConfiguration + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling ThreeTierConfiguration into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["customResourceNames"]; ok { + impl, err := unmarshalThreeTierCustomResourceNamesImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'CustomResourceNames' for 'ThreeTierConfiguration': %+v", err) + } + s.CustomResourceNames = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_threetiercustomresourcenames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_threetiercustomresourcenames.go new file mode 100644 index 000000000000..55eebe79ef5d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_threetiercustomresourcenames.go @@ -0,0 +1,53 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ThreeTierCustomResourceNames interface { +} + +// RawThreeTierCustomResourceNamesImpl is returned when the Discriminated Value +// doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawThreeTierCustomResourceNamesImpl struct { + Type string + Values map[string]interface{} +} + +func unmarshalThreeTierCustomResourceNamesImplementation(input []byte) (ThreeTierCustomResourceNames, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling ThreeTierCustomResourceNames into map[string]interface: %+v", err) + } + + value, ok := temp["namingPatternType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "FullResourceName") { + var out ThreeTierFullResourceNames + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ThreeTierFullResourceNames: %+v", err) + } + return out, nil + } + + out := RawThreeTierCustomResourceNamesImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_threetierfullresourcenames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_threetierfullresourcenames.go new file mode 100644 index 000000000000..2d5be5fede64 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_threetierfullresourcenames.go @@ -0,0 +1,44 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ThreeTierCustomResourceNames = ThreeTierFullResourceNames{} + +type ThreeTierFullResourceNames struct { + ApplicationServer *ApplicationServerFullResourceNames `json:"applicationServer,omitempty"` + CentralServer *CentralServerFullResourceNames `json:"centralServer,omitempty"` + DatabaseServer *DatabaseServerFullResourceNames `json:"databaseServer,omitempty"` + SharedStorage *SharedStorageResourceNames `json:"sharedStorage,omitempty"` + + // Fields inherited from ThreeTierCustomResourceNames +} + +var _ json.Marshaler = ThreeTierFullResourceNames{} + +func (s ThreeTierFullResourceNames) MarshalJSON() ([]byte, error) { + type wrapper ThreeTierFullResourceNames + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ThreeTierFullResourceNames: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ThreeTierFullResourceNames: %+v", err) + } + decoded["namingPatternType"] = "FullResourceName" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ThreeTierFullResourceNames: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_updatesapvirtualinstancerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_updatesapvirtualinstancerequest.go new file mode 100644 index 000000000000..bb73eb29185a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_updatesapvirtualinstancerequest.go @@ -0,0 +1,13 @@ +package sapvirtualinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSAPVirtualInstanceRequest struct { + Identity *identity.UserAssignedMap `json:"identity,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_virtualmachineconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_virtualmachineconfiguration.go new file mode 100644 index 000000000000..ec4bdf513ab4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_virtualmachineconfiguration.go @@ -0,0 +1,10 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineConfiguration struct { + ImageReference ImageReference `json:"imageReference"` + OsProfile OSProfile `json:"osProfile"` + VMSize string `json:"vmSize"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_virtualmachineresourcenames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_virtualmachineresourcenames.go new file mode 100644 index 000000000000..a9767d0a758c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_virtualmachineresourcenames.go @@ -0,0 +1,12 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineResourceNames struct { + DataDiskNames *map[string][]string `json:"dataDiskNames,omitempty"` + HostName *string `json:"hostName,omitempty"` + NetworkInterfaces *[]NetworkInterfaceResourceNames `json:"networkInterfaces,omitempty"` + OsDiskName *string `json:"osDiskName,omitempty"` + VirtualMachineName *string `json:"vmName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_windowsconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_windowsconfiguration.go new file mode 100644 index 000000000000..138faef716a8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/model_windowsconfiguration.go @@ -0,0 +1,40 @@ +package sapvirtualinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ OSConfiguration = WindowsConfiguration{} + +type WindowsConfiguration struct { + + // Fields inherited from OSConfiguration +} + +var _ json.Marshaler = WindowsConfiguration{} + +func (s WindowsConfiguration) MarshalJSON() ([]byte, error) { + type wrapper WindowsConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling WindowsConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling WindowsConfiguration: %+v", err) + } + decoded["osType"] = "Windows" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling WindowsConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/predicates.go new file mode 100644 index 000000000000..7b18cd9294a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/predicates.go @@ -0,0 +1,32 @@ +package sapvirtualinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SAPVirtualInstanceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SAPVirtualInstanceOperationPredicate) Matches(input SAPVirtualInstance) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/version.go new file mode 100644 index 000000000000..7da86029fc41 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances/version.go @@ -0,0 +1,12 @@ +package sapvirtualinstances + +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 = "2023-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sapvirtualinstances/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 936d3bd6d386..a180c42e3073 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1057,6 +1057,18 @@ github.com/hashicorp/go-azure-sdk/resource-manager/web/2023-01-01/staticsites github.com/hashicorp/go-azure-sdk/resource-manager/web/2023-01-01/webapps github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2023-02-01 github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2023-02-01/webpubsub +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01 +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/monitors +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/providerinstances +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapapplicationserverinstances +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapcentralinstances +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdatabaseinstances +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapdiskconfigurations +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplandscapemonitor +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku +github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances # github.com/hashicorp/go-azure-sdk/sdk v0.20240229.1102109 ## explicit; go 1.21 github.com/hashicorp/go-azure-sdk/sdk/auth diff --git a/website/allowed-subcategories b/website/allowed-subcategories index 03ff6eb30c30..02458d23c175 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -110,4 +110,5 @@ Time Series Insights VMware (AVS) Video Analyzer Voice Services -Web PubSub \ No newline at end of file +Web PubSub +Workloads \ No newline at end of file diff --git a/website/docs/r/workloads_sap_three_tier_virtual_instance.html.markdown b/website/docs/r/workloads_sap_three_tier_virtual_instance.html.markdown new file mode 100644 index 000000000000..6ba9f89d015e --- /dev/null +++ b/website/docs/r/workloads_sap_three_tier_virtual_instance.html.markdown @@ -0,0 +1,561 @@ +--- +subcategory: "Workloads" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_workloads_sap_three_tier_virtual_instance" +description: |- + Manages an SAP Three Tier Virtual Instance with a new SAP System. +--- + +# azurerm_workloads_sap_three_tier_virtual_instance + +Manages an SAP Three Tier Virtual Instance with a new SAP System. + +-> **Note:** Before using this resource, it's required to submit the request of registering the Resource Provider with Azure CLI `az provider register --namespace "Microsoft.Workloads"`. The Resource Provider can take a while to register, you can check the status by running `az provider show --namespace "Microsoft.Workloads" --query "registrationState"`. Once this outputs "Registered" the Resource Provider is available for use. + +## Example Usage + +```hcl +resource "tls_private_key" "example" { + algorithm = "RSA" + rsa_bits = 4096 +} + +data "tls_public_key" "example" { + private_key_pem = tls_private_key.example.private_key_pem +} + +data "azurerm_subscription" "current" {} + +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_user_assigned_identity" "example" { + name = "example-uai" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name +} + +resource "azurerm_role_assignment" "example" { + scope = data.azurerm_subscription.current.id + role_definition_name = "Azure Center for SAP solutions service role" + principal_id = azurerm_user_assigned_identity.example.principal_id +} + +resource "azurerm_virtual_network" "example" { + name = "example-vnet" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name +} + +resource "azurerm_subnet" "example" { + name = "example-subnet" + resource_group_name = azurerm_resource_group.example.name + virtual_network_name = azurerm_virtual_network.example.name + address_prefixes = ["10.0.2.0/24"] +} + +resource "azurerm_resource_group" "app" { + name = "example-sapapp" + location = "West Europe" + + depends_on = [ + azurerm_subnet.example + ] +} + +resource "azurerm_storage_account" "example" { + name = "examplesa" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_workloads_sap_three_tier_virtual_instance" "example" { + name = "X05" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + environment = "NonProd" + sap_product = "S4HANA" + managed_resource_group_name = "exampleManagedRG" + app_location = azurerm_resource_group.app.location + sap_fqdn = "sap.bpaas.com" + + three_tier_configuration { + app_resource_group_name = azurerm_resource_group.app.name + secondary_ip_enabled = true + + application_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.example.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_D16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.example.private_key_pem + ssh_public_key = data.tls_public_key.example.public_key_openssh + } + } + } + + central_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.example.id + + virtual_machine_configuration { + virtual_machine_size = "Standard_D16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.example.private_key_pem + ssh_public_key = data.tls_public_key.example.public_key_openssh + } + } + } + + database_server_configuration { + instance_count = 1 + subnet_id = azurerm_subnet.example.id + database_type = "HANA" + + virtual_machine_configuration { + virtual_machine_size = "Standard_E16ds_v4" + + image { + offer = "RHEL-SAP-HA" + publisher = "RedHat" + sku = "82sapha-gen2" + version = "latest" + } + + os_profile { + admin_username = "testAdmin" + ssh_private_key = tls_private_key.example.private_key_pem + ssh_public_key = data.tls_public_key.example.public_key_openssh + } + } + + disk_volume_configuration { + volume_name = "hana/data" + number_of_disks = 3 + size_in_gb = 128 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "hana/log" + number_of_disks = 3 + size_in_gb = 128 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "hana/shared" + number_of_disks = 1 + size_in_gb = 256 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "usr/sap" + number_of_disks = 1 + size_in_gb = 128 + sku_name = "Premium_LRS" + } + + disk_volume_configuration { + volume_name = "backup" + number_of_disks = 2 + size_in_gb = 256 + sku_name = "StandardSSD_LRS" + } + + disk_volume_configuration { + volume_name = "os" + number_of_disks = 1 + size_in_gb = 64 + sku_name = "StandardSSD_LRS" + } + } + + resource_names { + application_server { + availability_set_name = "appAvSet" + + virtual_machine { + host_name = "apphostName0" + os_disk_name = "app0osdisk" + virtual_machine_name = "appvm0" + network_interface_names = ["appnic0"] + + data_disk { + volume_name = "default" + names = ["app0disk0"] + } + } + } + + central_server { + availability_set_name = "csAvSet" + + load_balancer { + name = "ascslb" + backend_pool_names = ["ascsBackendPool"] + frontend_ip_configuration_names = ["ascsip0"] + health_probe_names = ["ascsHealthProbe"] + } + + virtual_machine { + host_name = "ascshostName" + os_disk_name = "ascsosdisk" + virtual_machine_name = "ascsvm" + network_interface_names = ["ascsnic"] + + data_disk { + volume_name = "default" + names = ["ascsdisk"] + } + } + } + + database_server { + availability_set_name = "dbAvSet" + + load_balancer { + name = "dblb" + backend_pool_names = ["dbBackendPool"] + frontend_ip_configuration_names = ["dbip"] + health_probe_names = ["dbHealthProbe"] + } + + virtual_machine { + host_name = "dbprhost" + os_disk_name = "dbprosdisk" + virtual_machine_name = "dbvmpr" + network_interface_names = ["dbprnic"] + + data_disk { + volume_name = "hanaData" + names = ["hanadatapr0", "hanadatapr1"] + } + + data_disk { + volume_name = "hanaLog" + names = ["hanalogpr0", "hanalogpr1", "hanalogpr2"] + } + + data_disk { + volume_name = "usrSap" + names = ["usrsappr0"] + } + + data_disk { + volume_name = "hanaShared" + names = ["hanasharedpr0", "hanasharedpr1"] + } + } + } + + shared_storage { + account_name = "sharedexamplesa" + private_endpoint_name = "examplePE" + } + } + + transport_create_and_mount { + resource_group_id = azurerm_resource_group.app.id + storage_account_name = "exampletranssa" + } + } + + identity { + type = "UserAssigned" + + identity_ids = [ + azurerm_user_assigned_identity.example.id, + ] + } + + tags = { + Env = "Test" + } + + depends_on = [ + azurerm_role_assignment.example + ] +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name of this SAP Three Tier Virtual Instance. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the Resource Group where the SAP Three Tier Virtual Instance should exist. Changing this forces a new resource to be created. + +* `location` - (Required) The Azure Region where the SAP Three Tier Virtual Instance should exist. Changing this forces a new resource to be created. + +* `app_location` - (Required) The Geo-Location where the SAP system is to be created. Changing this forces a new resource to be created. + +* `environment` - (Required) The environment type for the SAP Three Tier Virtual Instance. Possible values are `NonProd` and `Prod`. Changing this forces a new resource to be created. + +* `sap_fqdn` - (Required) The FQDN of the SAP system. Changing this forces a new resource to be created. + +* `sap_product` - (Required) The SAP Product type for the SAP Three Tier Virtual Instance. Possible values are `ECC`, `Other` and `S4HANA`. Changing this forces a new resource to be created. + +* `three_tier_configuration` - (Required) A `three_tier_configuration` block as defined below. Changing this forces a new resource to be created. + +* `identity` - (Optional) An `identity` block as defined below. + +* `managed_resource_group_name` - (Optional) The name of the managed Resource Group for the SAP Three Tier Virtual Instance. Changing this forces a new resource to be created. + +* `tags` - (Optional) A mapping of tags which should be assigned to the SAP Three Tier Virtual Instance. + +--- + +A `disk_volume_configuration` block supports the following: + +* `volume_name` - (Required) Specifies the volumn name of the database disk. Possible values are `backup`, `hana/data`, `hana/log`, `hana/shared`, `os` and `usr/sap`. Changing this forces a new resource to be created. + +* `number_of_disks` - (Required) The total number of disks required for the concerned volume. Possible values are at least `1`. Changing this forces a new resource to be created. + +* `size_in_gb` - (Required) The size of the Disk in GB. Changing this forces a new resource to be created. + +* `sku_name` - (Required) The name of the Disk SKU. Possible values are `Premium_LRS`, `PremiumV2_LRS`, `Premium_ZRS`, `Standard_LRS`, `StandardSSD_LRS`, `StandardSSD_ZRS` and `UltraSSD_LRS`. Changing this forces a new resource to be created. + +--- + +A `virtual_machine_configuration` block supports the following: + +* `image` - (Required) An `image` block as defined below. Changing this forces a new resource to be created. + +* `os_profile` - (Required) An `os_profile` block as defined below. Changing this forces a new resource to be created. + +* `virtual_machine_size` - (Required) The size of the Virtual Machine. Changing this forces a new resource to be created. + +--- + +An `image` block supports the following: + +* `offer` - (Required) Specifies the offer of the platform image or marketplace image used to create the virtual machine. Changing this forces a new resource to be created. + +* `publisher` - (Required) The publisher of the Image. Possible values are `RedHat` and `SUSE`. Changing this forces a new resource to be created. + +* `sku` - (Required) The SKU of the Image. Changing this forces a new resource to be created. + +* `version` - (Required) Specifies the version of the platform image or marketplace image used to create the virtual machine. Changing this forces a new resource to be created. + +--- + +An `os_profile` block supports the following: + +* `admin_username` - (Required) The name of the administrator account. Changing this forces a new resource to be created. + +* `ssh_private_key` - (Required) The SSH public key that is used to authenticate with the Virtual Machine. Changing this forces a new resource to be created. + +* `ssh_public_key` - (Required) The SSH private key that is used to authenticate with the Virtual Machine. Changing this forces a new resource to be created. + +--- + +A `three_tier_configuration` block supports the following: + +* `app_resource_group_name` - (Required) The name of the application Resource Group where SAP system resources will be deployed. Changing this forces a new resource to be created. + +~> **Note:** While creating an SAP Three Tier Virtual Instance, the service will provision the extra SAP systems/components in the `app_resource_group_name` that are not defined in the HCL Configuration. At this time, if the `app_resource_group_name` is different from the Resource Group where SAP Three Tier Virtual Instance exists, you can set `prevent_deletion_if_contains_resources` to `false` to delete all resources defined in the HCL Configurations and the resources created in the `app_resource_group_name` with `terraform destroy`. However, if the `app_resource_group_name` is the same with the Resource Group where SAP Three Tier Virtual Instance exists, some resources, such as the subnet defined in the HCL Configuration, cannot be deleted with `terraform destroy` since the resources defined in the HCL Configuration are being referenced by the SAP system/component. In this case, you have to manually delete the SAP system/component before deleting the resources in the HCL Configuration. + +* `application_server_configuration` - (Required) An `application_server_configuration` block as defined below. Changing this forces a new resource to be created. + +* `central_server_configuration` - (Required) A `central_server_configuration` block as defined below. Changing this forces a new resource to be created. + +* `database_server_configuration` - (Required) A `database_server_configuration` block as defined below. Changing this forces a new resource to be created. + +* `resource_names` - (Optional) A `resource_names` block as defined below. Changing this forces a new resource to be created. + +* `high_availability_type` - (Optional) The high availability type for the three tier configuration. Possible values are `AvailabilitySet` and `AvailabilityZone`. Changing this forces a new resource to be created. + +* `secondary_ip_enabled` - (Optional) Specifies whether a secondary IP address should be added to the network interface on all VMs of the SAP system being deployed. Defaults to `false`. Changing this forces a new resource to be created. + +* `transport_create_and_mount` - (Optional) A `transport_create_and_mount` block as defined below. Changing this forces a new resource to be created. + +~> **Note:** The file share configuration uses `skip` by default when `transport_create_and_mount` isn't set. + +~> **Note:** Due to [a bug in the Azure API](https://github.com/Azure/azure-rest-api-specs/issues/25209) where the Storage File Share Id is not defined correctly, it is not currently possible to support using Transport Mount. + +--- + +A `transport_create_and_mount` block supports the following: + +* `resource_group_id` - (Optional) The ID of the Resource Group of the transport File Share. Changing this forces a new resource to be created. + +* `storage_account_name` - (Optional) The name of the Storage Account of the File Share. Changing this forces a new resource to be created. + +--- + +An `application_server_configuration` block supports the following: + +* `instance_count` - (Required) The number of instances for the Application Server. Possible values are at least `1`. Changing this forces a new resource to be created. + +* `subnet_id` - (Required) The resource ID of the Subnet for the Application Server. Changing this forces a new resource to be created. + +* `virtual_machine_configuration` - (Required) A `virtual_machine_configuration` block as defined below. Changing this forces a new resource to be created. + +--- + +A `central_server_configuration` block supports the following: + +* `instance_count` - (Required) The number of instances for the Central Server. Possible values are at least `1`. Changing this forces a new resource to be created. + +* `subnet_id` - (Required) The resource ID of the Subnet for the Central Server. Changing this forces a new resource to be created. + +* `virtual_machine_configuration` - (Required) A `virtual_machine_configuration` block as defined below. Changing this forces a new resource to be created. + +--- + +A `database_server_configuration` block supports the following: + +* `instance_count` - (Required) The number of instances for the Database Server. Possible values are at least `1`. Changing this forces a new resource to be created. + +* `subnet_id` - (Required) The resource ID of the Subnet for the Database Server. Changing this forces a new resource to be created. + +* `virtual_machine_configuration` - (Required) A `virtual_machine_configuration` block as defined below. Changing this forces a new resource to be created. + +* `database_type` - (Optional) The database type for the Database Server. Possible values are `DB2` and `HANA`. Changing this forces a new resource to be created. + +* `disk_volume_configuration` - (Optional) One or more `disk_volume_configuration` blocks as defined below. Changing this forces a new resource to be created. + +--- + +A `resource_names` block supports the following: + +* `application_server` - (Optional) An `application_server` block as defined below. Changing this forces a new resource to be created. + +* `central_server` - (Optional) A `central_server` block as defined below. Changing this forces a new resource to be created. + +* `database_server` - (Optional) A `database_server` block as defined below. Changing this forces a new resource to be created. + +* `shared_storage` - (Optional) A `shared_storage` block as defined below. Changing this forces a new resource to be created. + +--- + +An `application_server` block supports the following: + +* `availability_set_name` - (Optional) The full name for the availability set. Changing this forces a new resource to be created. + +* `virtual_machine` - (Optional) One or more `virtual_machine` blocks as defined below. Changing this forces a new resource to be created. + +--- + +A `virtual_machine` block supports the following: + +* `data_disk` - (Optional) One or more `data_disk` blocks as defined below. Changing this forces a new resource to be created. + +* `host_name` - (Optional) The full name of the host of the Virtual Machine. Changing this forces a new resource to be created. + +* `network_interface_names` - (Optional) A list of full names for the Network Interface of the Virtual Machine. Changing this forces a new resource to be created. + +* `os_disk_name` - (Optional) The full name of the OS Disk attached to the Virtual Machine. Changing this forces a new resource to be created. + +* `virtual_machine_name` - (Optional) The full name of the Virtual Machine in a single server SAP system. Changing this forces a new resource to be created. + +--- + +A `data_disk` block supports the following: + +* `volume_name` - (Required) The name of the Volume. Changing this forces a new resource to be created. + +~> **Note:** Possible value for Application Server and Central Server is `default`. + +~> **Note:** Possible values for Database Server are `hanaData`, `hanaLog`, `hanaShared` and `usrSap`. + +* `names` - (Required) A list of full names of Data Disks per Volume. Changing this forces a new resource to be created. + +--- + +A `central_server` block supports the following: + +* `availability_set_name` - (Optional) The full name for the availability set. Changing this forces a new resource to be created. + +* `load_balancer` - (Optional) A `load_balancer` block as defined below. Changing this forces a new resource to be created. + +* `virtual_machine` - (Optional) One or more `virtual_machine` blocks as defined below. Changing this forces a new resource to be created. + +--- + +A `load_balancer` block supports the following: + +* `name` - (Optional) The full resource name of the Load Balancer. Changing this forces a new resource to be created. + +* `backend_pool_names` - (Optional) A list of Backend Pool names for the Load Balancer. Changing this forces a new resource to be created. + +* `frontend_ip_configuration_names` - (Optional) A list of Frontend IP Configuration names. Changing this forces a new resource to be created. + +* `health_probe_names` - (Optional) A list of Health Probe names. Changing this forces a new resource to be created. + +--- + +A `database_server` block supports the following: + +* `availability_set_name` - (Optional) The full name for the availability set. Changing this forces a new resource to be created. + +* `load_balancer` - (Optional) A `load_balancer` block as defined below. Changing this forces a new resource to be created. + +* `virtual_machine` - (Optional) One or more `virtual_machine` blocks as defined below. Changing this forces a new resource to be created. + +--- + +A `shared_storage` block supports the following: + +* `account_name` - (Optional) The full name of the Shared Storage Account. Changing this forces a new resource to be created. + +* `private_endpoint_name` - (Optional) The full name of Private Endpoint for the Shared Storage Account. Changing this forces a new resource to be created. + +--- + +An `identity` block supports the following: + +* `type` - (Required) The type of Managed Service Identity that should be configured on this SAP Three Tier Virtual Instance. Only possible value is `UserAssigned`. + +* `identity_ids` - (Required) A list of User Assigned Managed Identity IDs to be assigned to this SAP Three Tier Virtual Instance. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the SAP Three Tier Virtual Instance. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 60 minutes) Used when creating the SAP Three Tier Virtual Instance with new SAP System. +* `read` - (Defaults to 5 minutes) Used when retrieving the SAP Three Tier Virtual Instance with new SAP System. +* `update` - (Defaults to 60 minutes) Used when updating the SAP Three Tier Virtual Instance with new SAP System. +* `delete` - (Defaults to 60 minutes) Used when deleting the SAP Three Tier Virtual Instance with new SAP System. + +## Import + +SAP Three Tier Virtual Instances with new SAP Systems can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_workloads_sap_three_tier_virtual_instance.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Workloads/sapVirtualInstances/vis1 +```