diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index dd41adb93915..d55c98783de4 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -342,6 +342,9 @@ service/subscription: service/synapse: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_synapse_((.|\n)*)###' +service/systemcentervirtualmachinemanager: + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_system_center_virtual_machine_manager_server((.|\n)*)###' + service/traffic-manager: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_traffic_manager_((.|\n)*)###' diff --git a/.github/labeler-pull-request-triage.yml b/.github/labeler-pull-request-triage.yml index 9d7538b8c6a7..99338ec8b910 100644 --- a/.github/labeler-pull-request-triage.yml +++ b/.github/labeler-pull-request-triage.yml @@ -575,6 +575,11 @@ service/synapse: - any-glob-to-any-file: - internal/services/synapse/**/* +service/systemcentervirtualmachinemanager: +- changed-files: + - any-glob-to-any-file: + - internal/services/systemcentervirtualmachinemanager/**/* + service/traffic-manager: - changed-files: - any-glob-to-any-file: diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index 4a67bbc75ebb..d72e546499d2 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -126,6 +126,7 @@ var services = mapOf( "streamanalytics" to "Stream Analytics", "subscription" to "Subscription", "synapse" to "Synapse", + "systemcentervirtualmachinemanager" to "System Center Virtual Machine Manager", "iottimeseriesinsights" to "Time Series Insights", "trafficmanager" to "Traffic Manager", "vmware" to "VMware", diff --git a/internal/clients/client.go b/internal/clients/client.go index ea5656ccaab0..9a2d2c24f169 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -21,6 +21,7 @@ import ( redis_2023_08_01 "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2023-08-01" servicenetworking_v2023_05_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview" 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" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/hashicorp/terraform-provider-azurerm/internal/features" @@ -158,129 +159,130 @@ type Client struct { Account *ResourceManagerAccount Features features.UserFeatures - AadB2c *aadb2c_v2021_04_01_preview.Client - Advisor *advisor.Client - AnalysisServices *analysisservices_v2017_08_01.Client - ApiManagement *apiManagement.Client - AppConfiguration *appConfiguration.Client - AppInsights *applicationInsights.Client - AppPlatform *appPlatform.Client - AppService *appService.Client - ArcKubernetes *arckubernetes.Client - ArcResourceBridge *arcResourceBridge.Client - Attestation *attestation.Client - Authorization *authorization.Client - Automanage *automanage.Client - Automation *automation.Client - AzureStackHCI *azurestackhci_v2023_08_01.Client - Batch *batch.Client - Blueprints *blueprints.Client - Bot *bot.Client - Cdn *cdn.Client - Cognitive *cognitiveServices.Client - Communication *communication.Client - Compute *compute.Client - ConfidentialLedger *confidentialledger.Client - Connections *connections.Client - Consumption *consumption.Client - ContainerApps *containerapps.Client - Containers *containerServices.Client - Cosmos *cosmosdb.Client - CostManagement *costmanagement.Client - CustomProviders *customproviders.Client - Dashboard *dashboard.Client - DatabaseMigration *datamigration.Client - DataBricks *databricks.Client - DataboxEdge *databoxedge.Client - Datadog *datadog_v2021_03_01.Client - DataFactory *datafactory.Client - DataProtection *dataprotection.Client - DataShare *datashare.Client - DesktopVirtualization *desktopvirtualization.Client - DevTestLabs *devtestlabs.Client - DigitalTwins *digitaltwins.Client - Disks *disks.Client - Dns *dns_v2018_05_01.Client - DomainServices *domainservices.Client - Elastic *elastic.Client - ElasticSan *elasticsan.Client - EventGrid *eventgrid_v2022_06_15.Client - Eventhub *eventhub.Client - FluidRelay *fluidrelay_2022_05_26.Client - Frontdoor *frontdoor.Client - Graph *graph.Client - HSM *hsm.Client - HDInsight *hdinsight_v2021_06_01.Client - HybridCompute *hybridcompute.Client - HealthCare *healthcare.Client - IoTCentral *iotcentral.Client - IoTHub *iothub.Client - IoTTimeSeriesInsights *timeseriesinsights_v2020_05_15.Client - KeyVault *keyvault.Client - Kusto *kusto.Client - LabService *labservice.Client - Legacy *legacy.Client - Lighthouse *lighthouse.Client - LoadBalancers *loadbalancers.Client - LogAnalytics *loganalytics.Client - Logic *logic.Client - Logz *logz.Client - MachineLearning *machinelearning.Client - Maintenance *maintenance.Client - ManagedApplication *managedapplication.Client - ManagementGroups *managementgroup.Client - ManagedHSMs *managedhsm.Client - Maps *maps.Client - MariaDB *mariadb.Client - Media *media.Client - MixedReality *mixedreality.Client - Monitor *monitor.Client - MobileNetwork *mobilenetwork.Client - MSSQL *mssql.Client - MSSQLManagedInstance *mssqlmanagedinstance.Client - MySQL *mysql.Client - NetApp *netapp.Client - Network *network.Client - NetworkFunction *networkfunction.Client - NewRelic *newrelic.Client - Nginx *nginx_2023_09_01.Client - NotificationHubs *notificationhub.Client - Orbital *orbital.Client - PaloAlto *paloalto.Client - Policy *policy.Client - Portal *portal.Client - Postgres *postgres.Client - PowerBI *powerBI.Client - PrivateDns *privatedns.Client - PrivateDnsResolver *dnsresolver.Client - Purview *purview.Client - RecoveryServices *recoveryServices.Client - RedHatOpenShift *redhatopenshift.Client - Redis *redis_2023_08_01.Client - RedisEnterprise *redisenterprise.Client - Relay *relay.Client - Resource *resource.Client - Search *search.Client - SecurityCenter *securityCenter.Client - Sentinel *sentinel.Client - ServiceBus *serviceBus.Client - ServiceConnector *serviceConnector.Client - ServiceFabric *serviceFabric.Client - ServiceFabricManaged *serviceFabricManaged.Client - ServiceNetworking *servicenetworking_v2023_05_01_preview.Client - SignalR *signalr.Client - Storage *storage.Client - StorageCache *storagecache_2023_05_01.Client - StorageMover *storageMover.Client - StreamAnalytics *streamAnalytics.Client - Subscription *subscription.Client - Sql *sql.Client - Synapse *synapse.Client - TrafficManager *trafficManager.Client - VideoAnalyzer *videoAnalyzer.Client - Vmware *vmware.Client - VoiceServices *voiceServices.Client - Web *web.Client + AadB2c *aadb2c_v2021_04_01_preview.Client + Advisor *advisor.Client + AnalysisServices *analysisservices_v2017_08_01.Client + ApiManagement *apiManagement.Client + AppConfiguration *appConfiguration.Client + AppInsights *applicationInsights.Client + AppPlatform *appPlatform.Client + AppService *appService.Client + ArcKubernetes *arckubernetes.Client + ArcResourceBridge *arcResourceBridge.Client + Attestation *attestation.Client + Authorization *authorization.Client + Automanage *automanage.Client + Automation *automation.Client + AzureStackHCI *azurestackhci_v2023_08_01.Client + Batch *batch.Client + Blueprints *blueprints.Client + Bot *bot.Client + Cdn *cdn.Client + Cognitive *cognitiveServices.Client + Communication *communication.Client + Compute *compute.Client + ConfidentialLedger *confidentialledger.Client + Connections *connections.Client + Consumption *consumption.Client + ContainerApps *containerapps.Client + Containers *containerServices.Client + Cosmos *cosmosdb.Client + CostManagement *costmanagement.Client + CustomProviders *customproviders.Client + Dashboard *dashboard.Client + DatabaseMigration *datamigration.Client + DataBricks *databricks.Client + DataboxEdge *databoxedge.Client + Datadog *datadog_v2021_03_01.Client + DataFactory *datafactory.Client + DataProtection *dataprotection.Client + DataShare *datashare.Client + DesktopVirtualization *desktopvirtualization.Client + DevTestLabs *devtestlabs.Client + DigitalTwins *digitaltwins.Client + Disks *disks.Client + Dns *dns_v2018_05_01.Client + DomainServices *domainservices.Client + Elastic *elastic.Client + ElasticSan *elasticsan.Client + EventGrid *eventgrid_v2022_06_15.Client + Eventhub *eventhub.Client + FluidRelay *fluidrelay_2022_05_26.Client + Frontdoor *frontdoor.Client + Graph *graph.Client + HSM *hsm.Client + HDInsight *hdinsight_v2021_06_01.Client + HybridCompute *hybridcompute.Client + HealthCare *healthcare.Client + IoTCentral *iotcentral.Client + IoTHub *iothub.Client + IoTTimeSeriesInsights *timeseriesinsights_v2020_05_15.Client + KeyVault *keyvault.Client + Kusto *kusto.Client + LabService *labservice.Client + Legacy *legacy.Client + Lighthouse *lighthouse.Client + LoadBalancers *loadbalancers.Client + LogAnalytics *loganalytics.Client + Logic *logic.Client + Logz *logz.Client + MachineLearning *machinelearning.Client + Maintenance *maintenance.Client + ManagedApplication *managedapplication.Client + ManagementGroups *managementgroup.Client + ManagedHSMs *managedhsm.Client + Maps *maps.Client + MariaDB *mariadb.Client + Media *media.Client + MixedReality *mixedreality.Client + Monitor *monitor.Client + MobileNetwork *mobilenetwork.Client + MSSQL *mssql.Client + MSSQLManagedInstance *mssqlmanagedinstance.Client + MySQL *mysql.Client + NetApp *netapp.Client + Network *network.Client + NetworkFunction *networkfunction.Client + NewRelic *newrelic.Client + Nginx *nginx_2023_09_01.Client + NotificationHubs *notificationhub.Client + Orbital *orbital.Client + PaloAlto *paloalto.Client + Policy *policy.Client + Portal *portal.Client + Postgres *postgres.Client + PowerBI *powerBI.Client + PrivateDns *privatedns.Client + PrivateDnsResolver *dnsresolver.Client + Purview *purview.Client + RecoveryServices *recoveryServices.Client + RedHatOpenShift *redhatopenshift.Client + Redis *redis_2023_08_01.Client + RedisEnterprise *redisenterprise.Client + Relay *relay.Client + Resource *resource.Client + Search *search.Client + SecurityCenter *securityCenter.Client + Sentinel *sentinel.Client + ServiceBus *serviceBus.Client + ServiceConnector *serviceConnector.Client + ServiceFabric *serviceFabric.Client + ServiceFabricManaged *serviceFabricManaged.Client + ServiceNetworking *servicenetworking_v2023_05_01_preview.Client + SignalR *signalr.Client + Storage *storage.Client + StorageCache *storagecache_2023_05_01.Client + StorageMover *storageMover.Client + StreamAnalytics *streamAnalytics.Client + Subscription *subscription.Client + Sql *sql.Client + Synapse *synapse.Client + SystemCenterVirtualMachineManager *systemcentervirtualmachinemanager_2023_10_07.Client + TrafficManager *trafficManager.Client + VideoAnalyzer *videoAnalyzer.Client + Vmware *vmware.Client + VoiceServices *voiceServices.Client + Web *web.Client } // NOTE: it should be possible for this method to become Private once the top level Client's removed @@ -633,6 +635,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error if client.TrafficManager, err = trafficManager.NewClient(o); err != nil { return fmt.Errorf("building clients for Traffic Manager: %+v", err) } + if client.TrafficManager, err = trafficManager.NewClient(o); err != nil { + return fmt.Errorf("building clients for Traffic Manager: %+v", err) + } if client.VideoAnalyzer, err = videoAnalyzer.NewClient(o); err != nil { return fmt.Errorf("building clients for Video Analyzer: %+v", err) } diff --git a/internal/provider/services.go b/internal/provider/services.go index 1d059750e079..cb9e4b20e9ba 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -126,6 +126,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics" "github.com/hashicorp/terraform-provider-azurerm/internal/services/subscription" "github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/systemcentervirtualmachinemanager" "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager" "github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer" "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware" @@ -211,6 +212,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { search.Registration{}, springcloud.Registration{}, securitycenter.Registration{}, + systemcentervirtualmachinemanager.Registration{}, vmware.Registration{}, voiceservices.Registration{}, web.Registration{}, diff --git a/internal/services/systemcentervirtualmachinemanager/client/client.go b/internal/services/systemcentervirtualmachinemanager/client/client.go new file mode 100644 index 000000000000..69d8f5876462 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/client/client.go @@ -0,0 +1,20 @@ +package client + +import ( + "fmt" + + systemcentervirtualmachinemanager_2023_10_07 "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +func NewClient(o *common.ClientOptions) (*systemcentervirtualmachinemanager_2023_10_07.Client, error) { + client, err := systemcentervirtualmachinemanager_2023_10_07.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) + }) + if err != nil { + return nil, fmt.Errorf("building System Center Virtual Machine Manager client: %+v", err) + } + + return client, nil +} diff --git a/internal/services/systemcentervirtualmachinemanager/registration.go b/internal/services/systemcentervirtualmachinemanager/registration.go new file mode 100644 index 000000000000..2ac8fef8b82e --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/registration.go @@ -0,0 +1,35 @@ +package systemcentervirtualmachinemanager + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +) + +type Registration struct{} + +var _ sdk.TypedServiceRegistration = Registration{} + +func (r Registration) AssociatedGitHubLabel() string { + return "service/systemcentervirtualmachinemanager" +} + +// Name is the name of this Service +func (r Registration) Name() string { + return "System Center Virtual Machine Manager" +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return []string{ + "System Center Virtual Machine Manager", + } +} + +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + SystemCenterVirtualMachineManagerServerResource{}, + } +} diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go new file mode 100644 index 000000000000..c44eba313d94 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go @@ -0,0 +1,243 @@ +package systemcentervirtualmachinemanager + +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/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/systemcentervirtualmachinemanager/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type SystemCenterVirtualMachineManagerServerModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + CustomLocationId string `tfschema:"custom_location_id"` + Fqdn string `tfschema:"fqdn"` + Username string `tfschema:"username"` + Password string `tfschema:"password"` + Port int `tfschema:"port"` + Tags map[string]string `tfschema:"tags"` +} + +var _ sdk.Resource = SystemCenterVirtualMachineManagerServerResource{} +var _ sdk.ResourceWithUpdate = SystemCenterVirtualMachineManagerServerResource{} + +type SystemCenterVirtualMachineManagerServerResource struct{} + +func (r SystemCenterVirtualMachineManagerServerResource) ModelObject() interface{} { + return &SystemCenterVirtualMachineManagerServerModel{} +} + +func (r SystemCenterVirtualMachineManagerServerResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return vmmservers.ValidateVMmServerID +} + +func (r SystemCenterVirtualMachineManagerServerResource) ResourceType() string { + return "azurerm_system_center_virtual_machine_manager_server" +} + +func (r SystemCenterVirtualMachineManagerServerResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.SystemCenterVirtualMachineManagerServerName, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "custom_location_id": commonschema.ResourceIDReferenceRequiredForceNew(&customlocations.CustomLocationId{}), + + "fqdn": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "username": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "password": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "port": { + Type: pluginsdk.TypeInt, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IntBetween(1, 65535), + }, + + "tags": commonschema.Tags(), + } +} + +func (r SystemCenterVirtualMachineManagerServerResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r SystemCenterVirtualMachineManagerServerResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + subscriptionId := metadata.Client.Account.SubscriptionId + client := metadata.Client.SystemCenterVirtualMachineManager.VMmServers + + var model SystemCenterVirtualMachineManagerServerModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id := vmmservers.NewVMmServerID(subscriptionId, model.ResourceGroupName, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for the presence of an existing %s: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + parameters := &vmmservers.VMMServer{ + Location: location.Normalize(model.Location), + ExtendedLocation: vmmservers.ExtendedLocation{ + Type: pointer.To("customLocation"), + Name: pointer.To(model.CustomLocationId), + }, + Properties: vmmservers.VMMServerProperties{ + Credentials: &vmmservers.VMMCredential{ + Username: pointer.To(model.Username), + Password: pointer.To(model.Password), + }, + Fqdn: model.Fqdn, + }, + Tags: pointer.To(model.Tags), + } + + if v := model.Port; v != 0 { + parameters.Properties.Port = pointer.To(int64(v)) + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, *parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r SystemCenterVirtualMachineManagerServerResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.SystemCenterVirtualMachineManager.VMmServers + + id, err := vmmservers.ParseVMmServerID(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 := SystemCenterVirtualMachineManagerServerModel{} + if model := resp.Model; model != nil { + state.Name = id.VmmServerName + state.ResourceGroupName = id.ResourceGroupName + state.Location = location.Normalize(model.Location) + state.CustomLocationId = pointer.From(model.ExtendedLocation.Name) + state.Fqdn = model.Properties.Fqdn + state.Password = metadata.ResourceData.Get("password").(string) + state.Port = int(pointer.From(model.Properties.Port)) + state.Tags = pointer.From(model.Tags) + + if v := model.Properties.Credentials; v != nil { + state.Username = pointer.From(v.Username) + } + + } + + return metadata.Encode(&state) + }, + } +} + +func (r SystemCenterVirtualMachineManagerServerResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.SystemCenterVirtualMachineManager.VMmServers + + id, err := vmmservers.ParseVMmServerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model SystemCenterVirtualMachineManagerServerModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + parameters := vmmservers.ResourcePatch{ + Tags: pointer.To(model.Tags), + } + + if err := client.UpdateThenPoll(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r SystemCenterVirtualMachineManagerServerResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.SystemCenterVirtualMachineManager.VMmServers + + id, err := vmmservers.ParseVMmServerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id, vmmservers.DeleteOperationOptions{Force: pointer.To(vmmservers.ForceTrue)}); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go new file mode 100644 index 000000000000..17e374a3f0d3 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go @@ -0,0 +1,210 @@ +package systemcentervirtualmachinemanager_test + +import ( + "context" + "fmt" + "os" + "testing" + + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers" + "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 SystemCenterVirtualMachineManagerServerResource struct{} + +func TestAccSystemCenterVirtualMachineManagerServerSequential(t *testing.T) { + // NOTE: this is a combined test rather than separate split out tests because only one System Center Virtual Machine Manager Server can be onboarded at a time on a given Custom Location + + if os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID") == "" || os.Getenv("ARM_TEST_FQDN") == "" || os.Getenv("ARM_TEST_PORT") == "" || os.Getenv("ARM_TEST_USERNAME") == "" || os.Getenv("ARM_TEST_PASSWORD") == "" { + t.Skip("Skipping as one of `ARM_TEST_CUSTOM_LOCATION_ID`, `ARM_TEST_FQDN`, `ARM_TEST_PORT`, `ARM_TEST_USERNAME`, `ARM_TEST_PASSWORD` was not specified") + } + + acceptance.RunTestsInSequence(t, map[string]map[string]func(t *testing.T){ + "scvmmServer": { + "basic": testAccSystemCenterVirtualMachineManagerServer_basic, + "requiresImport": testAccSystemCenterVirtualMachineManagerServer_requiresImport, + "complete": testAccSystemCenterVirtualMachineManagerServer_complete, + "update": testAccSystemCenterVirtualMachineManagerServer_update, + }, + }) +} + +func testAccSystemCenterVirtualMachineManagerServer_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") + r := SystemCenterVirtualMachineManagerServerResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("password"), + }) +} + +func testAccSystemCenterVirtualMachineManagerServer_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") + r := SystemCenterVirtualMachineManagerServerResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func testAccSystemCenterVirtualMachineManagerServer_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") + r := SystemCenterVirtualMachineManagerServerResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("password"), + }) +} + +func testAccSystemCenterVirtualMachineManagerServer_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") + r := SystemCenterVirtualMachineManagerServerResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("password"), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("password"), + }) +} + +func (r SystemCenterVirtualMachineManagerServerResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := vmmservers.ParseVMmServerID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.SystemCenterVirtualMachineManager.VMmServers.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("reading %s: %+v", *id, err) + } + + return utils.Bool(resp.Model != nil), nil +} + +func (r SystemCenterVirtualMachineManagerServerResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + features {} +} + +resource "azurerm_system_center_virtual_machine_manager_server" "test" { + name = "acctest-scvmmms-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = "%s" + fqdn = "%s" + username = "%s" + password = "%s" +} +`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) +} + +func (r SystemCenterVirtualMachineManagerServerResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_system_center_virtual_machine_manager_server" "import" { + name = azurerm_system_center_virtual_machine_manager_server.test.name + resource_group_name = azurerm_system_center_virtual_machine_manager_server.test.resource_group_name + location = azurerm_system_center_virtual_machine_manager_server.test.location + custom_location_id = azurerm_system_center_virtual_machine_manager_server.test.custom_location_id + fqdn = azurerm_system_center_virtual_machine_manager_server.test.fqdn + username = "%s" + password = "%s" +} +`, r.basic(data), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) +} + +func (r SystemCenterVirtualMachineManagerServerResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + features {} +} + +resource "azurerm_system_center_virtual_machine_manager_server" "test" { + name = "acctest-scvmmms-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = "%s" + fqdn = "%s" + port = tonumber("%s") + username = "%s" + password = "%s" + + tags = { + Env = "Test" + } +} +`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_PORT"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) +} + +func (r SystemCenterVirtualMachineManagerServerResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + features {} +} + +resource "azurerm_system_center_virtual_machine_manager_server" "test" { + name = "acctest-scvmmms-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = "%s" + fqdn = "%s" + port = tonumber("%s") + username = "%s" + password = "%s" + + tags = { + Env = "Test2" + } +} +`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_PORT"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) +} + +func (r SystemCenterVirtualMachineManagerServerResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestrg-scvmmms-%d" + location = "%s" +} +`, data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name.go b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name.go new file mode 100644 index 000000000000..bd11403b08ad --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name.go @@ -0,0 +1,20 @@ +package validate + +import ( + "fmt" + "regexp" +) + +func SystemCenterVirtualMachineManagerServerName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + if !regexp.MustCompile("^[a-zA-Z0-9]([-.a-zA-Z0-9]{0,52}[a-zA-Z0-9])?$").MatchString(v) { + errors = append(errors, fmt.Errorf("%q must start and end with an alphanumeric character, may contain alphanumeric characters, dashes or periods and must be between 1 and 54 characters long", k)) + } + + return warnings, errors +} diff --git a/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name_test.go b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name_test.go new file mode 100644 index 000000000000..0faa166e8b2b --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name_test.go @@ -0,0 +1,58 @@ +package validate + +import ( + "strings" + "testing" +) + +func TestSystemCenterVirtualMachineManagerServerName(t *testing.T) { + testCases := []struct { + Input string + Expected bool + }{ + { + Input: "", + Expected: false, + }, + { + Input: "a", + Expected: true, + }, + { + Input: "a8a", + Expected: true, + }, + { + Input: "a-8.a", + Expected: true, + }, + { + Input: "a-", + Expected: false, + }, + { + Input: "a.", + Expected: false, + }, + { + Input: strings.Repeat("s", 53), + Expected: true, + }, + { + Input: strings.Repeat("s", 54), + Expected: true, + }, + { + Input: strings.Repeat("s", 55), + Expected: false, + }, + } + + for _, v := range testCases { + _, errors := SystemCenterVirtualMachineManagerServerName(v.Input, "time_of_day_in_utc") + result := len(errors) == 0 + if result != v.Expected { + t.Fatalf("Expected the result to be %t but got %t (and %d errors)", v.Expected, result, len(errors)) + } + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/README.md new file mode 100644 index 000000000000..245f8d300e00 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/README.md @@ -0,0 +1,138 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations` Documentation + +The `customlocations` SDK allows for interaction with the Azure Resource Manager Service `extendedlocation` (API Version `2021-08-15`). + +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/extendedlocation/2021-08-15/customlocations" +``` + + +### Client Initialization + +```go +client := customlocations.NewCustomLocationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CustomLocationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := customlocations.NewCustomLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "customLocationValue") + +payload := customlocations.CustomLocation{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CustomLocationsClient.Delete` + +```go +ctx := context.TODO() +id := customlocations.NewCustomLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "customLocationValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CustomLocationsClient.Get` + +```go +ctx := context.TODO() +id := customlocations.NewCustomLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "customLocationValue") + +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: `CustomLocationsClient.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: `CustomLocationsClient.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: `CustomLocationsClient.ListEnabledResourceTypes` + +```go +ctx := context.TODO() +id := customlocations.NewCustomLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "customLocationValue") + +// alternatively `client.ListEnabledResourceTypes(ctx, id)` can be used to do batched pagination +items, err := client.ListEnabledResourceTypesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CustomLocationsClient.Update` + +```go +ctx := context.TODO() +id := customlocations.NewCustomLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "customLocationValue") + +payload := customlocations.PatchableCustomLocations{ + // ... +} + + +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/extendedlocation/2021-08-15/customlocations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/client.go new file mode 100644 index 000000000000..bd1bcb809a51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/client.go @@ -0,0 +1,26 @@ +package customlocations + +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 CustomLocationsClient struct { + Client *resourcemanager.Client +} + +func NewCustomLocationsClientWithBaseURI(sdkApi sdkEnv.Api) (*CustomLocationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "customlocations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CustomLocationsClient: %+v", err) + } + + return &CustomLocationsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/constants.go new file mode 100644 index 000000000000..45e439f98aae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/constants.go @@ -0,0 +1,48 @@ +package customlocations + +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 HostType string + +const ( + HostTypeKubernetes HostType = "Kubernetes" +) + +func PossibleValuesForHostType() []string { + return []string{ + string(HostTypeKubernetes), + } +} + +func (s *HostType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHostType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHostType(input string) (*HostType, error) { + vals := map[string]HostType{ + "kubernetes": HostTypeKubernetes, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HostType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/id_customlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/id_customlocation.go new file mode 100644 index 000000000000..1c1481acc65c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/id_customlocation.go @@ -0,0 +1,125 @@ +package customlocations + +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 = &CustomLocationId{} + +// CustomLocationId is a struct representing the Resource ID for a Custom Location +type CustomLocationId struct { + SubscriptionId string + ResourceGroupName string + CustomLocationName string +} + +// NewCustomLocationID returns a new CustomLocationId struct +func NewCustomLocationID(subscriptionId string, resourceGroupName string, customLocationName string) CustomLocationId { + return CustomLocationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CustomLocationName: customLocationName, + } +} + +// ParseCustomLocationID parses 'input' into a CustomLocationId +func ParseCustomLocationID(input string) (*CustomLocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&CustomLocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CustomLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCustomLocationIDInsensitively parses 'input' case-insensitively into a CustomLocationId +// note: this method should only be used for API response data and not user input +func ParseCustomLocationIDInsensitively(input string) (*CustomLocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&CustomLocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CustomLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CustomLocationId) 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.CustomLocationName, ok = input.Parsed["customLocationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customLocationName", input) + } + + return nil +} + +// ValidateCustomLocationID checks that 'input' can be parsed as a Custom Location ID +func ValidateCustomLocationID(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 := ParseCustomLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Custom Location ID +func (id CustomLocationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ExtendedLocation/customLocations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CustomLocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Custom Location ID +func (id CustomLocationId) 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("staticMicrosoftExtendedLocation", "Microsoft.ExtendedLocation", "Microsoft.ExtendedLocation"), + resourceids.StaticSegment("staticCustomLocations", "customLocations", "customLocations"), + resourceids.UserSpecifiedSegment("customLocationName", "customLocationValue"), + } +} + +// String returns a human-readable description of this Custom Location ID +func (id CustomLocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Custom Location Name: %q", id.CustomLocationName), + } + return fmt.Sprintf("Custom Location (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_createorupdate.go new file mode 100644 index 000000000000..28409f1de999 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_createorupdate.go @@ -0,0 +1,75 @@ +package customlocations + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CustomLocation +} + +// CreateOrUpdate ... +func (c CustomLocationsClient) CreateOrUpdate(ctx context.Context, id CustomLocationId, input CustomLocation) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c CustomLocationsClient) CreateOrUpdateThenPoll(ctx context.Context, id CustomLocationId, input CustomLocation) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_delete.go new file mode 100644 index 000000000000..46eca9192ec6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_delete.go @@ -0,0 +1,70 @@ +package customlocations + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c CustomLocationsClient) Delete(ctx context.Context, id CustomLocationId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + 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 CustomLocationsClient) DeleteThenPoll(ctx context.Context, id CustomLocationId) 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/extendedlocation/2021-08-15/customlocations/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_get.go new file mode 100644 index 000000000000..ebf3e87791be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_get.go @@ -0,0 +1,51 @@ +package customlocations + +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 *CustomLocation +} + +// Get ... +func (c CustomLocationsClient) Get(ctx context.Context, id CustomLocationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbyresourcegroup.go new file mode 100644 index 000000000000..a2a2889f0594 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package customlocations + +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 *[]CustomLocation +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []CustomLocation +} + +// ListByResourceGroup ... +func (c CustomLocationsClient) 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.ExtendedLocation/customLocations", 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 *[]CustomLocation `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 CustomLocationsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, CustomLocationOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CustomLocationsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate CustomLocationOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]CustomLocation, 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/extendedlocation/2021-08-15/customlocations/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbysubscription.go new file mode 100644 index 000000000000..f0160f9f153e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbysubscription.go @@ -0,0 +1,92 @@ +package customlocations + +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 *[]CustomLocation +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []CustomLocation +} + +// ListBySubscription ... +func (c CustomLocationsClient) 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.ExtendedLocation/customLocations", 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 *[]CustomLocation `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 CustomLocationsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, CustomLocationOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CustomLocationsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate CustomLocationOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]CustomLocation, 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/extendedlocation/2021-08-15/customlocations/method_listenabledresourcetypes.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listenabledresourcetypes.go new file mode 100644 index 000000000000..aae110c28580 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listenabledresourcetypes.go @@ -0,0 +1,91 @@ +package customlocations + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListEnabledResourceTypesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]EnabledResourceType +} + +type ListEnabledResourceTypesCompleteResult struct { + LatestHttpResponse *http.Response + Items []EnabledResourceType +} + +// ListEnabledResourceTypes ... +func (c CustomLocationsClient) ListEnabledResourceTypes(ctx context.Context, id CustomLocationId) (result ListEnabledResourceTypesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/enabledResourceTypes", 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 *[]EnabledResourceType `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListEnabledResourceTypesComplete retrieves all the results into a single object +func (c CustomLocationsClient) ListEnabledResourceTypesComplete(ctx context.Context, id CustomLocationId) (ListEnabledResourceTypesCompleteResult, error) { + return c.ListEnabledResourceTypesCompleteMatchingPredicate(ctx, id, EnabledResourceTypeOperationPredicate{}) +} + +// ListEnabledResourceTypesCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CustomLocationsClient) ListEnabledResourceTypesCompleteMatchingPredicate(ctx context.Context, id CustomLocationId, predicate EnabledResourceTypeOperationPredicate) (result ListEnabledResourceTypesCompleteResult, err error) { + items := make([]EnabledResourceType, 0) + + resp, err := c.ListEnabledResourceTypes(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 = ListEnabledResourceTypesCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_update.go new file mode 100644 index 000000000000..8a0507b08541 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_update.go @@ -0,0 +1,55 @@ +package customlocations + +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 *CustomLocation +} + +// Update ... +func (c CustomLocationsClient) Update(ctx context.Context, id CustomLocationId, input PatchableCustomLocations) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocation.go new file mode 100644 index 000000000000..1206e9eb6355 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocation.go @@ -0,0 +1,20 @@ +package customlocations + +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 CustomLocation struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CustomLocationProperties `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/extendedlocation/2021-08-15/customlocations/model_customlocationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationproperties.go new file mode 100644 index 000000000000..8a1b9867bd69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationproperties.go @@ -0,0 +1,14 @@ +package customlocations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomLocationProperties struct { + Authentication *CustomLocationPropertiesAuthentication `json:"authentication,omitempty"` + ClusterExtensionIds *[]string `json:"clusterExtensionIds,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + HostResourceId *string `json:"hostResourceId,omitempty"` + HostType *HostType `json:"hostType,omitempty"` + Namespace *string `json:"namespace,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationpropertiesauthentication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationpropertiesauthentication.go new file mode 100644 index 000000000000..506f39031812 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationpropertiesauthentication.go @@ -0,0 +1,9 @@ +package customlocations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomLocationPropertiesAuthentication struct { + Type *string `json:"type,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetype.go new file mode 100644 index 000000000000..ea81da07f08f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetype.go @@ -0,0 +1,16 @@ +package customlocations + +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 EnabledResourceType struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *EnabledResourceTypeProperties `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/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypeproperties.go new file mode 100644 index 000000000000..54b0f3198811 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypeproperties.go @@ -0,0 +1,10 @@ +package customlocations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnabledResourceTypeProperties struct { + ClusterExtensionId *string `json:"clusterExtensionId,omitempty"` + ExtensionType *string `json:"extensionType,omitempty"` + TypesMetadata *[]EnabledResourceTypePropertiesTypesMetadataInlined `json:"typesMetadata,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypepropertiestypesmetadatainlined.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypepropertiestypesmetadatainlined.go new file mode 100644 index 000000000000..5998090bd271 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypepropertiestypesmetadatainlined.go @@ -0,0 +1,10 @@ +package customlocations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnabledResourceTypePropertiesTypesMetadataInlined struct { + ApiVersion *string `json:"apiVersion,omitempty"` + ResourceProviderNamespace *string `json:"resourceProviderNamespace,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_patchablecustomlocations.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_patchablecustomlocations.go new file mode 100644 index 000000000000..005fda74441b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_patchablecustomlocations.go @@ -0,0 +1,14 @@ +package customlocations + +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 PatchableCustomLocations struct { + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Properties *CustomLocationProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/predicates.go new file mode 100644 index 000000000000..f18b5aa943f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/predicates.go @@ -0,0 +1,55 @@ +package customlocations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomLocationOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CustomLocationOperationPredicate) Matches(input CustomLocation) 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 +} + +type EnabledResourceTypeOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p EnabledResourceTypeOperationPredicate) Matches(input EnabledResourceType) 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/extendedlocation/2021-08-15/customlocations/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/version.go new file mode 100644 index 000000000000..efff5cadda05 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/version.go @@ -0,0 +1,12 @@ +package customlocations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-15" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/customlocations/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/README.md new file mode 100644 index 000000000000..df8180a9564b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets` Documentation + +The `availabilitysets` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/availabilitysets" +``` + + +### Client Initialization + +```go +client := availabilitysets.NewAvailabilitySetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AvailabilitySetsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +payload := availabilitysets.AvailabilitySet{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AvailabilitySetsClient.Delete` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +if err := client.DeleteThenPoll(ctx, id, availabilitysets.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `AvailabilitySetsClient.Get` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +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: `AvailabilitySetsClient.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: `AvailabilitySetsClient.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: `AvailabilitySetsClient.Update` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +payload := availabilitysets.ResourcePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/client.go new file mode 100644 index 000000000000..54ef249b4a80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/client.go @@ -0,0 +1,26 @@ +package availabilitysets + +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 AvailabilitySetsClient struct { + Client *resourcemanager.Client +} + +func NewAvailabilitySetsClientWithBaseURI(sdkApi sdkEnv.Api) (*AvailabilitySetsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "availabilitysets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AvailabilitySetsClient: %+v", err) + } + + return &AvailabilitySetsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/constants.go new file mode 100644 index 000000000000..4de67ae6b667 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/constants.go @@ -0,0 +1,110 @@ +package availabilitysets + +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 Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go new file mode 100644 index 000000000000..d51b56d1054d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go @@ -0,0 +1,125 @@ +package availabilitysets + +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 = &AvailabilitySetId{} + +// AvailabilitySetId is a struct representing the Resource ID for a Availability Set +type AvailabilitySetId struct { + SubscriptionId string + ResourceGroupName string + AvailabilitySetName string +} + +// NewAvailabilitySetID returns a new AvailabilitySetId struct +func NewAvailabilitySetID(subscriptionId string, resourceGroupName string, availabilitySetName string) AvailabilitySetId { + return AvailabilitySetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AvailabilitySetName: availabilitySetName, + } +} + +// ParseAvailabilitySetID parses 'input' into a AvailabilitySetId +func ParseAvailabilitySetID(input string) (*AvailabilitySetId, error) { + parser := resourceids.NewParserFromResourceIdType(&AvailabilitySetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AvailabilitySetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAvailabilitySetIDInsensitively parses 'input' case-insensitively into a AvailabilitySetId +// note: this method should only be used for API response data and not user input +func ParseAvailabilitySetIDInsensitively(input string) (*AvailabilitySetId, error) { + parser := resourceids.NewParserFromResourceIdType(&AvailabilitySetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AvailabilitySetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AvailabilitySetId) 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.AvailabilitySetName, ok = input.Parsed["availabilitySetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", input) + } + + return nil +} + +// ValidateAvailabilitySetID checks that 'input' can be parsed as a Availability Set ID +func ValidateAvailabilitySetID(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 := ParseAvailabilitySetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Availability Set ID +func (id AvailabilitySetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/availabilitySets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AvailabilitySetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Availability Set ID +func (id AvailabilitySetId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticAvailabilitySets", "availabilitySets", "availabilitySets"), + resourceids.UserSpecifiedSegment("availabilitySetName", "availabilitySetValue"), + } +} + +// String returns a human-readable description of this Availability Set ID +func (id AvailabilitySetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Availability Set Name: %q", id.AvailabilitySetName), + } + return fmt.Sprintf("Availability Set (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_createorupdate.go new file mode 100644 index 000000000000..a3cc87b1fde0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_createorupdate.go @@ -0,0 +1,75 @@ +package availabilitysets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AvailabilitySet +} + +// CreateOrUpdate ... +func (c AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, id AvailabilitySetId, input AvailabilitySet) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AvailabilitySetsClient) CreateOrUpdateThenPoll(ctx context.Context, id AvailabilitySetId, input AvailabilitySet) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_delete.go new file mode 100644 index 000000000000..feb65fd44090 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_delete.go @@ -0,0 +1,98 @@ +package availabilitysets + +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 +} + +type DeleteOperationOptions struct { + Force *Force +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c AvailabilitySetsClient) Delete(ctx context.Context, id AvailabilitySetId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AvailabilitySetsClient) DeleteThenPoll(ctx context.Context, id AvailabilitySetId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_get.go new file mode 100644 index 000000000000..5aee17cea0c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_get.go @@ -0,0 +1,51 @@ +package availabilitysets + +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 *AvailabilitySet +} + +// Get ... +func (c AvailabilitySetsClient) Get(ctx context.Context, id AvailabilitySetId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbyresourcegroup.go new file mode 100644 index 000000000000..29abd1c44827 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package availabilitysets + +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 *[]AvailabilitySet +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []AvailabilitySet +} + +// ListByResourceGroup ... +func (c AvailabilitySetsClient) 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.ScVmm/availabilitySets", 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 *[]AvailabilitySet `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 AvailabilitySetsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, AvailabilitySetOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AvailabilitySetsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AvailabilitySetOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]AvailabilitySet, 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/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbysubscription.go new file mode 100644 index 000000000000..82343daefc7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbysubscription.go @@ -0,0 +1,92 @@ +package availabilitysets + +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 *[]AvailabilitySet +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []AvailabilitySet +} + +// ListBySubscription ... +func (c AvailabilitySetsClient) 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.ScVmm/availabilitySets", 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 *[]AvailabilitySet `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 AvailabilitySetsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, AvailabilitySetOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AvailabilitySetsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AvailabilitySetOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]AvailabilitySet, 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/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_update.go new file mode 100644 index 000000000000..7cca724eba7c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_update.go @@ -0,0 +1,75 @@ +package availabilitysets + +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 *AvailabilitySet +} + +// Update ... +func (c AvailabilitySetsClient) Update(ctx context.Context, id AvailabilitySetId, input ResourcePatch) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c AvailabilitySetsClient) UpdateThenPoll(ctx context.Context, id AvailabilitySetId, input ResourcePatch) 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/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilityset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilityset.go new file mode 100644 index 000000000000..c1bb50264991 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilityset.go @@ -0,0 +1,19 @@ +package availabilitysets + +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 AvailabilitySet struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties AvailabilitySetProperties `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/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilitysetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilitysetproperties.go new file mode 100644 index 000000000000..519440060de5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilitysetproperties.go @@ -0,0 +1,10 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetProperties struct { + AvailabilitySetName *string `json:"availabilitySetName,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + VMmServerId *string `json:"vmmServerId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_extendedlocation.go new file mode 100644 index 000000000000..da53bf74ea1c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_extendedlocation.go @@ -0,0 +1,9 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_resourcepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_resourcepatch.go new file mode 100644 index 000000000000..8ddbdd73387b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_resourcepatch.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourcePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/predicates.go new file mode 100644 index 000000000000..bb3e2b2b319f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/predicates.go @@ -0,0 +1,32 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AvailabilitySetOperationPredicate) Matches(input AvailabilitySet) 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/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/version.go new file mode 100644 index 000000000000..b5ddd1201cca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/version.go @@ -0,0 +1,12 @@ +package availabilitysets + +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-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/availabilitysets/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/client.go new file mode 100644 index 000000000000..3523a8784b20 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/client.go @@ -0,0 +1,100 @@ +package v2023_10_07 + +// 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/systemcentervirtualmachinemanager/2023-10-07/availabilitysets" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + AvailabilitySets *availabilitysets.AvailabilitySetsClient + Clouds *clouds.CloudsClient + InventoryItems *inventoryitems.InventoryItemsClient + VMInstanceGuestAgents *vminstanceguestagents.VMInstanceGuestAgentsClient + VMInstanceHybridIdentityMetadata *vminstancehybrididentitymetadata.VMInstanceHybridIdentityMetadataClient + VMmServers *vmmservers.VMmServersClient + VirtualMachineInstances *virtualmachineinstances.VirtualMachineInstancesClient + VirtualMachineTemplates *virtualmachinetemplates.VirtualMachineTemplatesClient + VirtualNetworks *virtualnetworks.VirtualNetworksClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + availabilitySetsClient, err := availabilitysets.NewAvailabilitySetsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AvailabilitySets client: %+v", err) + } + configureFunc(availabilitySetsClient.Client) + + cloudsClient, err := clouds.NewCloudsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Clouds client: %+v", err) + } + configureFunc(cloudsClient.Client) + + inventoryItemsClient, err := inventoryitems.NewInventoryItemsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building InventoryItems client: %+v", err) + } + configureFunc(inventoryItemsClient.Client) + + vMInstanceGuestAgentsClient, err := vminstanceguestagents.NewVMInstanceGuestAgentsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VMInstanceGuestAgents client: %+v", err) + } + configureFunc(vMInstanceGuestAgentsClient.Client) + + vMInstanceHybridIdentityMetadataClient, err := vminstancehybrididentitymetadata.NewVMInstanceHybridIdentityMetadataClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VMInstanceHybridIdentityMetadata client: %+v", err) + } + configureFunc(vMInstanceHybridIdentityMetadataClient.Client) + + vMmServersClient, err := vmmservers.NewVMmServersClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VMmServers client: %+v", err) + } + configureFunc(vMmServersClient.Client) + + virtualMachineInstancesClient, err := virtualmachineinstances.NewVirtualMachineInstancesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineInstances client: %+v", err) + } + configureFunc(virtualMachineInstancesClient.Client) + + virtualMachineTemplatesClient, err := virtualmachinetemplates.NewVirtualMachineTemplatesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineTemplates client: %+v", err) + } + configureFunc(virtualMachineTemplatesClient.Client) + + virtualNetworksClient, err := virtualnetworks.NewVirtualNetworksClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualNetworks client: %+v", err) + } + configureFunc(virtualNetworksClient.Client) + + return &Client{ + AvailabilitySets: availabilitySetsClient, + Clouds: cloudsClient, + InventoryItems: inventoryItemsClient, + VMInstanceGuestAgents: vMInstanceGuestAgentsClient, + VMInstanceHybridIdentityMetadata: vMInstanceHybridIdentityMetadataClient, + VMmServers: vMmServersClient, + VirtualMachineInstances: virtualMachineInstancesClient, + VirtualMachineTemplates: virtualMachineTemplatesClient, + VirtualNetworks: virtualNetworksClient, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/README.md new file mode 100644 index 000000000000..9c626c45ab7b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds` Documentation + +The `clouds` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/clouds" +``` + + +### Client Initialization + +```go +client := clouds.NewCloudsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CloudsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := clouds.NewCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudValue") + +payload := clouds.Cloud{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudsClient.Delete` + +```go +ctx := context.TODO() +id := clouds.NewCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudValue") + +if err := client.DeleteThenPoll(ctx, id, clouds.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudsClient.Get` + +```go +ctx := context.TODO() +id := clouds.NewCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudValue") + +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: `CloudsClient.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: `CloudsClient.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: `CloudsClient.Update` + +```go +ctx := context.TODO() +id := clouds.NewCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudValue") + +payload := clouds.ResourcePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/client.go new file mode 100644 index 000000000000..9720d3715983 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/client.go @@ -0,0 +1,26 @@ +package clouds + +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 CloudsClient struct { + Client *resourcemanager.Client +} + +func NewCloudsClientWithBaseURI(sdkApi sdkEnv.Api) (*CloudsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "clouds", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CloudsClient: %+v", err) + } + + return &CloudsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/constants.go new file mode 100644 index 000000000000..416af769cd75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/constants.go @@ -0,0 +1,110 @@ +package clouds + +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 Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go new file mode 100644 index 000000000000..4886631ffa6b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go @@ -0,0 +1,125 @@ +package clouds + +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 = &CloudId{} + +// CloudId is a struct representing the Resource ID for a Cloud +type CloudId struct { + SubscriptionId string + ResourceGroupName string + CloudName string +} + +// NewCloudID returns a new CloudId struct +func NewCloudID(subscriptionId string, resourceGroupName string, cloudName string) CloudId { + return CloudId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CloudName: cloudName, + } +} + +// ParseCloudID parses 'input' into a CloudId +func ParseCloudID(input string) (*CloudId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCloudIDInsensitively parses 'input' case-insensitively into a CloudId +// note: this method should only be used for API response data and not user input +func ParseCloudIDInsensitively(input string) (*CloudId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CloudId) 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.CloudName, ok = input.Parsed["cloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudName", input) + } + + return nil +} + +// ValidateCloudID checks that 'input' can be parsed as a Cloud ID +func ValidateCloudID(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 := ParseCloudID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cloud ID +func (id CloudId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/clouds/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CloudName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cloud ID +func (id CloudId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticClouds", "clouds", "clouds"), + resourceids.UserSpecifiedSegment("cloudName", "cloudValue"), + } +} + +// String returns a human-readable description of this Cloud ID +func (id CloudId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cloud Name: %q", id.CloudName), + } + return fmt.Sprintf("Cloud (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_createorupdate.go new file mode 100644 index 000000000000..5b59ebd19a3f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_createorupdate.go @@ -0,0 +1,75 @@ +package clouds + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Cloud +} + +// CreateOrUpdate ... +func (c CloudsClient) CreateOrUpdate(ctx context.Context, id CloudId, input Cloud) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c CloudsClient) CreateOrUpdateThenPoll(ctx context.Context, id CloudId, input Cloud) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_delete.go new file mode 100644 index 000000000000..c0f1ded3cfce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_delete.go @@ -0,0 +1,98 @@ +package clouds + +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 +} + +type DeleteOperationOptions struct { + Force *Force +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c CloudsClient) Delete(ctx context.Context, id CloudId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CloudsClient) DeleteThenPoll(ctx context.Context, id CloudId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/systemcentervirtualmachinemanager/2023-10-07/clouds/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_get.go new file mode 100644 index 000000000000..5524d6f14e16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_get.go @@ -0,0 +1,51 @@ +package clouds + +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 *Cloud +} + +// Get ... +func (c CloudsClient) Get(ctx context.Context, id CloudId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbyresourcegroup.go new file mode 100644 index 000000000000..dedcb2a54e84 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package clouds + +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 *[]Cloud +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Cloud +} + +// ListByResourceGroup ... +func (c CloudsClient) 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.ScVmm/clouds", 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 *[]Cloud `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 CloudsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, CloudOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CloudsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate CloudOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Cloud, 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/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbysubscription.go new file mode 100644 index 000000000000..5f7caceb063e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbysubscription.go @@ -0,0 +1,92 @@ +package clouds + +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 *[]Cloud +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []Cloud +} + +// ListBySubscription ... +func (c CloudsClient) 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.ScVmm/clouds", 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 *[]Cloud `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 CloudsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, CloudOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CloudsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate CloudOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]Cloud, 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/systemcentervirtualmachinemanager/2023-10-07/clouds/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_update.go new file mode 100644 index 000000000000..fb2a2c8c890e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_update.go @@ -0,0 +1,75 @@ +package clouds + +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 *Cloud +} + +// Update ... +func (c CloudsClient) Update(ctx context.Context, id CloudId, input ResourcePatch) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c CloudsClient) UpdateThenPoll(ctx context.Context, id CloudId, input ResourcePatch) 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/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloud.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloud.go new file mode 100644 index 000000000000..54782e1c6b58 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloud.go @@ -0,0 +1,19 @@ +package clouds + +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 Cloud struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties CloudProperties `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/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudcapacity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudcapacity.go new file mode 100644 index 000000000000..7fbcddbb947c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudcapacity.go @@ -0,0 +1,10 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudCapacity struct { + CpuCount *int64 `json:"cpuCount,omitempty"` + MemoryMB *int64 `json:"memoryMB,omitempty"` + VMCount *int64 `json:"vmCount,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudproperties.go new file mode 100644 index 000000000000..dfac177c333f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudproperties.go @@ -0,0 +1,14 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudProperties struct { + CloudCapacity *CloudCapacity `json:"cloudCapacity,omitempty"` + CloudName *string `json:"cloudName,omitempty"` + InventoryItemId *string `json:"inventoryItemId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + StorageQoSPolicies *[]StorageQoSPolicy `json:"storageQoSPolicies,omitempty"` + Uuid *string `json:"uuid,omitempty"` + VMmServerId *string `json:"vmmServerId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_extendedlocation.go new file mode 100644 index 000000000000..256e3cfbe79a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_extendedlocation.go @@ -0,0 +1,9 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_resourcepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_resourcepatch.go new file mode 100644 index 000000000000..2b70badeeb85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_resourcepatch.go @@ -0,0 +1,8 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourcePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_storageqospolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_storageqospolicy.go new file mode 100644 index 000000000000..8425348c5c63 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_storageqospolicy.go @@ -0,0 +1,13 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageQoSPolicy struct { + BandwidthLimit *int64 `json:"bandwidthLimit,omitempty"` + Id *string `json:"id,omitempty"` + IopsMaximum *int64 `json:"iopsMaximum,omitempty"` + IopsMinimum *int64 `json:"iopsMinimum,omitempty"` + Name *string `json:"name,omitempty"` + PolicyId *string `json:"policyId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/predicates.go new file mode 100644 index 000000000000..6e1395597d1e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/predicates.go @@ -0,0 +1,32 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CloudOperationPredicate) Matches(input Cloud) 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/systemcentervirtualmachinemanager/2023-10-07/clouds/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/version.go new file mode 100644 index 000000000000..1935d3db1000 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/version.go @@ -0,0 +1,12 @@ +package clouds + +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-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/clouds/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/README.md new file mode 100644 index 000000000000..c76bf2a8e039 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems` Documentation + +The `inventoryitems` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/inventoryitems" +``` + + +### Client Initialization + +```go +client := inventoryitems.NewInventoryItemsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `InventoryItemsClient.Create` + +```go +ctx := context.TODO() +id := inventoryitems.NewInventoryItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue", "inventoryItemValue") + +payload := inventoryitems.InventoryItem{ + // ... +} + + +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: `InventoryItemsClient.Delete` + +```go +ctx := context.TODO() +id := inventoryitems.NewInventoryItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue", "inventoryItemValue") + +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: `InventoryItemsClient.Get` + +```go +ctx := context.TODO() +id := inventoryitems.NewInventoryItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue", "inventoryItemValue") + +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: `InventoryItemsClient.ListByVMMServer` + +```go +ctx := context.TODO() +id := inventoryitems.NewVMmServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue") + +// alternatively `client.ListByVMMServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByVMMServerComplete(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/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/client.go new file mode 100644 index 000000000000..fbe00f649ccb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/client.go @@ -0,0 +1,26 @@ +package inventoryitems + +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 InventoryItemsClient struct { + Client *resourcemanager.Client +} + +func NewInventoryItemsClientWithBaseURI(sdkApi sdkEnv.Api) (*InventoryItemsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "inventoryitems", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating InventoryItemsClient: %+v", err) + } + + return &InventoryItemsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/constants.go new file mode 100644 index 000000000000..d7e2dc448d89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/constants.go @@ -0,0 +1,160 @@ +package inventoryitems + +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 InventoryType string + +const ( + InventoryTypeCloud InventoryType = "Cloud" + InventoryTypeVirtualMachine InventoryType = "VirtualMachine" + InventoryTypeVirtualMachineTemplate InventoryType = "VirtualMachineTemplate" + InventoryTypeVirtualNetwork InventoryType = "VirtualNetwork" +) + +func PossibleValuesForInventoryType() []string { + return []string{ + string(InventoryTypeCloud), + string(InventoryTypeVirtualMachine), + string(InventoryTypeVirtualMachineTemplate), + string(InventoryTypeVirtualNetwork), + } +} + +func (s *InventoryType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInventoryType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInventoryType(input string) (*InventoryType, error) { + vals := map[string]InventoryType{ + "cloud": InventoryTypeCloud, + "virtualmachine": InventoryTypeVirtualMachine, + "virtualmachinetemplate": InventoryTypeVirtualMachineTemplate, + "virtualnetwork": InventoryTypeVirtualNetwork, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InventoryType(input) + return &out, nil +} + +type OsType string + +const ( + OsTypeLinux OsType = "Linux" + OsTypeOther OsType = "Other" + OsTypeWindows OsType = "Windows" +) + +func PossibleValuesForOsType() []string { + return []string{ + string(OsTypeLinux), + string(OsTypeOther), + 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, + "other": OsTypeOther, + "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 ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go new file mode 100644 index 000000000000..ad3b27c66350 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go @@ -0,0 +1,134 @@ +package inventoryitems + +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 = &InventoryItemId{} + +// InventoryItemId is a struct representing the Resource ID for a Inventory Item +type InventoryItemId struct { + SubscriptionId string + ResourceGroupName string + VmmServerName string + InventoryItemName string +} + +// NewInventoryItemID returns a new InventoryItemId struct +func NewInventoryItemID(subscriptionId string, resourceGroupName string, vmmServerName string, inventoryItemName string) InventoryItemId { + return InventoryItemId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VmmServerName: vmmServerName, + InventoryItemName: inventoryItemName, + } +} + +// ParseInventoryItemID parses 'input' into a InventoryItemId +func ParseInventoryItemID(input string) (*InventoryItemId, error) { + parser := resourceids.NewParserFromResourceIdType(&InventoryItemId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := InventoryItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseInventoryItemIDInsensitively parses 'input' case-insensitively into a InventoryItemId +// note: this method should only be used for API response data and not user input +func ParseInventoryItemIDInsensitively(input string) (*InventoryItemId, error) { + parser := resourceids.NewParserFromResourceIdType(&InventoryItemId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := InventoryItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InventoryItemId) 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.VmmServerName, ok = input.Parsed["vmmServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", input) + } + + if id.InventoryItemName, ok = input.Parsed["inventoryItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", input) + } + + return nil +} + +// ValidateInventoryItemID checks that 'input' can be parsed as a Inventory Item ID +func ValidateInventoryItemID(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 := ParseInventoryItemID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Inventory Item ID +func (id InventoryItemId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/vmmServers/%s/inventoryItems/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VmmServerName, id.InventoryItemName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Inventory Item ID +func (id InventoryItemId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticVmmServers", "vmmServers", "vmmServers"), + resourceids.UserSpecifiedSegment("vmmServerName", "vmmServerValue"), + resourceids.StaticSegment("staticInventoryItems", "inventoryItems", "inventoryItems"), + resourceids.UserSpecifiedSegment("inventoryItemName", "inventoryItemValue"), + } +} + +// String returns a human-readable description of this Inventory Item ID +func (id InventoryItemId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vmm Server Name: %q", id.VmmServerName), + fmt.Sprintf("Inventory Item Name: %q", id.InventoryItemName), + } + return fmt.Sprintf("Inventory Item (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go new file mode 100644 index 000000000000..4887263a7565 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go @@ -0,0 +1,125 @@ +package inventoryitems + +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 = &VMmServerId{} + +// VMmServerId is a struct representing the Resource ID for a V Mm Server +type VMmServerId struct { + SubscriptionId string + ResourceGroupName string + VmmServerName string +} + +// NewVMmServerID returns a new VMmServerId struct +func NewVMmServerID(subscriptionId string, resourceGroupName string, vmmServerName string) VMmServerId { + return VMmServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VmmServerName: vmmServerName, + } +} + +// ParseVMmServerID parses 'input' into a VMmServerId +func ParseVMmServerID(input string) (*VMmServerId, error) { + parser := resourceids.NewParserFromResourceIdType(&VMmServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VMmServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVMmServerIDInsensitively parses 'input' case-insensitively into a VMmServerId +// note: this method should only be used for API response data and not user input +func ParseVMmServerIDInsensitively(input string) (*VMmServerId, error) { + parser := resourceids.NewParserFromResourceIdType(&VMmServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VMmServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VMmServerId) 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.VmmServerName, ok = input.Parsed["vmmServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", input) + } + + return nil +} + +// ValidateVMmServerID checks that 'input' can be parsed as a V Mm Server ID +func ValidateVMmServerID(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 := ParseVMmServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted V Mm Server ID +func (id VMmServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/vmmServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VmmServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this V Mm Server ID +func (id VMmServerId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticVmmServers", "vmmServers", "vmmServers"), + resourceids.UserSpecifiedSegment("vmmServerName", "vmmServerValue"), + } +} + +// String returns a human-readable description of this V Mm Server ID +func (id VMmServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vmm Server Name: %q", id.VmmServerName), + } + return fmt.Sprintf("V Mm Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_create.go new file mode 100644 index 000000000000..ab6fe5391575 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_create.go @@ -0,0 +1,56 @@ +package inventoryitems + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *InventoryItem +} + +// Create ... +func (c InventoryItemsClient) Create(ctx context.Context, id InventoryItemId, input InventoryItem) (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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_delete.go new file mode 100644 index 000000000000..12d362566681 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_delete.go @@ -0,0 +1,47 @@ +package inventoryitems + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c InventoryItemsClient) Delete(ctx context.Context, id InventoryItemId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_get.go new file mode 100644 index 000000000000..ba12f1d9f3b8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_get.go @@ -0,0 +1,51 @@ +package inventoryitems + +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 *InventoryItem +} + +// Get ... +func (c InventoryItemsClient) Get(ctx context.Context, id InventoryItemId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_listbyvmmserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_listbyvmmserver.go new file mode 100644 index 000000000000..5fb5d32126c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_listbyvmmserver.go @@ -0,0 +1,91 @@ +package inventoryitems + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByVMMServerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]InventoryItem +} + +type ListByVMMServerCompleteResult struct { + LatestHttpResponse *http.Response + Items []InventoryItem +} + +// ListByVMMServer ... +func (c InventoryItemsClient) ListByVMMServer(ctx context.Context, id VMmServerId) (result ListByVMMServerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/inventoryItems", 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 *[]InventoryItem `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByVMMServerComplete retrieves all the results into a single object +func (c InventoryItemsClient) ListByVMMServerComplete(ctx context.Context, id VMmServerId) (ListByVMMServerCompleteResult, error) { + return c.ListByVMMServerCompleteMatchingPredicate(ctx, id, InventoryItemOperationPredicate{}) +} + +// ListByVMMServerCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c InventoryItemsClient) ListByVMMServerCompleteMatchingPredicate(ctx context.Context, id VMmServerId, predicate InventoryItemOperationPredicate) (result ListByVMMServerCompleteResult, err error) { + items := make([]InventoryItem, 0) + + resp, err := c.ListByVMMServer(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 = ListByVMMServerCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_cloudinventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_cloudinventoryitem.go new file mode 100644 index 000000000000..b8d67d2a4b2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_cloudinventoryitem.go @@ -0,0 +1,44 @@ +package inventoryitems + +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 _ InventoryItemProperties = CloudInventoryItem{} + +type CloudInventoryItem struct { + + // Fields inherited from InventoryItemProperties + InventoryItemName *string `json:"inventoryItemName,omitempty"` + ManagedResourceId *string `json:"managedResourceId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` +} + +var _ json.Marshaler = CloudInventoryItem{} + +func (s CloudInventoryItem) MarshalJSON() ([]byte, error) { + type wrapper CloudInventoryItem + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CloudInventoryItem: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CloudInventoryItem: %+v", err) + } + decoded["inventoryType"] = "Cloud" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CloudInventoryItem: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitem.go new file mode 100644 index 000000000000..92f80c1062df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitem.go @@ -0,0 +1,50 @@ +package inventoryitems + +import ( + "encoding/json" + "fmt" + + "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 InventoryItem struct { + Id *string `json:"id,omitempty"` + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` + Properties InventoryItemProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Unmarshaler = &InventoryItem{} + +func (s *InventoryItem) UnmarshalJSON(bytes []byte) error { + type alias InventoryItem + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into InventoryItem: %+v", err) + } + + s.Id = decoded.Id + s.Kind = decoded.Kind + s.Name = decoded.Name + s.SystemData = decoded.SystemData + s.Type = decoded.Type + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling InventoryItem into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := unmarshalInventoryItemPropertiesImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'InventoryItem': %+v", err) + } + s.Properties = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemdetails.go new file mode 100644 index 000000000000..e5636a2456da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemdetails.go @@ -0,0 +1,9 @@ +package inventoryitems + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InventoryItemDetails struct { + InventoryItemId *string `json:"inventoryItemId,omitempty"` + InventoryItemName *string `json:"inventoryItemName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemproperties.go new file mode 100644 index 000000000000..897fb127207a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemproperties.go @@ -0,0 +1,77 @@ +package inventoryitems + +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 InventoryItemProperties interface { +} + +// RawInventoryItemPropertiesImpl 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 RawInventoryItemPropertiesImpl struct { + Type string + Values map[string]interface{} +} + +func unmarshalInventoryItemPropertiesImplementation(input []byte) (InventoryItemProperties, 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 InventoryItemProperties into map[string]interface: %+v", err) + } + + value, ok := temp["inventoryType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "Cloud") { + var out CloudInventoryItem + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CloudInventoryItem: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "VirtualMachine") { + var out VirtualMachineInventoryItem + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into VirtualMachineInventoryItem: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "VirtualMachineTemplate") { + var out VirtualMachineTemplateInventoryItem + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into VirtualMachineTemplateInventoryItem: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "VirtualNetwork") { + var out VirtualNetworkInventoryItem + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into VirtualNetworkInventoryItem: %+v", err) + } + return out, nil + } + + out := RawInventoryItemPropertiesImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachineinventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachineinventoryitem.go new file mode 100644 index 000000000000..8feb3388a141 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachineinventoryitem.go @@ -0,0 +1,52 @@ +package inventoryitems + +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 _ InventoryItemProperties = VirtualMachineInventoryItem{} + +type VirtualMachineInventoryItem struct { + BiosGuid *string `json:"biosGuid,omitempty"` + Cloud *InventoryItemDetails `json:"cloud,omitempty"` + IPAddresses *[]string `json:"ipAddresses,omitempty"` + ManagedMachineResourceId *string `json:"managedMachineResourceId,omitempty"` + OsName *string `json:"osName,omitempty"` + OsType *OsType `json:"osType,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + PowerState *string `json:"powerState,omitempty"` + + // Fields inherited from InventoryItemProperties + InventoryItemName *string `json:"inventoryItemName,omitempty"` + ManagedResourceId *string `json:"managedResourceId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` +} + +var _ json.Marshaler = VirtualMachineInventoryItem{} + +func (s VirtualMachineInventoryItem) MarshalJSON() ([]byte, error) { + type wrapper VirtualMachineInventoryItem + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling VirtualMachineInventoryItem: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling VirtualMachineInventoryItem: %+v", err) + } + decoded["inventoryType"] = "VirtualMachine" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling VirtualMachineInventoryItem: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachinetemplateinventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachinetemplateinventoryitem.go new file mode 100644 index 000000000000..d039273b7497 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachinetemplateinventoryitem.go @@ -0,0 +1,48 @@ +package inventoryitems + +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 _ InventoryItemProperties = VirtualMachineTemplateInventoryItem{} + +type VirtualMachineTemplateInventoryItem struct { + CpuCount *int64 `json:"cpuCount,omitempty"` + MemoryMB *int64 `json:"memoryMB,omitempty"` + OsName *string `json:"osName,omitempty"` + OsType *OsType `json:"osType,omitempty"` + + // Fields inherited from InventoryItemProperties + InventoryItemName *string `json:"inventoryItemName,omitempty"` + ManagedResourceId *string `json:"managedResourceId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` +} + +var _ json.Marshaler = VirtualMachineTemplateInventoryItem{} + +func (s VirtualMachineTemplateInventoryItem) MarshalJSON() ([]byte, error) { + type wrapper VirtualMachineTemplateInventoryItem + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling VirtualMachineTemplateInventoryItem: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling VirtualMachineTemplateInventoryItem: %+v", err) + } + decoded["inventoryType"] = "VirtualMachineTemplate" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling VirtualMachineTemplateInventoryItem: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualnetworkinventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualnetworkinventoryitem.go new file mode 100644 index 000000000000..23e698f13a8a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualnetworkinventoryitem.go @@ -0,0 +1,44 @@ +package inventoryitems + +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 _ InventoryItemProperties = VirtualNetworkInventoryItem{} + +type VirtualNetworkInventoryItem struct { + + // Fields inherited from InventoryItemProperties + InventoryItemName *string `json:"inventoryItemName,omitempty"` + ManagedResourceId *string `json:"managedResourceId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` +} + +var _ json.Marshaler = VirtualNetworkInventoryItem{} + +func (s VirtualNetworkInventoryItem) MarshalJSON() ([]byte, error) { + type wrapper VirtualNetworkInventoryItem + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling VirtualNetworkInventoryItem: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling VirtualNetworkInventoryItem: %+v", err) + } + decoded["inventoryType"] = "VirtualNetwork" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling VirtualNetworkInventoryItem: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/predicates.go new file mode 100644 index 000000000000..228f404a3763 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/predicates.go @@ -0,0 +1,32 @@ +package inventoryitems + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InventoryItemOperationPredicate struct { + Id *string + Kind *string + Name *string + Type *string +} + +func (p InventoryItemOperationPredicate) Matches(input InventoryItem) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil || *p.Kind != *input.Kind) { + 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/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/version.go new file mode 100644 index 000000000000..9aa6fde2110d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/version.go @@ -0,0 +1,12 @@ +package inventoryitems + +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-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/inventoryitems/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/README.md new file mode 100644 index 000000000000..3f27f82a2ab9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/README.md @@ -0,0 +1,192 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances` Documentation + +The `virtualmachineinstances` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances" +``` + + +### Client Initialization + +```go +client := virtualmachineinstances.NewVirtualMachineInstancesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineInstancesClient.CreateCheckpoint` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.VirtualMachineCreateCheckpoint{ + // ... +} + + +if err := client.CreateCheckpointThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.VirtualMachineInstance{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.Delete` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.DeleteThenPoll(ctx, id, virtualmachineinstances.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.DeleteCheckpoint` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.VirtualMachineDeleteCheckpoint{ + // ... +} + + +if err := client.DeleteCheckpointThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.Get` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +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: `VirtualMachineInstancesClient.List` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// 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: `VirtualMachineInstancesClient.Restart` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.RestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.RestoreCheckpoint` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.VirtualMachineRestoreCheckpoint{ + // ... +} + + +if err := client.RestoreCheckpointThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.Start` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.StartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.Stop` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.StopVirtualMachineOptions{ + // ... +} + + +if err := client.StopThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.Update` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.VirtualMachineInstanceUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/client.go new file mode 100644 index 000000000000..e40ddc4adf55 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/client.go @@ -0,0 +1,26 @@ +package virtualmachineinstances + +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 VirtualMachineInstancesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineInstancesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineInstancesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "virtualmachineinstances", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineInstancesClient: %+v", err) + } + + return &VirtualMachineInstancesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/constants.go new file mode 100644 index 000000000000..14c1b12df63d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/constants.go @@ -0,0 +1,441 @@ +package virtualmachineinstances + +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 AllocationMethod string + +const ( + AllocationMethodDynamic AllocationMethod = "Dynamic" + AllocationMethodStatic AllocationMethod = "Static" +) + +func PossibleValuesForAllocationMethod() []string { + return []string{ + string(AllocationMethodDynamic), + string(AllocationMethodStatic), + } +} + +func (s *AllocationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAllocationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAllocationMethod(input string) (*AllocationMethod, error) { + vals := map[string]AllocationMethod{ + "dynamic": AllocationMethodDynamic, + "static": AllocationMethodStatic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AllocationMethod(input) + return &out, nil +} + +type CreateDiffDisk string + +const ( + CreateDiffDiskFalse CreateDiffDisk = "false" + CreateDiffDiskTrue CreateDiffDisk = "true" +) + +func PossibleValuesForCreateDiffDisk() []string { + return []string{ + string(CreateDiffDiskFalse), + string(CreateDiffDiskTrue), + } +} + +func (s *CreateDiffDisk) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCreateDiffDisk(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCreateDiffDisk(input string) (*CreateDiffDisk, error) { + vals := map[string]CreateDiffDisk{ + "false": CreateDiffDiskFalse, + "true": CreateDiffDiskTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateDiffDisk(input) + return &out, nil +} + +type DeleteFromHost string + +const ( + DeleteFromHostFalse DeleteFromHost = "false" + DeleteFromHostTrue DeleteFromHost = "true" +) + +func PossibleValuesForDeleteFromHost() []string { + return []string{ + string(DeleteFromHostFalse), + string(DeleteFromHostTrue), + } +} + +func (s *DeleteFromHost) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeleteFromHost(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeleteFromHost(input string) (*DeleteFromHost, error) { + vals := map[string]DeleteFromHost{ + "false": DeleteFromHostFalse, + "true": DeleteFromHostTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeleteFromHost(input) + return &out, nil +} + +type DynamicMemoryEnabled string + +const ( + DynamicMemoryEnabledFalse DynamicMemoryEnabled = "false" + DynamicMemoryEnabledTrue DynamicMemoryEnabled = "true" +) + +func PossibleValuesForDynamicMemoryEnabled() []string { + return []string{ + string(DynamicMemoryEnabledFalse), + string(DynamicMemoryEnabledTrue), + } +} + +func (s *DynamicMemoryEnabled) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDynamicMemoryEnabled(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDynamicMemoryEnabled(input string) (*DynamicMemoryEnabled, error) { + vals := map[string]DynamicMemoryEnabled{ + "false": DynamicMemoryEnabledFalse, + "true": DynamicMemoryEnabledTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DynamicMemoryEnabled(input) + return &out, nil +} + +type Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type IsHighlyAvailable string + +const ( + IsHighlyAvailableFalse IsHighlyAvailable = "false" + IsHighlyAvailableTrue IsHighlyAvailable = "true" +) + +func PossibleValuesForIsHighlyAvailable() []string { + return []string{ + string(IsHighlyAvailableFalse), + string(IsHighlyAvailableTrue), + } +} + +func (s *IsHighlyAvailable) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIsHighlyAvailable(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIsHighlyAvailable(input string) (*IsHighlyAvailable, error) { + vals := map[string]IsHighlyAvailable{ + "false": IsHighlyAvailableFalse, + "true": IsHighlyAvailableTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IsHighlyAvailable(input) + return &out, nil +} + +type LimitCPUForMigration string + +const ( + LimitCPUForMigrationFalse LimitCPUForMigration = "false" + LimitCPUForMigrationTrue LimitCPUForMigration = "true" +) + +func PossibleValuesForLimitCPUForMigration() []string { + return []string{ + string(LimitCPUForMigrationFalse), + string(LimitCPUForMigrationTrue), + } +} + +func (s *LimitCPUForMigration) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLimitCPUForMigration(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLimitCPUForMigration(input string) (*LimitCPUForMigration, error) { + vals := map[string]LimitCPUForMigration{ + "false": LimitCPUForMigrationFalse, + "true": LimitCPUForMigrationTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LimitCPUForMigration(input) + return &out, nil +} + +type OsType string + +const ( + OsTypeLinux OsType = "Linux" + OsTypeOther OsType = "Other" + OsTypeWindows OsType = "Windows" +) + +func PossibleValuesForOsType() []string { + return []string{ + string(OsTypeLinux), + string(OsTypeOther), + 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, + "other": OsTypeOther, + "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 ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type SkipShutdown string + +const ( + SkipShutdownFalse SkipShutdown = "false" + SkipShutdownTrue SkipShutdown = "true" +) + +func PossibleValuesForSkipShutdown() []string { + return []string{ + string(SkipShutdownFalse), + string(SkipShutdownTrue), + } +} + +func (s *SkipShutdown) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkipShutdown(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSkipShutdown(input string) (*SkipShutdown, error) { + vals := map[string]SkipShutdown{ + "false": SkipShutdownFalse, + "true": SkipShutdownTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkipShutdown(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createcheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createcheckpoint.go new file mode 100644 index 000000000000..10ad40383b7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createcheckpoint.go @@ -0,0 +1,74 @@ +package virtualmachineinstances + +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/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 CreateCheckpointOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateCheckpoint ... +func (c VirtualMachineInstancesClient) CreateCheckpoint(ctx context.Context, id commonids.ScopeId, input VirtualMachineCreateCheckpoint) (result CreateCheckpointOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/createCheckpoint", 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 +} + +// CreateCheckpointThenPoll performs CreateCheckpoint then polls until it's completed +func (c VirtualMachineInstancesClient) CreateCheckpointThenPoll(ctx context.Context, id commonids.ScopeId, input VirtualMachineCreateCheckpoint) error { + result, err := c.CreateCheckpoint(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateCheckpoint: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateCheckpoint: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createorupdate.go new file mode 100644 index 000000000000..d267f5ba1798 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createorupdate.go @@ -0,0 +1,76 @@ +package virtualmachineinstances + +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/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineInstance +} + +// CreateOrUpdate ... +func (c VirtualMachineInstancesClient) CreateOrUpdate(ctx context.Context, id commonids.ScopeId, input VirtualMachineInstance) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VirtualMachineInstancesClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.ScopeId, input VirtualMachineInstance) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_delete.go new file mode 100644 index 000000000000..a5b03734e588 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_delete.go @@ -0,0 +1,103 @@ +package virtualmachineinstances + +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/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 +} + +type DeleteOperationOptions struct { + DeleteFromHost *DeleteFromHost + Force *Force +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.DeleteFromHost != nil { + out.Append("deleteFromHost", fmt.Sprintf("%v", *o.DeleteFromHost)) + } + if o.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c VirtualMachineInstancesClient) Delete(ctx context.Context, id commonids.ScopeId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualMachineInstancesClient) DeleteThenPoll(ctx context.Context, id commonids.ScopeId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_deletecheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_deletecheckpoint.go new file mode 100644 index 000000000000..b355bcd3c840 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_deletecheckpoint.go @@ -0,0 +1,74 @@ +package virtualmachineinstances + +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/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 DeleteCheckpointOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeleteCheckpoint ... +func (c VirtualMachineInstancesClient) DeleteCheckpoint(ctx context.Context, id commonids.ScopeId, input VirtualMachineDeleteCheckpoint) (result DeleteCheckpointOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/deleteCheckpoint", 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 +} + +// DeleteCheckpointThenPoll performs DeleteCheckpoint then polls until it's completed +func (c VirtualMachineInstancesClient) DeleteCheckpointThenPoll(ctx context.Context, id commonids.ScopeId, input VirtualMachineDeleteCheckpoint) error { + result, err := c.DeleteCheckpoint(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DeleteCheckpoint: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeleteCheckpoint: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_get.go new file mode 100644 index 000000000000..409ceb486d9b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_get.go @@ -0,0 +1,53 @@ +package virtualmachineinstances + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineInstance +} + +// Get ... +func (c VirtualMachineInstancesClient) Get(ctx context.Context, id commonids.ScopeId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_list.go new file mode 100644 index 000000000000..c3c8a2e94ce2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_list.go @@ -0,0 +1,92 @@ +package virtualmachineinstances + +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 *[]VirtualMachineInstance +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineInstance +} + +// List ... +func (c VirtualMachineInstancesClient) List(ctx context.Context, id commonids.ScopeId) (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.ScVmm/virtualMachineInstances", 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 *[]VirtualMachineInstance `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 VirtualMachineInstancesClient) ListComplete(ctx context.Context, id commonids.ScopeId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, VirtualMachineInstanceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineInstancesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate VirtualMachineInstanceOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachineInstance, 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/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restart.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restart.go new file mode 100644 index 000000000000..6d7dbeeaba48 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restart.go @@ -0,0 +1,70 @@ +package virtualmachineinstances + +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/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 RestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restart ... +func (c VirtualMachineInstancesClient) Restart(ctx context.Context, id commonids.ScopeId) (result RestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/restart", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + 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 +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c VirtualMachineInstancesClient) RestartThenPoll(ctx context.Context, id commonids.ScopeId) error { + result, err := c.Restart(ctx, id) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restorecheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restorecheckpoint.go new file mode 100644 index 000000000000..482733633552 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restorecheckpoint.go @@ -0,0 +1,74 @@ +package virtualmachineinstances + +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/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 RestoreCheckpointOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RestoreCheckpoint ... +func (c VirtualMachineInstancesClient) RestoreCheckpoint(ctx context.Context, id commonids.ScopeId, input VirtualMachineRestoreCheckpoint) (result RestoreCheckpointOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/restoreCheckpoint", 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 +} + +// RestoreCheckpointThenPoll performs RestoreCheckpoint then polls until it's completed +func (c VirtualMachineInstancesClient) RestoreCheckpointThenPoll(ctx context.Context, id commonids.ScopeId, input VirtualMachineRestoreCheckpoint) error { + result, err := c.RestoreCheckpoint(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RestoreCheckpoint: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RestoreCheckpoint: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_start.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_start.go new file mode 100644 index 000000000000..0ef71d0d7250 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_start.go @@ -0,0 +1,70 @@ +package virtualmachineinstances + +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/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 +} + +// Start ... +func (c VirtualMachineInstancesClient) Start(ctx context.Context, id commonids.ScopeId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/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 VirtualMachineInstancesClient) StartThenPoll(ctx context.Context, id commonids.ScopeId) 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/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_stop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_stop.go new file mode 100644 index 000000000000..6f7f1e3cd31a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_stop.go @@ -0,0 +1,74 @@ +package virtualmachineinstances + +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/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 +} + +// Stop ... +func (c VirtualMachineInstancesClient) Stop(ctx context.Context, id commonids.ScopeId, input StopVirtualMachineOptions) (result StopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/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 VirtualMachineInstancesClient) StopThenPoll(ctx context.Context, id commonids.ScopeId, input StopVirtualMachineOptions) 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/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_update.go new file mode 100644 index 000000000000..b10bc70dafa6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_update.go @@ -0,0 +1,76 @@ +package virtualmachineinstances + +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/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 *VirtualMachineInstance +} + +// Update ... +func (c VirtualMachineInstancesClient) Update(ctx context.Context, id commonids.ScopeId, input VirtualMachineInstanceUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VirtualMachineInstancesClient) UpdateThenPoll(ctx context.Context, id commonids.ScopeId, input VirtualMachineInstanceUpdate) 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/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_availabilitysetlistavailabilitysetsinlined.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_availabilitysetlistavailabilitysetsinlined.go new file mode 100644 index 000000000000..eeee23b8d4bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_availabilitysetlistavailabilitysetsinlined.go @@ -0,0 +1,9 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetListAvailabilitySetsInlined struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_checkpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_checkpoint.go new file mode 100644 index 000000000000..15a4dd74ae18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_checkpoint.go @@ -0,0 +1,11 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Checkpoint struct { + CheckpointID *string `json:"checkpointID,omitempty"` + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + ParentCheckpointID *string `json:"parentCheckpointID,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_extendedlocation.go new file mode 100644 index 000000000000..a86814d6f629 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_extendedlocation.go @@ -0,0 +1,9 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofile.go new file mode 100644 index 000000000000..1d9b975390c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofile.go @@ -0,0 +1,14 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfile struct { + CpuCount *int64 `json:"cpuCount,omitempty"` + DynamicMemoryEnabled *DynamicMemoryEnabled `json:"dynamicMemoryEnabled,omitempty"` + DynamicMemoryMaxMB *int64 `json:"dynamicMemoryMaxMB,omitempty"` + DynamicMemoryMinMB *int64 `json:"dynamicMemoryMinMB,omitempty"` + IsHighlyAvailable *IsHighlyAvailable `json:"isHighlyAvailable,omitempty"` + LimitCPUForMigration *LimitCPUForMigration `json:"limitCpuForMigration,omitempty"` + MemoryMB *int64 `json:"memoryMB,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofileupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofileupdate.go new file mode 100644 index 000000000000..b94c91c58b0b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofileupdate.go @@ -0,0 +1,13 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfileUpdate struct { + CpuCount *int64 `json:"cpuCount,omitempty"` + DynamicMemoryEnabled *DynamicMemoryEnabled `json:"dynamicMemoryEnabled,omitempty"` + DynamicMemoryMaxMB *int64 `json:"dynamicMemoryMaxMB,omitempty"` + DynamicMemoryMinMB *int64 `json:"dynamicMemoryMinMB,omitempty"` + LimitCPUForMigration *LimitCPUForMigration `json:"limitCpuForMigration,omitempty"` + MemoryMB *int64 `json:"memoryMB,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofile.go new file mode 100644 index 000000000000..22fac2ad6808 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofile.go @@ -0,0 +1,18 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InfrastructureProfile struct { + BiosGuid *string `json:"biosGuid,omitempty"` + CheckpointType *string `json:"checkpointType,omitempty"` + Checkpoints *[]Checkpoint `json:"checkpoints,omitempty"` + CloudId *string `json:"cloudId,omitempty"` + Generation *int64 `json:"generation,omitempty"` + InventoryItemId *string `json:"inventoryItemId,omitempty"` + LastRestoredVMCheckpoint *Checkpoint `json:"lastRestoredVMCheckpoint,omitempty"` + TemplateId *string `json:"templateId,omitempty"` + Uuid *string `json:"uuid,omitempty"` + VMmServerId *string `json:"vmmServerId,omitempty"` + VirtualMachineName *string `json:"vmName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofileupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofileupdate.go new file mode 100644 index 000000000000..dc63b0086fec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofileupdate.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InfrastructureProfileUpdate struct { + CheckpointType *string `json:"checkpointType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterface.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterface.go new file mode 100644 index 000000000000..5bd4c50160ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterface.go @@ -0,0 +1,18 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterface struct { + DisplayName *string `json:"displayName,omitempty"` + IPv4AddressType *AllocationMethod `json:"ipv4AddressType,omitempty"` + IPv4Addresses *[]string `json:"ipv4Addresses,omitempty"` + IPv6AddressType *AllocationMethod `json:"ipv6AddressType,omitempty"` + IPv6Addresses *[]string `json:"ipv6Addresses,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` + MacAddressType *AllocationMethod `json:"macAddressType,omitempty"` + Name *string `json:"name,omitempty"` + NetworkName *string `json:"networkName,omitempty"` + NicId *string `json:"nicId,omitempty"` + VirtualNetworkId *string `json:"virtualNetworkId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterfaceupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterfaceupdate.go new file mode 100644 index 000000000000..5c00dd7add31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterfaceupdate.go @@ -0,0 +1,14 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceUpdate struct { + IPv4AddressType *AllocationMethod `json:"ipv4AddressType,omitempty"` + IPv6AddressType *AllocationMethod `json:"ipv6AddressType,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` + MacAddressType *AllocationMethod `json:"macAddressType,omitempty"` + Name *string `json:"name,omitempty"` + NicId *string `json:"nicId,omitempty"` + VirtualNetworkId *string `json:"virtualNetworkId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofile.go new file mode 100644 index 000000000000..b1085e716f8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofile.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfile struct { + NetworkInterfaces *[]NetworkInterface `json:"networkInterfaces,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofileupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofileupdate.go new file mode 100644 index 000000000000..dcc323d7f683 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofileupdate.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfileUpdate struct { + NetworkInterfaces *[]NetworkInterfaceUpdate `json:"networkInterfaces,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_osprofileforvminstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_osprofileforvminstance.go new file mode 100644 index 000000000000..e1837a1b7c9b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_osprofileforvminstance.go @@ -0,0 +1,12 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OsProfileForVMInstance struct { + AdminPassword *string `json:"adminPassword,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + OsSku *string `json:"osSku,omitempty"` + OsType *OsType `json:"osType,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_stopvirtualmachineoptions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_stopvirtualmachineoptions.go new file mode 100644 index 000000000000..5d7c04bfd445 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_stopvirtualmachineoptions.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopVirtualMachineOptions struct { + SkipShutdown *SkipShutdown `json:"skipShutdown,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofile.go new file mode 100644 index 000000000000..1fcda71bf221 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofile.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + Disks *[]VirtualDisk `json:"disks,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofileupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofileupdate.go new file mode 100644 index 000000000000..c9b1f05dc0c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofileupdate.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfileUpdate struct { + Disks *[]VirtualDiskUpdate `json:"disks,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageqospolicydetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageqospolicydetails.go new file mode 100644 index 000000000000..4b919e02a871 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageqospolicydetails.go @@ -0,0 +1,9 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageQoSPolicyDetails struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdisk.go new file mode 100644 index 000000000000..ffd700958da0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdisk.go @@ -0,0 +1,21 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualDisk struct { + Bus *int64 `json:"bus,omitempty"` + BusType *string `json:"busType,omitempty"` + CreateDiffDisk *CreateDiffDisk `json:"createDiffDisk,omitempty"` + DiskId *string `json:"diskId,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Lun *int64 `json:"lun,omitempty"` + MaxDiskSizeGB *int64 `json:"maxDiskSizeGB,omitempty"` + Name *string `json:"name,omitempty"` + StorageQoSPolicy *StorageQoSPolicyDetails `json:"storageQoSPolicy,omitempty"` + TemplateDiskId *string `json:"templateDiskId,omitempty"` + VhdFormatType *string `json:"vhdFormatType,omitempty"` + VhdType *string `json:"vhdType,omitempty"` + VolumeType *string `json:"volumeType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdiskupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdiskupdate.go new file mode 100644 index 000000000000..49d92b465d7d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdiskupdate.go @@ -0,0 +1,15 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualDiskUpdate struct { + Bus *int64 `json:"bus,omitempty"` + BusType *string `json:"busType,omitempty"` + DiskId *string `json:"diskId,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Lun *int64 `json:"lun,omitempty"` + Name *string `json:"name,omitempty"` + StorageQoSPolicy *StorageQoSPolicyDetails `json:"storageQoSPolicy,omitempty"` + VhdType *string `json:"vhdType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinecreatecheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinecreatecheckpoint.go new file mode 100644 index 000000000000..162ee0cfa4c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinecreatecheckpoint.go @@ -0,0 +1,9 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineCreateCheckpoint struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinedeletecheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinedeletecheckpoint.go new file mode 100644 index 000000000000..71ab42fa81b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinedeletecheckpoint.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineDeleteCheckpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstance.go new file mode 100644 index 000000000000..22578153c53a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstance.go @@ -0,0 +1,17 @@ +package virtualmachineinstances + +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 VirtualMachineInstance struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties VirtualMachineInstanceProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceproperties.go new file mode 100644 index 000000000000..b8549a4145e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceproperties.go @@ -0,0 +1,15 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstanceProperties struct { + AvailabilitySets *[]AvailabilitySetListAvailabilitySetsInlined `json:"availabilitySets,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + InfrastructureProfile *InfrastructureProfile `json:"infrastructureProfile,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + OsProfile *OsProfileForVMInstance `json:"osProfile,omitempty"` + PowerState *string `json:"powerState,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdate.go new file mode 100644 index 000000000000..f95bd091276e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdate.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstanceUpdate struct { + Properties *VirtualMachineInstanceUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdateproperties.go new file mode 100644 index 000000000000..de7604d85c4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdateproperties.go @@ -0,0 +1,12 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstanceUpdateProperties struct { + AvailabilitySets *[]AvailabilitySetListAvailabilitySetsInlined `json:"availabilitySets,omitempty"` + HardwareProfile *HardwareProfileUpdate `json:"hardwareProfile,omitempty"` + InfrastructureProfile *InfrastructureProfileUpdate `json:"infrastructureProfile,omitempty"` + NetworkProfile *NetworkProfileUpdate `json:"networkProfile,omitempty"` + StorageProfile *StorageProfileUpdate `json:"storageProfile,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinerestorecheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinerestorecheckpoint.go new file mode 100644 index 000000000000..43279778e524 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinerestorecheckpoint.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRestoreCheckpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/predicates.go new file mode 100644 index 000000000000..e4d7d84f3570 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/predicates.go @@ -0,0 +1,27 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstanceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VirtualMachineInstanceOperationPredicate) Matches(input VirtualMachineInstance) 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/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/version.go new file mode 100644 index 000000000000..ff7feb152741 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/version.go @@ -0,0 +1,12 @@ +package virtualmachineinstances + +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-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualmachineinstances/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/README.md new file mode 100644 index 000000000000..f685fef694fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates` Documentation + +The `virtualmachinetemplates` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates" +``` + + +### Client Initialization + +```go +client := virtualmachinetemplates.NewVirtualMachineTemplatesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineTemplatesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachinetemplates.NewVirtualMachineTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineTemplateValue") + +payload := virtualmachinetemplates.VirtualMachineTemplate{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineTemplatesClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinetemplates.NewVirtualMachineTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineTemplateValue") + +if err := client.DeleteThenPoll(ctx, id, virtualmachinetemplates.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineTemplatesClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinetemplates.NewVirtualMachineTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineTemplateValue") + +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: `VirtualMachineTemplatesClient.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: `VirtualMachineTemplatesClient.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: `VirtualMachineTemplatesClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinetemplates.NewVirtualMachineTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineTemplateValue") + +payload := virtualmachinetemplates.ResourcePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/client.go new file mode 100644 index 000000000000..12c5314c789e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/client.go @@ -0,0 +1,26 @@ +package virtualmachinetemplates + +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 VirtualMachineTemplatesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineTemplatesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineTemplatesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "virtualmachinetemplates", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineTemplatesClient: %+v", err) + } + + return &VirtualMachineTemplatesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/constants.go new file mode 100644 index 000000000000..a3405ff11e2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/constants.go @@ -0,0 +1,400 @@ +package virtualmachinetemplates + +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 AllocationMethod string + +const ( + AllocationMethodDynamic AllocationMethod = "Dynamic" + AllocationMethodStatic AllocationMethod = "Static" +) + +func PossibleValuesForAllocationMethod() []string { + return []string{ + string(AllocationMethodDynamic), + string(AllocationMethodStatic), + } +} + +func (s *AllocationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAllocationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAllocationMethod(input string) (*AllocationMethod, error) { + vals := map[string]AllocationMethod{ + "dynamic": AllocationMethodDynamic, + "static": AllocationMethodStatic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AllocationMethod(input) + return &out, nil +} + +type CreateDiffDisk string + +const ( + CreateDiffDiskFalse CreateDiffDisk = "false" + CreateDiffDiskTrue CreateDiffDisk = "true" +) + +func PossibleValuesForCreateDiffDisk() []string { + return []string{ + string(CreateDiffDiskFalse), + string(CreateDiffDiskTrue), + } +} + +func (s *CreateDiffDisk) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCreateDiffDisk(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCreateDiffDisk(input string) (*CreateDiffDisk, error) { + vals := map[string]CreateDiffDisk{ + "false": CreateDiffDiskFalse, + "true": CreateDiffDiskTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateDiffDisk(input) + return &out, nil +} + +type DynamicMemoryEnabled string + +const ( + DynamicMemoryEnabledFalse DynamicMemoryEnabled = "false" + DynamicMemoryEnabledTrue DynamicMemoryEnabled = "true" +) + +func PossibleValuesForDynamicMemoryEnabled() []string { + return []string{ + string(DynamicMemoryEnabledFalse), + string(DynamicMemoryEnabledTrue), + } +} + +func (s *DynamicMemoryEnabled) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDynamicMemoryEnabled(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDynamicMemoryEnabled(input string) (*DynamicMemoryEnabled, error) { + vals := map[string]DynamicMemoryEnabled{ + "false": DynamicMemoryEnabledFalse, + "true": DynamicMemoryEnabledTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DynamicMemoryEnabled(input) + return &out, nil +} + +type Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type IsCustomizable string + +const ( + IsCustomizableFalse IsCustomizable = "false" + IsCustomizableTrue IsCustomizable = "true" +) + +func PossibleValuesForIsCustomizable() []string { + return []string{ + string(IsCustomizableFalse), + string(IsCustomizableTrue), + } +} + +func (s *IsCustomizable) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIsCustomizable(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIsCustomizable(input string) (*IsCustomizable, error) { + vals := map[string]IsCustomizable{ + "false": IsCustomizableFalse, + "true": IsCustomizableTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IsCustomizable(input) + return &out, nil +} + +type IsHighlyAvailable string + +const ( + IsHighlyAvailableFalse IsHighlyAvailable = "false" + IsHighlyAvailableTrue IsHighlyAvailable = "true" +) + +func PossibleValuesForIsHighlyAvailable() []string { + return []string{ + string(IsHighlyAvailableFalse), + string(IsHighlyAvailableTrue), + } +} + +func (s *IsHighlyAvailable) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIsHighlyAvailable(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIsHighlyAvailable(input string) (*IsHighlyAvailable, error) { + vals := map[string]IsHighlyAvailable{ + "false": IsHighlyAvailableFalse, + "true": IsHighlyAvailableTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IsHighlyAvailable(input) + return &out, nil +} + +type LimitCPUForMigration string + +const ( + LimitCPUForMigrationFalse LimitCPUForMigration = "false" + LimitCPUForMigrationTrue LimitCPUForMigration = "true" +) + +func PossibleValuesForLimitCPUForMigration() []string { + return []string{ + string(LimitCPUForMigrationFalse), + string(LimitCPUForMigrationTrue), + } +} + +func (s *LimitCPUForMigration) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLimitCPUForMigration(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLimitCPUForMigration(input string) (*LimitCPUForMigration, error) { + vals := map[string]LimitCPUForMigration{ + "false": LimitCPUForMigrationFalse, + "true": LimitCPUForMigrationTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LimitCPUForMigration(input) + return &out, nil +} + +type OsType string + +const ( + OsTypeLinux OsType = "Linux" + OsTypeOther OsType = "Other" + OsTypeWindows OsType = "Windows" +) + +func PossibleValuesForOsType() []string { + return []string{ + string(OsTypeLinux), + string(OsTypeOther), + 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, + "other": OsTypeOther, + "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 ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go new file mode 100644 index 000000000000..e53270e22818 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go @@ -0,0 +1,125 @@ +package virtualmachinetemplates + +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 = &VirtualMachineTemplateId{} + +// VirtualMachineTemplateId is a struct representing the Resource ID for a Virtual Machine Template +type VirtualMachineTemplateId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineTemplateName string +} + +// NewVirtualMachineTemplateID returns a new VirtualMachineTemplateId struct +func NewVirtualMachineTemplateID(subscriptionId string, resourceGroupName string, virtualMachineTemplateName string) VirtualMachineTemplateId { + return VirtualMachineTemplateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineTemplateName: virtualMachineTemplateName, + } +} + +// ParseVirtualMachineTemplateID parses 'input' into a VirtualMachineTemplateId +func ParseVirtualMachineTemplateID(input string) (*VirtualMachineTemplateId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineTemplateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineTemplateIDInsensitively parses 'input' case-insensitively into a VirtualMachineTemplateId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineTemplateIDInsensitively(input string) (*VirtualMachineTemplateId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineTemplateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineTemplateId) 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.VirtualMachineTemplateName, ok = input.Parsed["virtualMachineTemplateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", input) + } + + return nil +} + +// ValidateVirtualMachineTemplateID checks that 'input' can be parsed as a Virtual Machine Template ID +func ValidateVirtualMachineTemplateID(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 := ParseVirtualMachineTemplateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Template ID +func (id VirtualMachineTemplateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/virtualMachineTemplates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineTemplateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Template ID +func (id VirtualMachineTemplateId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticVirtualMachineTemplates", "virtualMachineTemplates", "virtualMachineTemplates"), + resourceids.UserSpecifiedSegment("virtualMachineTemplateName", "virtualMachineTemplateValue"), + } +} + +// String returns a human-readable description of this Virtual Machine Template ID +func (id VirtualMachineTemplateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Template Name: %q", id.VirtualMachineTemplateName), + } + return fmt.Sprintf("Virtual Machine Template (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_createorupdate.go new file mode 100644 index 000000000000..706b075af8f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachinetemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineTemplate +} + +// CreateOrUpdate ... +func (c VirtualMachineTemplatesClient) CreateOrUpdate(ctx context.Context, id VirtualMachineTemplateId, input VirtualMachineTemplate) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VirtualMachineTemplatesClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineTemplateId, input VirtualMachineTemplate) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_delete.go new file mode 100644 index 000000000000..98efca73c621 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_delete.go @@ -0,0 +1,98 @@ +package virtualmachinetemplates + +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 +} + +type DeleteOperationOptions struct { + Force *Force +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c VirtualMachineTemplatesClient) Delete(ctx context.Context, id VirtualMachineTemplateId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualMachineTemplatesClient) DeleteThenPoll(ctx context.Context, id VirtualMachineTemplateId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_get.go new file mode 100644 index 000000000000..c5baf634da30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_get.go @@ -0,0 +1,51 @@ +package virtualmachinetemplates + +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 *VirtualMachineTemplate +} + +// Get ... +func (c VirtualMachineTemplatesClient) Get(ctx context.Context, id VirtualMachineTemplateId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbyresourcegroup.go new file mode 100644 index 000000000000..25952c00cf0d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package virtualmachinetemplates + +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 *[]VirtualMachineTemplate +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineTemplate +} + +// ListByResourceGroup ... +func (c VirtualMachineTemplatesClient) 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.ScVmm/virtualMachineTemplates", 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 *[]VirtualMachineTemplate `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 VirtualMachineTemplatesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, VirtualMachineTemplateOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineTemplatesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VirtualMachineTemplateOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]VirtualMachineTemplate, 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/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbysubscription.go new file mode 100644 index 000000000000..523dfde12f31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbysubscription.go @@ -0,0 +1,92 @@ +package virtualmachinetemplates + +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 *[]VirtualMachineTemplate +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineTemplate +} + +// ListBySubscription ... +func (c VirtualMachineTemplatesClient) 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.ScVmm/virtualMachineTemplates", 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 *[]VirtualMachineTemplate `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 VirtualMachineTemplatesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, VirtualMachineTemplateOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineTemplatesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VirtualMachineTemplateOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]VirtualMachineTemplate, 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/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_update.go new file mode 100644 index 000000000000..285078c4134b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_update.go @@ -0,0 +1,75 @@ +package virtualmachinetemplates + +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 *VirtualMachineTemplate +} + +// Update ... +func (c VirtualMachineTemplatesClient) Update(ctx context.Context, id VirtualMachineTemplateId, input ResourcePatch) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VirtualMachineTemplatesClient) UpdateThenPoll(ctx context.Context, id VirtualMachineTemplateId, input ResourcePatch) 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/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_extendedlocation.go new file mode 100644 index 000000000000..7be44f383732 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_extendedlocation.go @@ -0,0 +1,9 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_networkinterface.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_networkinterface.go new file mode 100644 index 000000000000..48a373dc3882 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_networkinterface.go @@ -0,0 +1,18 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterface struct { + DisplayName *string `json:"displayName,omitempty"` + IPv4AddressType *AllocationMethod `json:"ipv4AddressType,omitempty"` + IPv4Addresses *[]string `json:"ipv4Addresses,omitempty"` + IPv6AddressType *AllocationMethod `json:"ipv6AddressType,omitempty"` + IPv6Addresses *[]string `json:"ipv6Addresses,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` + MacAddressType *AllocationMethod `json:"macAddressType,omitempty"` + Name *string `json:"name,omitempty"` + NetworkName *string `json:"networkName,omitempty"` + NicId *string `json:"nicId,omitempty"` + VirtualNetworkId *string `json:"virtualNetworkId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_resourcepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_resourcepatch.go new file mode 100644 index 000000000000..9158fc48b415 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_resourcepatch.go @@ -0,0 +1,8 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourcePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_storageqospolicydetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_storageqospolicydetails.go new file mode 100644 index 000000000000..e39a41230bc3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_storageqospolicydetails.go @@ -0,0 +1,9 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageQoSPolicyDetails struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualdisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualdisk.go new file mode 100644 index 000000000000..ba2d57b6dc34 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualdisk.go @@ -0,0 +1,21 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualDisk struct { + Bus *int64 `json:"bus,omitempty"` + BusType *string `json:"busType,omitempty"` + CreateDiffDisk *CreateDiffDisk `json:"createDiffDisk,omitempty"` + DiskId *string `json:"diskId,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Lun *int64 `json:"lun,omitempty"` + MaxDiskSizeGB *int64 `json:"maxDiskSizeGB,omitempty"` + Name *string `json:"name,omitempty"` + StorageQoSPolicy *StorageQoSPolicyDetails `json:"storageQoSPolicy,omitempty"` + TemplateDiskId *string `json:"templateDiskId,omitempty"` + VhdFormatType *string `json:"vhdFormatType,omitempty"` + VhdType *string `json:"vhdType,omitempty"` + VolumeType *string `json:"volumeType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplate.go new file mode 100644 index 000000000000..d7b80cd73821 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplate.go @@ -0,0 +1,19 @@ +package virtualmachinetemplates + +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 VirtualMachineTemplate struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties VirtualMachineTemplateProperties `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/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplateproperties.go new file mode 100644 index 000000000000..9e470ff000a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplateproperties.go @@ -0,0 +1,25 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineTemplateProperties struct { + ComputerName *string `json:"computerName,omitempty"` + CpuCount *int64 `json:"cpuCount,omitempty"` + Disks *[]VirtualDisk `json:"disks,omitempty"` + DynamicMemoryEnabled *DynamicMemoryEnabled `json:"dynamicMemoryEnabled,omitempty"` + DynamicMemoryMaxMB *int64 `json:"dynamicMemoryMaxMB,omitempty"` + DynamicMemoryMinMB *int64 `json:"dynamicMemoryMinMB,omitempty"` + Generation *int64 `json:"generation,omitempty"` + InventoryItemId *string `json:"inventoryItemId,omitempty"` + IsCustomizable *IsCustomizable `json:"isCustomizable,omitempty"` + IsHighlyAvailable *IsHighlyAvailable `json:"isHighlyAvailable,omitempty"` + LimitCPUForMigration *LimitCPUForMigration `json:"limitCpuForMigration,omitempty"` + MemoryMB *int64 `json:"memoryMB,omitempty"` + NetworkInterfaces *[]NetworkInterface `json:"networkInterfaces,omitempty"` + OsName *string `json:"osName,omitempty"` + OsType *OsType `json:"osType,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` + VMmServerId *string `json:"vmmServerId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/predicates.go new file mode 100644 index 000000000000..89c36171228e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/predicates.go @@ -0,0 +1,32 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineTemplateOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualMachineTemplateOperationPredicate) Matches(input VirtualMachineTemplate) 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/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/version.go new file mode 100644 index 000000000000..719a261728d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/version.go @@ -0,0 +1,12 @@ +package virtualmachinetemplates + +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-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualmachinetemplates/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/README.md new file mode 100644 index 000000000000..b423efd5b808 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks` Documentation + +The `virtualnetworks` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks" +``` + + +### Client Initialization + +```go +client := virtualnetworks.NewVirtualNetworksClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualNetworksClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +payload := virtualnetworks.VirtualNetwork{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworksClient.Delete` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +if err := client.DeleteThenPoll(ctx, id, virtualnetworks.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworksClient.Get` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +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: `VirtualNetworksClient.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: `VirtualNetworksClient.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: `VirtualNetworksClient.Update` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +payload := virtualnetworks.ResourcePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/client.go new file mode 100644 index 000000000000..15c346279f67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/client.go @@ -0,0 +1,26 @@ +package virtualnetworks + +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 VirtualNetworksClient struct { + Client *resourcemanager.Client +} + +func NewVirtualNetworksClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualNetworksClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "virtualnetworks", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualNetworksClient: %+v", err) + } + + return &VirtualNetworksClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/constants.go new file mode 100644 index 000000000000..351afacd3d60 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/constants.go @@ -0,0 +1,110 @@ +package virtualnetworks + +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 Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go new file mode 100644 index 000000000000..3341c9679049 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go @@ -0,0 +1,125 @@ +package virtualnetworks + +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 = &VirtualNetworkId{} + +// VirtualNetworkId is a struct representing the Resource ID for a Virtual Network +type VirtualNetworkId struct { + SubscriptionId string + ResourceGroupName string + VirtualNetworkName string +} + +// NewVirtualNetworkID returns a new VirtualNetworkId struct +func NewVirtualNetworkID(subscriptionId string, resourceGroupName string, virtualNetworkName string) VirtualNetworkId { + return VirtualNetworkId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualNetworkName: virtualNetworkName, + } +} + +// ParseVirtualNetworkID parses 'input' into a VirtualNetworkId +func ParseVirtualNetworkID(input string) (*VirtualNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualNetworkId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualNetworkIDInsensitively parses 'input' case-insensitively into a VirtualNetworkId +// note: this method should only be used for API response data and not user input +func ParseVirtualNetworkIDInsensitively(input string) (*VirtualNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualNetworkId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkId) 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.VirtualNetworkName, ok = input.Parsed["virtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", input) + } + + return nil +} + +// ValidateVirtualNetworkID checks that 'input' can be parsed as a Virtual Network ID +func ValidateVirtualNetworkID(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 := ParseVirtualNetworkID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Network ID +func (id VirtualNetworkId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/virtualNetworks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualNetworkName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Network ID +func (id VirtualNetworkId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticVirtualNetworks", "virtualNetworks", "virtualNetworks"), + resourceids.UserSpecifiedSegment("virtualNetworkName", "virtualNetworkValue"), + } +} + +// String returns a human-readable description of this Virtual Network ID +func (id VirtualNetworkId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Network Name: %q", id.VirtualNetworkName), + } + return fmt.Sprintf("Virtual Network (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_createorupdate.go new file mode 100644 index 000000000000..39163471a54a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualNetwork +} + +// CreateOrUpdate ... +func (c VirtualNetworksClient) CreateOrUpdate(ctx context.Context, id VirtualNetworkId, input VirtualNetwork) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VirtualNetworksClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualNetworkId, input VirtualNetwork) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_delete.go new file mode 100644 index 000000000000..01a9c4496d60 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_delete.go @@ -0,0 +1,98 @@ +package virtualnetworks + +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 +} + +type DeleteOperationOptions struct { + Force *Force +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c VirtualNetworksClient) Delete(ctx context.Context, id VirtualNetworkId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualNetworksClient) DeleteThenPoll(ctx context.Context, id VirtualNetworkId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_get.go new file mode 100644 index 000000000000..479941ebdb3b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_get.go @@ -0,0 +1,51 @@ +package virtualnetworks + +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 *VirtualNetwork +} + +// Get ... +func (c VirtualNetworksClient) Get(ctx context.Context, id VirtualNetworkId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbyresourcegroup.go new file mode 100644 index 000000000000..647bbb68879f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package virtualnetworks + +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 *[]VirtualNetwork +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualNetwork +} + +// ListByResourceGroup ... +func (c VirtualNetworksClient) 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.ScVmm/virtualNetworks", 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 *[]VirtualNetwork `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 VirtualNetworksClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, VirtualNetworkOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualNetworksClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VirtualNetworkOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]VirtualNetwork, 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/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbysubscription.go new file mode 100644 index 000000000000..75c2d23b72fe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbysubscription.go @@ -0,0 +1,92 @@ +package virtualnetworks + +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 *[]VirtualNetwork +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualNetwork +} + +// ListBySubscription ... +func (c VirtualNetworksClient) 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.ScVmm/virtualNetworks", 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 *[]VirtualNetwork `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 VirtualNetworksClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, VirtualNetworkOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualNetworksClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VirtualNetworkOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]VirtualNetwork, 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/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_update.go new file mode 100644 index 000000000000..b5cdbf20bf53 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_update.go @@ -0,0 +1,75 @@ +package virtualnetworks + +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 *VirtualNetwork +} + +// Update ... +func (c VirtualNetworksClient) Update(ctx context.Context, id VirtualNetworkId, input ResourcePatch) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VirtualNetworksClient) UpdateThenPoll(ctx context.Context, id VirtualNetworkId, input ResourcePatch) 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/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_extendedlocation.go new file mode 100644 index 000000000000..a3a28fb038c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_extendedlocation.go @@ -0,0 +1,9 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_resourcepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_resourcepatch.go new file mode 100644 index 000000000000..b8e4e3ef99a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_resourcepatch.go @@ -0,0 +1,8 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourcePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetwork.go new file mode 100644 index 000000000000..9ac2cb963907 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetwork.go @@ -0,0 +1,19 @@ +package virtualnetworks + +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 VirtualNetwork struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties VirtualNetworkProperties `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/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetworkproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetworkproperties.go new file mode 100644 index 000000000000..11c6f71f8ded --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetworkproperties.go @@ -0,0 +1,12 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkProperties struct { + InventoryItemId *string `json:"inventoryItemId,omitempty"` + NetworkName *string `json:"networkName,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` + VMmServerId *string `json:"vmmServerId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/predicates.go new file mode 100644 index 000000000000..34e415f32c22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/predicates.go @@ -0,0 +1,32 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualNetworkOperationPredicate) Matches(input VirtualNetwork) 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/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/version.go new file mode 100644 index 000000000000..da76573b44dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/version.go @@ -0,0 +1,12 @@ +package virtualnetworks + +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-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualnetworks/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/README.md new file mode 100644 index 000000000000..ce9abb2a7036 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/README.md @@ -0,0 +1,87 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents` Documentation + +The `vminstanceguestagents` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents" +``` + + +### Client Initialization + +```go +client := vminstanceguestagents.NewVMInstanceGuestAgentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VMInstanceGuestAgentsClient.Create` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := vminstanceguestagents.GuestAgent{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VMInstanceGuestAgentsClient.Delete` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +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: `VMInstanceGuestAgentsClient.Get` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +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: `VMInstanceGuestAgentsClient.List` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// 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/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/client.go new file mode 100644 index 000000000000..c50f66637063 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/client.go @@ -0,0 +1,26 @@ +package vminstanceguestagents + +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 VMInstanceGuestAgentsClient struct { + Client *resourcemanager.Client +} + +func NewVMInstanceGuestAgentsClientWithBaseURI(sdkApi sdkEnv.Api) (*VMInstanceGuestAgentsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "vminstanceguestagents", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VMInstanceGuestAgentsClient: %+v", err) + } + + return &VMInstanceGuestAgentsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/constants.go new file mode 100644 index 000000000000..03950ff6bc5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/constants.go @@ -0,0 +1,113 @@ +package vminstanceguestagents + +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 ProvisioningAction string + +const ( + ProvisioningActionInstall ProvisioningAction = "install" + ProvisioningActionRepair ProvisioningAction = "repair" + ProvisioningActionUninstall ProvisioningAction = "uninstall" +) + +func PossibleValuesForProvisioningAction() []string { + return []string{ + string(ProvisioningActionInstall), + string(ProvisioningActionRepair), + string(ProvisioningActionUninstall), + } +} + +func (s *ProvisioningAction) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningAction(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningAction(input string) (*ProvisioningAction, error) { + vals := map[string]ProvisioningAction{ + "install": ProvisioningActionInstall, + "repair": ProvisioningActionRepair, + "uninstall": ProvisioningActionUninstall, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningAction(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_create.go new file mode 100644 index 000000000000..12eb42730f97 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_create.go @@ -0,0 +1,76 @@ +package vminstanceguestagents + +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/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 *GuestAgent +} + +// Create ... +func (c VMInstanceGuestAgentsClient) Create(ctx context.Context, id commonids.ScopeId, input GuestAgent) (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/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/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 + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c VMInstanceGuestAgentsClient) CreateThenPoll(ctx context.Context, id commonids.ScopeId, input GuestAgent) 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/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_delete.go new file mode 100644 index 000000000000..a71146bce61b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_delete.go @@ -0,0 +1,49 @@ +package vminstanceguestagents + +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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c VMInstanceGuestAgentsClient) Delete(ctx context.Context, id commonids.ScopeId) (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/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/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/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_get.go new file mode 100644 index 000000000000..d849d2789f69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_get.go @@ -0,0 +1,53 @@ +package vminstanceguestagents + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GuestAgent +} + +// Get ... +func (c VMInstanceGuestAgentsClient) Get(ctx context.Context, id commonids.ScopeId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_list.go new file mode 100644 index 000000000000..4e5b0a4cf530 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_list.go @@ -0,0 +1,92 @@ +package vminstanceguestagents + +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 *[]GuestAgent +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []GuestAgent +} + +// List ... +func (c VMInstanceGuestAgentsClient) List(ctx context.Context, id commonids.ScopeId) (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.ScVmm/virtualMachineInstances/default/guestAgents", 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 *[]GuestAgent `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 VMInstanceGuestAgentsClient) ListComplete(ctx context.Context, id commonids.ScopeId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, GuestAgentOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VMInstanceGuestAgentsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate GuestAgentOperationPredicate) (result ListCompleteResult, err error) { + items := make([]GuestAgent, 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/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagent.go new file mode 100644 index 000000000000..195f7e64aaed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagent.go @@ -0,0 +1,16 @@ +package vminstanceguestagents + +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 GuestAgent struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties GuestAgentProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagentproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagentproperties.go new file mode 100644 index 000000000000..7f01590b94f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagentproperties.go @@ -0,0 +1,14 @@ +package vminstanceguestagents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GuestAgentProperties struct { + Credentials *GuestCredential `json:"credentials,omitempty"` + CustomResourceName *string `json:"customResourceName,omitempty"` + HTTPProxyConfig *HTTPProxyConfiguration `json:"httpProxyConfig,omitempty"` + ProvisioningAction *ProvisioningAction `json:"provisioningAction,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Status *string `json:"status,omitempty"` + Uuid *string `json:"uuid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestcredential.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestcredential.go new file mode 100644 index 000000000000..4d4b3bdfa33a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestcredential.go @@ -0,0 +1,9 @@ +package vminstanceguestagents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GuestCredential struct { + Password string `json:"password"` + Username string `json:"username"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_httpproxyconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_httpproxyconfiguration.go new file mode 100644 index 000000000000..bc2cbf6e7769 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_httpproxyconfiguration.go @@ -0,0 +1,8 @@ +package vminstanceguestagents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HTTPProxyConfiguration struct { + HTTPSProxy *string `json:"httpsProxy,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/predicates.go new file mode 100644 index 000000000000..748083659003 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/predicates.go @@ -0,0 +1,27 @@ +package vminstanceguestagents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GuestAgentOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GuestAgentOperationPredicate) Matches(input GuestAgent) 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/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/version.go new file mode 100644 index 000000000000..1b2f08a3bd16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/version.go @@ -0,0 +1,12 @@ +package vminstanceguestagents + +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-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/vminstanceguestagents/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/README.md new file mode 100644 index 000000000000..a1c2293a99ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/README.md @@ -0,0 +1,54 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata` Documentation + +The `vminstancehybrididentitymetadata` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata" +``` + + +### Client Initialization + +```go +client := vminstancehybrididentitymetadata.NewVMInstanceHybridIdentityMetadataClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VMInstanceHybridIdentityMetadataClient.VirtualMachineInstanceHybridIdentityMetadataGet` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.VirtualMachineInstanceHybridIdentityMetadataGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VMInstanceHybridIdentityMetadataClient.VirtualMachineInstanceHybridIdentityMetadataList` + +```go +ctx := context.TODO() +id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.VirtualMachineInstanceHybridIdentityMetadataList(ctx, id)` can be used to do batched pagination +items, err := client.VirtualMachineInstanceHybridIdentityMetadataListComplete(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/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/client.go new file mode 100644 index 000000000000..605e66135cb9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/client.go @@ -0,0 +1,26 @@ +package vminstancehybrididentitymetadata + +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 VMInstanceHybridIdentityMetadataClient struct { + Client *resourcemanager.Client +} + +func NewVMInstanceHybridIdentityMetadataClientWithBaseURI(sdkApi sdkEnv.Api) (*VMInstanceHybridIdentityMetadataClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "vminstancehybrididentitymetadata", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VMInstanceHybridIdentityMetadataClient: %+v", err) + } + + return &VMInstanceHybridIdentityMetadataClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/constants.go new file mode 100644 index 000000000000..09f22289913c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/constants.go @@ -0,0 +1,69 @@ +package vminstancehybrididentitymetadata + +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 ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadataget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadataget.go new file mode 100644 index 000000000000..d24b0da5259a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadataget.go @@ -0,0 +1,53 @@ +package vminstancehybrididentitymetadata + +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 VirtualMachineInstanceHybridIdentityMetadataGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VMInstanceHybridIdentityMetadata +} + +// VirtualMachineInstanceHybridIdentityMetadataGet ... +func (c VMInstanceHybridIdentityMetadataClient) VirtualMachineInstanceHybridIdentityMetadataGet(ctx context.Context, id commonids.ScopeId) (result VirtualMachineInstanceHybridIdentityMetadataGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadatalist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadatalist.go new file mode 100644 index 000000000000..1722756928c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadatalist.go @@ -0,0 +1,92 @@ +package vminstancehybrididentitymetadata + +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 VirtualMachineInstanceHybridIdentityMetadataListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VMInstanceHybridIdentityMetadata +} + +type VirtualMachineInstanceHybridIdentityMetadataListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VMInstanceHybridIdentityMetadata +} + +// VirtualMachineInstanceHybridIdentityMetadataList ... +func (c VMInstanceHybridIdentityMetadataClient) VirtualMachineInstanceHybridIdentityMetadataList(ctx context.Context, id commonids.ScopeId) (result VirtualMachineInstanceHybridIdentityMetadataListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata", 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 *[]VMInstanceHybridIdentityMetadata `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// VirtualMachineInstanceHybridIdentityMetadataListComplete retrieves all the results into a single object +func (c VMInstanceHybridIdentityMetadataClient) VirtualMachineInstanceHybridIdentityMetadataListComplete(ctx context.Context, id commonids.ScopeId) (VirtualMachineInstanceHybridIdentityMetadataListCompleteResult, error) { + return c.VirtualMachineInstanceHybridIdentityMetadataListCompleteMatchingPredicate(ctx, id, VMInstanceHybridIdentityMetadataOperationPredicate{}) +} + +// VirtualMachineInstanceHybridIdentityMetadataListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VMInstanceHybridIdentityMetadataClient) VirtualMachineInstanceHybridIdentityMetadataListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate VMInstanceHybridIdentityMetadataOperationPredicate) (result VirtualMachineInstanceHybridIdentityMetadataListCompleteResult, err error) { + items := make([]VMInstanceHybridIdentityMetadata, 0) + + resp, err := c.VirtualMachineInstanceHybridIdentityMetadataList(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 = VirtualMachineInstanceHybridIdentityMetadataListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadata.go new file mode 100644 index 000000000000..c84683e12195 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadata.go @@ -0,0 +1,16 @@ +package vminstancehybrididentitymetadata + +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 VMInstanceHybridIdentityMetadata struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties VMInstanceHybridIdentityMetadataProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadataproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadataproperties.go new file mode 100644 index 000000000000..67e5598fff71 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadataproperties.go @@ -0,0 +1,10 @@ +package vminstancehybrididentitymetadata + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMInstanceHybridIdentityMetadataProperties struct { + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicKey *string `json:"publicKey,omitempty"` + ResourceUid *string `json:"resourceUid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/predicates.go new file mode 100644 index 000000000000..2b14e1e41ff7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/predicates.go @@ -0,0 +1,27 @@ +package vminstancehybrididentitymetadata + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMInstanceHybridIdentityMetadataOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VMInstanceHybridIdentityMetadataOperationPredicate) Matches(input VMInstanceHybridIdentityMetadata) 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/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/version.go new file mode 100644 index 000000000000..e7b052b612a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/version.go @@ -0,0 +1,12 @@ +package vminstancehybrididentitymetadata + +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-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/vminstancehybrididentitymetadata/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/README.md new file mode 100644 index 000000000000..e7112823e102 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers` Documentation + +The `vmmservers` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/vmmservers" +``` + + +### Client Initialization + +```go +client := vmmservers.NewVMmServersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VMmServersClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := vmmservers.NewVMmServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue") + +payload := vmmservers.VMMServer{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VMmServersClient.Delete` + +```go +ctx := context.TODO() +id := vmmservers.NewVMmServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue") + +if err := client.DeleteThenPoll(ctx, id, vmmservers.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VMmServersClient.Get` + +```go +ctx := context.TODO() +id := vmmservers.NewVMmServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue") + +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: `VMmServersClient.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: `VMmServersClient.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: `VMmServersClient.Update` + +```go +ctx := context.TODO() +id := vmmservers.NewVMmServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue") + +payload := vmmservers.ResourcePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/client.go new file mode 100644 index 000000000000..ff1fc1061d59 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/client.go @@ -0,0 +1,26 @@ +package vmmservers + +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 VMmServersClient struct { + Client *resourcemanager.Client +} + +func NewVMmServersClientWithBaseURI(sdkApi sdkEnv.Api) (*VMmServersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "vmmservers", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VMmServersClient: %+v", err) + } + + return &VMmServersClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/constants.go new file mode 100644 index 000000000000..6eeaba57dab0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/constants.go @@ -0,0 +1,110 @@ +package vmmservers + +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 Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go new file mode 100644 index 000000000000..473c9715f170 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go @@ -0,0 +1,125 @@ +package vmmservers + +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 = &VMmServerId{} + +// VMmServerId is a struct representing the Resource ID for a V Mm Server +type VMmServerId struct { + SubscriptionId string + ResourceGroupName string + VmmServerName string +} + +// NewVMmServerID returns a new VMmServerId struct +func NewVMmServerID(subscriptionId string, resourceGroupName string, vmmServerName string) VMmServerId { + return VMmServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VmmServerName: vmmServerName, + } +} + +// ParseVMmServerID parses 'input' into a VMmServerId +func ParseVMmServerID(input string) (*VMmServerId, error) { + parser := resourceids.NewParserFromResourceIdType(&VMmServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VMmServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVMmServerIDInsensitively parses 'input' case-insensitively into a VMmServerId +// note: this method should only be used for API response data and not user input +func ParseVMmServerIDInsensitively(input string) (*VMmServerId, error) { + parser := resourceids.NewParserFromResourceIdType(&VMmServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VMmServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VMmServerId) 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.VmmServerName, ok = input.Parsed["vmmServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", input) + } + + return nil +} + +// ValidateVMmServerID checks that 'input' can be parsed as a V Mm Server ID +func ValidateVMmServerID(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 := ParseVMmServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted V Mm Server ID +func (id VMmServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/vmmServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VmmServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this V Mm Server ID +func (id VMmServerId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticVmmServers", "vmmServers", "vmmServers"), + resourceids.UserSpecifiedSegment("vmmServerName", "vmmServerValue"), + } +} + +// String returns a human-readable description of this V Mm Server ID +func (id VMmServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vmm Server Name: %q", id.VmmServerName), + } + return fmt.Sprintf("V Mm Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_createorupdate.go new file mode 100644 index 000000000000..368f7160aef1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_createorupdate.go @@ -0,0 +1,75 @@ +package vmmservers + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VMMServer +} + +// CreateOrUpdate ... +func (c VMmServersClient) CreateOrUpdate(ctx context.Context, id VMmServerId, input VMMServer) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VMmServersClient) CreateOrUpdateThenPoll(ctx context.Context, id VMmServerId, input VMMServer) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_delete.go new file mode 100644 index 000000000000..b68e32b8439b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_delete.go @@ -0,0 +1,98 @@ +package vmmservers + +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 +} + +type DeleteOperationOptions struct { + Force *Force +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o DeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c VMmServersClient) Delete(ctx context.Context, id VMmServerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VMmServersClient) DeleteThenPoll(ctx context.Context, id VMmServerId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + 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/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_get.go new file mode 100644 index 000000000000..a3a67be4c9f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_get.go @@ -0,0 +1,51 @@ +package vmmservers + +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 *VMMServer +} + +// Get ... +func (c VMmServersClient) Get(ctx context.Context, id VMmServerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbyresourcegroup.go new file mode 100644 index 000000000000..52872ee51c05 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package vmmservers + +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 *[]VMMServer +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []VMMServer +} + +// ListByResourceGroup ... +func (c VMmServersClient) 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.ScVmm/vmmServers", 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 *[]VMMServer `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 VMmServersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, VMMServerOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VMmServersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VMMServerOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]VMMServer, 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/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbysubscription.go new file mode 100644 index 000000000000..80e546587584 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbysubscription.go @@ -0,0 +1,92 @@ +package vmmservers + +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 *[]VMMServer +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []VMMServer +} + +// ListBySubscription ... +func (c VMmServersClient) 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.ScVmm/vmmServers", 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 *[]VMMServer `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 VMmServersClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, VMMServerOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VMmServersClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VMMServerOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]VMMServer, 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/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_update.go new file mode 100644 index 000000000000..050732109896 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_update.go @@ -0,0 +1,75 @@ +package vmmservers + +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 *VMMServer +} + +// Update ... +func (c VMmServersClient) Update(ctx context.Context, id VMmServerId, input ResourcePatch) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VMmServersClient) UpdateThenPoll(ctx context.Context, id VMmServerId, input ResourcePatch) 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/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_extendedlocation.go new file mode 100644 index 000000000000..ef8c8a113bce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_extendedlocation.go @@ -0,0 +1,9 @@ +package vmmservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_resourcepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_resourcepatch.go new file mode 100644 index 000000000000..b5b742ed7b12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_resourcepatch.go @@ -0,0 +1,8 @@ +package vmmservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourcePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmcredential.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmcredential.go new file mode 100644 index 000000000000..139ef67e0e2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmcredential.go @@ -0,0 +1,9 @@ +package vmmservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMMCredential struct { + Password *string `json:"password,omitempty"` + Username *string `json:"username,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserver.go new file mode 100644 index 000000000000..bb0e9a9b3394 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserver.go @@ -0,0 +1,19 @@ +package vmmservers + +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 VMMServer struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties VMMServerProperties `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/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserverproperties.go new file mode 100644 index 000000000000..6532dae951fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserverproperties.go @@ -0,0 +1,15 @@ +package vmmservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMMServerProperties struct { + ConnectionStatus *string `json:"connectionStatus,omitempty"` + Credentials *VMMCredential `json:"credentials,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + Fqdn string `json:"fqdn"` + Port *int64 `json:"port,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/predicates.go new file mode 100644 index 000000000000..c2a867ae8f50 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/predicates.go @@ -0,0 +1,32 @@ +package vmmservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMMServerOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VMMServerOperationPredicate) Matches(input VMMServer) 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/systemcentervirtualmachinemanager/2023-10-07/vmmservers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/version.go new file mode 100644 index 000000000000..42b3cbefc9f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/version.go @@ -0,0 +1,12 @@ +package vmmservers + +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-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/vmmservers/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 10ed524f2415..95277c1bbfe8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -501,6 +501,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespace github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces +github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26 github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers @@ -1019,6 +1020,16 @@ github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/tr github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/streamingjobs github.com/hashicorp/go-azure-sdk/resource-manager/subscription/2021-10-01/subscriptions +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07 +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers github.com/hashicorp/go-azure-sdk/resource-manager/timeseriesinsights/2020-05-15 github.com/hashicorp/go-azure-sdk/resource-manager/timeseriesinsights/2020-05-15/accesspolicies github.com/hashicorp/go-azure-sdk/resource-manager/timeseriesinsights/2020-05-15/environments diff --git a/website/allowed-subcategories b/website/allowed-subcategories index 74844bf99733..03ff6eb30c30 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -104,6 +104,7 @@ Storage Storage Mover Stream Analytics Synapse +System Center Virtual Machine Manager Template Time Series Insights VMware (AVS) diff --git a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown new file mode 100644 index 000000000000..c07d71c5f36e --- /dev/null +++ b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown @@ -0,0 +1,82 @@ +--- +subcategory: "System Center Virtual Machine Manager" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_system_center_virtual_machine_manager_server" +description: |- + Manages a System Center Virtual Machine Manager Server. +--- + +# azurerm_system_center_virtual_machine_manager_server + +Manages a System Center Virtual Machine Manager Server. + +~> **Note:** By request of the service team the provider no longer automatically registering the `Microsoft.ScVmm` Resource Provider for this resource. To register it you can run `az provider register --namespace Microsoft.ScVmm`. + +-> **Note:** This resource depends on an existing `System Center Virtual Machine Manager Host Machine`, `Arc Resource Bridge` and `Custom Location`. Installing and configuring these dependencies is outside the scope of this document. See [Virtual Machine Manager documentation](https://learn.microsoft.com/en-us/system-center/vmm/?view=sc-vmm-2022) and [Install VMM](https://learn.microsoft.com/en-us/system-center/vmm/install?view=sc-vmm-2022) for more details of `System Center Virtual Machine Manager Host Machine`. See [What is Azure Arc resource bridge](https://learn.microsoft.com/en-us/azure/azure-arc/resource-bridge/overview) and [Overview of Arc-enabled System Center Virtual Machine Manager](https://learn.microsoft.com/en-us/azure/azure-arc/system-center-virtual-machine-manager/overview) for more details of `Arc Resource Bridge/Appliance`. See [Create and manage custom locations on Azure Arc-enabled Kubernetes](https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/custom-locations) for more details of `Custom Location`. If you encounter issues while configuring, we'd recommend opening a ticket with Microsoft Support. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_system_center_virtual_machine_manager_server" "example" { + name = "example-scvmmms" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + custom_location_id = "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1" + fqdn = "example.labtest" + + credential { + username = "testUser" + password = "H@Sh1CoR3!" + } +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the Resource Group where the System Center Virtual Machine Manager should exist. Changing this forces a new resource to be created. + +* `location` - (Required) The Azure Region where the System Center Virtual Machine Manager Server should exist. Changing this forces a new resource to be created. + +* `custom_location_id` - (Required) The ID of the Custom Location for the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. + +* `fqdn` - (Required) The FQDN of the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. + +* `username` - (Required) The username that is used to connect to the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. + +* `password` - (Required) The password that is used to connect to the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. + +* `port` - (Optional) The port on which the System Center Virtual Machine Manager Server is listening. Possible values are between `1` and `65535`. Changing this forces a new resource to be created. + +* `tags` - (Optional) A mapping of tags which should be assigned to the System Center Virtual Machine Manager Server. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the System Center Virtual Machine Manager Server. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating this System Center Virtual Machine Manager Server. +* `read` - (Defaults to 5 minutes) Used when retrieving this System Center Virtual Machine Manager Server. +* `update` - (Defaults to 30 minutes) Used when updating this System Center Virtual Machine Manager Server. +* `delete` - (Defaults to 30 minutes) Used when deleting this System Center Virtual Machine Manager Server. + +## Import + +System Center Virtual Machine Manager Servers can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_system_center_virtual_machine_manager_server.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.ScVmm/vmmServers/vmmServer1 +```