diff --git a/internal/services/domainservices/active_directory_domain_service_data_source.go b/internal/services/domainservices/active_directory_domain_service_data_source.go index 0785b42199ab..b4f5164102bd 100644 --- a/internal/services/domainservices/active_directory_domain_service_data_source.go +++ b/internal/services/domainservices/active_directory_domain_service_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceActiveDirectoryDomainService() *pluginsdk.Resource { @@ -167,7 +167,7 @@ func dataSourceActiveDirectoryDomainService() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.Tags(), "tenant_id": { Type: pluginsdk.TypeString, @@ -220,32 +220,43 @@ func dataSourceActiveDirectoryDomainServiceReplicaSetSchema() map[string]*plugin func dataSourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).DomainServices.DomainServicesClient + subscrptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) - resp, err := client.Get(ctx, resourceGroup, name) + idsdk := domainservices.NewDomainServiceID(subscrptionId, resourceGroup, name) + + resp, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return nil } return err } - if resp.ID == nil { + model := resp.Model + if model == nil { + return fmt.Errorf("reading Domain Service: model was returned nil") + } + + if model.Id == nil { return fmt.Errorf("reading Domain Service: ID was returned nil") } - d.SetId(*resp.ID) + + d.SetId(idsdk.ID()) d.Set("name", name) d.Set("resource_group_name", resourceGroup) + d.Set("location", location.NormalizeNilable(model.Location)) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } - d.Set("location", location.NormalizeNilable(resp.Location)) - - if props := resp.DomainServiceProperties; props != nil { - d.Set("deployment_id", props.DeploymentID) + if props := model.Properties; props != nil { + d.Set("deployment_id", props.DeploymentId) domainConfigType := "" if v := props.DomainConfigurationType; v != nil { @@ -256,14 +267,14 @@ func dataSourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta d.Set("domain_name", props.DomainName) d.Set("filtered_sync_enabled", false) - if props.FilteredSync == aad.FilteredSyncEnabled { + if props.FilteredSync != nil && *props.FilteredSync == domainservices.FilteredSyncEnabled { d.Set("filtered_sync_enabled", true) } - d.Set("resource_id", resp.ID) + d.Set("resource_id", model.Id) d.Set("sku", props.Sku) d.Set("sync_owner", props.SyncOwner) - d.Set("tenant_id", props.TenantID) + d.Set("tenant_id", props.TenantId) d.Set("version", props.Version) if err := d.Set("notifications", flattenDomainServiceNotifications(props.NotificationSettings)); err != nil { @@ -284,5 +295,5 @@ func dataSourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/internal/services/domainservices/active_directory_domain_service_replica_set_resource.go b/internal/services/domainservices/active_directory_domain_service_replica_set_resource.go index 9059a63e5fbe..2808b3b63e7d 100644 --- a/internal/services/domainservices/active_directory_domain_service_replica_set_resource.go +++ b/internal/services/domainservices/active_directory_domain_service_replica_set_resource.go @@ -5,8 +5,9 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -88,82 +89,90 @@ func resourceActiveDirectoryDomainServiceReplicaSetCreate(d *pluginsdk.ResourceD return fmt.Errorf("parsing ID for Domain Service Replica Set") } + idsdk := domainservices.NewDomainServiceID(domainServiceId.SubscriptionId, domainServiceId.ResourceGroup, domainServiceId.Name) + locks.ByName(domainServiceId.Name, DomainServiceResourceName) defer locks.UnlockByName(domainServiceId.Name, DomainServiceResourceName) - domainService, err := client.Get(ctx, domainServiceId.ResourceGroup, domainServiceId.Name) + domainService, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(domainService.Response) { + if response.WasNotFound(domainService.HttpResponse) { return fmt.Errorf("could not find %s: %s", domainServiceId, err) } return fmt.Errorf("reading %s: %s", domainServiceId, err) } - if domainService.DomainServiceProperties.ReplicaSets == nil || len(*domainService.DomainServiceProperties.ReplicaSets) == 0 { - return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set: %s", domainServiceId, err) + model := domainService.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", domainServiceId) + } + + if model.Properties == nil || model.Properties.ReplicaSets == nil || len(*model.Properties.ReplicaSets) == 0 { + return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set", domainServiceId) } subnetId := d.Get("subnet_id").(string) - replicaSets := *domainService.DomainServiceProperties.ReplicaSets + replicaSets := *model.Properties.ReplicaSets for _, r := range replicaSets { - if r.ReplicaSetID == nil { + if r.ReplicaSetId == nil { return fmt.Errorf("reading %s: a replica set was returned with a missing ReplicaSetID", domainServiceId) } - if r.SubnetID == nil { + if r.SubnetId == nil { return fmt.Errorf("reading %s: a replica set was returned with a missing SubnetID", domainServiceId) } // We assume that two replica sets cannot coexist in the same subnet - if strings.EqualFold(subnetId, *r.SubnetID) { + if strings.EqualFold(subnetId, *r.SubnetId) { // Generate an ID here since we only know it once we know the ReplicaSetID - id := parse.NewDomainServiceReplicaSetID(domainServiceId.SubscriptionId, domainServiceId.ResourceGroup, domainServiceId.Name, *r.ReplicaSetID) + id := parse.NewDomainServiceReplicaSetID(domainServiceId.SubscriptionId, domainServiceId.ResourceGroup, domainServiceId.Name, *r.ReplicaSetId) return tf.ImportAsExistsError("azurerm_active_directory_domain_service_replica_set", id.ID()) } } loc := location.Normalize(d.Get("location").(string)) - replicaSets = append(replicaSets, aad.ReplicaSet{ + replicaSets = append(replicaSets, domainservices.ReplicaSet{ Location: utils.String(loc), - SubnetID: utils.String(subnetId), + SubnetId: utils.String(subnetId), }) - domainService.DomainServiceProperties.ReplicaSets = &replicaSets + model.Properties.ReplicaSets = &replicaSets - future, err := client.CreateOrUpdate(ctx, domainServiceId.ResourceGroup, domainServiceId.Name, domainService) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, idsdk, *model); err != nil { return fmt.Errorf("creating/updating Replica Sets for %s: %+v", domainServiceId, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for Replica Sets for %s: %+v", domainServiceId, err) - } // We need to retrieve the domain service again to find out the new replica set ID - domainService, err = client.Get(ctx, domainServiceId.ResourceGroup, domainServiceId.Name) + domainService, err = client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(domainService.Response) { + if response.WasNotFound(domainService.HttpResponse) { return fmt.Errorf("could not find %s: %s", domainServiceId, err) } return fmt.Errorf("reading %s: %s", domainServiceId, err) } - if domainService.DomainServiceProperties.ReplicaSets == nil || len(*domainService.DomainServiceProperties.ReplicaSets) == 0 { - return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set: %s", domainServiceId, err) + model = domainService.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", domainServiceId) + } + + if model.Properties == nil || model.Properties.ReplicaSets == nil || len(*model.Properties.ReplicaSets) == 0 { + return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set", domainServiceId) } var id parse.DomainServiceReplicaSetId // Assuming that two replica sets cannot coexist in the same subnet, we identify our new replica set by its SubnetID - for _, r := range *domainService.DomainServiceProperties.ReplicaSets { - if r.ReplicaSetID == nil { + for _, r := range *model.Properties.ReplicaSets { + if r.ReplicaSetId == nil { return fmt.Errorf("reading %s: a replica set was returned with a missing ReplicaSetID", domainServiceId) } - if r.SubnetID == nil { + if r.SubnetId == nil { return fmt.Errorf("reading %s: a replica set was returned with a missing SubnetID", domainServiceId) } - if strings.EqualFold(subnetId, *r.SubnetID) { + if strings.EqualFold(subnetId, *r.SubnetId) { // We found it! - id = parse.NewDomainServiceReplicaSetID(domainServiceId.SubscriptionId, domainServiceId.ResourceGroup, domainServiceId.Name, *r.ReplicaSetID) + id = parse.NewDomainServiceReplicaSetID(domainServiceId.SubscriptionId, domainServiceId.ResourceGroup, domainServiceId.Name, *r.ReplicaSetId) } } @@ -201,17 +210,24 @@ func resourceActiveDirectoryDomainServiceReplicaSetRead(d *pluginsdk.ResourceDat return err } - domainService, err := client.Get(ctx, id.ResourceGroup, id.DomainServiceName) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) + + domainService, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(domainService.Response) { + if response.WasNotFound(domainService.HttpResponse) { d.SetId("") return nil } return err } - if domainService.DomainServiceProperties.ReplicaSets == nil || len(*domainService.DomainServiceProperties.ReplicaSets) == 0 { - return fmt.Errorf("reading %s: domain service returned with missing replica set information, expected at least 1 replica set: %s", id, err) + model := domainService.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", id) + } + + if model.Properties == nil || model.Properties.ReplicaSets == nil || len(*model.Properties.ReplicaSets) == 0 { + return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set", id) } var ( @@ -222,20 +238,20 @@ func resourceActiveDirectoryDomainServiceReplicaSetRead(d *pluginsdk.ResourceDat subnetId string ) - replicaSets := *domainService.DomainServiceProperties.ReplicaSets + replicaSets := *model.Properties.ReplicaSets for _, r := range replicaSets { - if r.ReplicaSetID == nil { + if r.ReplicaSetId == nil { return fmt.Errorf("reading %s: a replica set was returned with a missing ReplicaSetID", id) } // ReplicaSetName in the ID struct is really the replica set ID - if *r.ReplicaSetID == id.ReplicaSetName { - if r.DomainControllerIPAddress != nil { - domainControllerIpAddresses = *r.DomainControllerIPAddress + if *r.ReplicaSetId == id.ReplicaSetName { + if r.DomainControllerIpAddress != nil { + domainControllerIpAddresses = *r.DomainControllerIpAddress } - if r.ExternalAccessIPAddress != nil { - externalAccessIpAddress = *r.ExternalAccessIPAddress + if r.ExternalAccessIpAddress != nil { + externalAccessIpAddress = *r.ExternalAccessIpAddress } if r.Location != nil { loc = location.NormalizeNilable(r.Location) @@ -243,8 +259,8 @@ func resourceActiveDirectoryDomainServiceReplicaSetRead(d *pluginsdk.ResourceDat if r.ServiceStatus != nil { serviceStatus = *r.ServiceStatus } - if r.SubnetID != nil { - subnetId = *r.SubnetID + if r.SubnetId != nil { + subnetId = *r.SubnetId } } } @@ -268,27 +284,34 @@ func resourceActiveDirectoryDomainServiceReplicaSetDelete(d *pluginsdk.ResourceD return err } - domainService, err := client.Get(ctx, id.ResourceGroup, id.DomainServiceName) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) + + domainService, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(domainService.Response) { + if response.WasNotFound(domainService.HttpResponse) { return fmt.Errorf("deleting %s: domain service was not found: %s", id, err) } return err } - if domainService.DomainServiceProperties.ReplicaSets == nil || len(*domainService.DomainServiceProperties.ReplicaSets) == 0 { - return fmt.Errorf("deleting %s: domain service returned with missing replica set information, expected at least 1 replica set: %s", id, err) + model := domainService.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", id) } - replicaSets := *domainService.DomainServiceProperties.ReplicaSets + if model.Properties == nil || model.Properties.ReplicaSets == nil || len(*model.Properties.ReplicaSets) == 0 { + return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set", id) + } - newReplicaSets := make([]aad.ReplicaSet, 0) + replicaSets := *model.Properties.ReplicaSets + + newReplicaSets := make([]domainservices.ReplicaSet, 0) for _, r := range replicaSets { - if r.ReplicaSetID == nil { + if r.ReplicaSetId == nil { return fmt.Errorf("deleting %s: a replica set was returned with a missing ReplicaSetID", id) } - if *r.ReplicaSetID == id.ReplicaSetName { + if *r.ReplicaSetId == id.ReplicaSetName { continue } @@ -299,15 +322,11 @@ func resourceActiveDirectoryDomainServiceReplicaSetDelete(d *pluginsdk.ResourceD return fmt.Errorf("deleting %s: could not determine which replica set to remove", id) } - domainService.DomainServiceProperties.ReplicaSets = &newReplicaSets + model.Properties.ReplicaSets = &newReplicaSets - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.DomainServiceName, domainService) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, idsdk, *model); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } // Wait for all replica sets to become available with two domain controllers each before proceeding // Generate a partial DomainServiceId since we don't need to know the initial replica set ID here diff --git a/internal/services/domainservices/active_directory_domain_service_resource.go b/internal/services/domainservices/active_directory_domain_service_resource.go index 102a41f641b1..88a9029b62d7 100644 --- a/internal/services/domainservices/active_directory_domain_service_resource.go +++ b/internal/services/domainservices/active_directory_domain_service_resource.go @@ -7,18 +7,17 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" "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/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/parse" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -54,9 +53,9 @@ func resourceActiveDirectoryDomainService() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, // TODO: proper validation }, - "location": azure.SchemaLocation(), + "location": commonschema.Location(), - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "domain_name": { Type: pluginsdk.TypeString, @@ -254,7 +253,7 @@ func resourceActiveDirectoryDomainService() *pluginsdk.Resource { }, false), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "deployment_id": { Type: pluginsdk.TypeString, @@ -286,6 +285,7 @@ func resourceActiveDirectoryDomainService() *pluginsdk.Resource { func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).DomainServices.DomainServicesClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -300,18 +300,24 @@ func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, // know the ID of the first replica set. var id *parse.DomainServiceId + idsdk := domainservices.NewDomainServiceID(subscriptionId, resourceGroup, name) + if d.IsNewResource() { - existing, err := client.Get(ctx, resourceGroup, name) + existing, err := client.Get(ctx, idsdk) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", resourceErrorName, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { // Parse the replica sets and assume the first one returned to be the initial replica set // This is a best effort and the user can choose any replica set if they structure their config accordingly - props := existing.DomainServiceProperties + model := existing.Model + if model == nil { + return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing model", resourceErrorName) + } + props := model.Properties if props == nil { return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing properties", resourceErrorName) } @@ -320,7 +326,7 @@ func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing replica set details", resourceErrorName) } initialReplicaSetId := replicaSets[0].(map[string]interface{})["id"].(string) - id := parse.NewDomainServiceID(client.SubscriptionID, resourceGroup, name, initialReplicaSetId) + id := parse.NewDomainServiceID(subscriptionId, resourceGroup, name, initialReplicaSetId) return tf.ImportAsExistsError(DomainServiceResourceName, id.ID()) } @@ -336,16 +342,16 @@ func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, } loc := location.Normalize(d.Get("location").(string)) - filteredSync := aad.FilteredSyncDisabled + filteredSync := domainservices.FilteredSyncDisabled if d.Get("filtered_sync_enabled").(bool) { - filteredSync = aad.FilteredSyncDisabled + filteredSync = domainservices.FilteredSyncDisabled } - domainService := aad.DomainService{ - DomainServiceProperties: &aad.DomainServiceProperties{ + domainService := domainservices.DomainService{ + Properties: &domainservices.DomainServiceProperties{ DomainName: utils.String(d.Get("domain_name").(string)), DomainSecuritySettings: expandDomainServiceSecurity(d.Get("security").([]interface{})), - FilteredSync: filteredSync, + FilteredSync: &filteredSync, LdapsSettings: expandDomainServiceLdaps(d.Get("secure_ldap").([]interface{})), NotificationSettings: expandDomainServiceNotifications(d.Get("notifications").([]interface{})), Sku: utils.String(d.Get("sku").(string)), @@ -355,36 +361,36 @@ func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, } if v := d.Get("domain_configuration_type").(string); v != "" { - domainService.DomainServiceProperties.DomainConfigurationType = &v + domainService.Properties.DomainConfigurationType = &v } if d.IsNewResource() { // On resource creation, specify the initial replica set. // No provision is made for changing the initial replica set, it should remain intact for the resource to function properly - replicaSets := []aad.ReplicaSet{ + replicaSets := []domainservices.ReplicaSet{ { Location: utils.String(loc), - SubnetID: utils.String(d.Get("initial_replica_set.0.subnet_id").(string)), + SubnetId: utils.String(d.Get("initial_replica_set.0.subnet_id").(string)), }, } - domainService.DomainServiceProperties.ReplicaSets = &replicaSets + domainService.Properties.ReplicaSets = &replicaSets } - future, err := client.CreateOrUpdate(ctx, resourceGroup, name, domainService) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, idsdk, domainService); err != nil { return fmt.Errorf("creating/updating %s: %+v", resourceErrorName, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for %s: %+v", resourceErrorName, err) - } // Retrieve the domain service to discover the unique ID for the initial replica set, which should not subsequently change if d.IsNewResource() { - resp, err := client.Get(ctx, resourceGroup, name) + resp, err := client.Get(ctx, idsdk) if err != nil { return fmt.Errorf("retrieving %s after creating: %+v", resourceErrorName, err) } - props := resp.DomainServiceProperties + model := resp.Model + if model == nil { + return fmt.Errorf("%s returned with no model", resourceErrorName) + } + props := model.Properties if props == nil { return fmt.Errorf("%s returned with no properties", resourceErrorName) } @@ -399,7 +405,7 @@ func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, // Once we know the initial replica set ID, we can build a resource ID initialReplicaSetId := replicaSets[0].(map[string]interface{})["id"].(string) - newId := parse.NewDomainServiceID(client.SubscriptionID, resourceGroup, name, initialReplicaSetId) + newId := parse.NewDomainServiceID(subscriptionId, resourceGroup, name, initialReplicaSetId) id = &newId d.SetId(id.ID()) @@ -441,9 +447,11 @@ func resourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta in return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.Name) + + resp, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -452,59 +460,64 @@ func resourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta in d.Set("name", id.Name) d.Set("resource_group_name", id.ResourceGroup) - d.Set("resource_id", resp.ID) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + d.Set("resource_id", model.Id) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } - if props := resp.DomainServiceProperties; props != nil { - d.Set("deployment_id", props.DeploymentID) - d.Set("domain_name", props.DomainName) - d.Set("sync_owner", props.SyncOwner) - d.Set("tenant_id", props.TenantID) - d.Set("version", props.Version) - d.Set("domain_configuration_type", props.DomainConfigurationType) + if props := model.Properties; props != nil { + d.Set("deployment_id", props.DeploymentId) + d.Set("domain_name", props.DomainName) + d.Set("sync_owner", props.SyncOwner) + d.Set("tenant_id", props.TenantId) + d.Set("version", props.Version) + d.Set("domain_configuration_type", props.DomainConfigurationType) - d.Set("filtered_sync_enabled", false) - if props.FilteredSync == aad.FilteredSyncEnabled { - d.Set("filtered_sync_enabled", true) - } + d.Set("filtered_sync_enabled", false) + if props.FilteredSync != nil && *props.FilteredSync == domainservices.FilteredSyncEnabled { + d.Set("filtered_sync_enabled", true) + } - d.Set("sku", props.Sku) + d.Set("sku", props.Sku) - if err := d.Set("notifications", flattenDomainServiceNotifications(props.NotificationSettings)); err != nil { - return fmt.Errorf("setting `notifications`: %+v", err) - } + if err := d.Set("notifications", flattenDomainServiceNotifications(props.NotificationSettings)); err != nil { + return fmt.Errorf("setting `notifications`: %+v", err) + } - var initialReplicaSet interface{} - replicaSets := flattenDomainServiceReplicaSets(props.ReplicaSets) + var initialReplicaSet interface{} + replicaSets := flattenDomainServiceReplicaSets(props.ReplicaSets) - // Determine the initial replica set. This is why we need to include InitialReplicaSetId in the resource ID, - // without it we would not be able to reliably support importing. - for _, replicaSetRaw := range replicaSets { - replicaSet := replicaSetRaw.(map[string]interface{}) - if replicaSet["id"].(string) == id.InitialReplicaSetIdName { - initialReplicaSet = replicaSetRaw - break + // Determine the initial replica set. This is why we need to include InitialReplicaSetId in the resource ID, + // without it we would not be able to reliably support importing. + for _, replicaSetRaw := range replicaSets { + replicaSet := replicaSetRaw.(map[string]interface{}) + if replicaSet["id"].(string) == id.InitialReplicaSetIdName { + initialReplicaSet = replicaSetRaw + break + } + } + if initialReplicaSet == nil { + // It's safest to error out here, since we don't want to wipe the initial replica set from state if it was deleted manually + return fmt.Errorf("reading %s: could not determine initial replica set from API response", id) + } + if err := d.Set("initial_replica_set", []interface{}{initialReplicaSet}); err != nil { + return fmt.Errorf("setting `initial_replica_set`: %+v", err) } - } - if initialReplicaSet == nil { - // It's safest to error out here, since we don't want to wipe the initial replica set from state if it was deleted manually - return fmt.Errorf("reading %s: could not determine initial replica set from API response", id) - } - if err := d.Set("initial_replica_set", []interface{}{initialReplicaSet}); err != nil { - return fmt.Errorf("setting `initial_replica_set`: %+v", err) - } - if err := d.Set("secure_ldap", flattenDomainServiceLdaps(d, props.LdapsSettings, false)); err != nil { - return fmt.Errorf("setting `secure_ldap`: %+v", err) - } + if err := d.Set("secure_ldap", flattenDomainServiceLdaps(d, props.LdapsSettings, false)); err != nil { + return fmt.Errorf("setting `secure_ldap`: %+v", err) + } - if err := d.Set("security", flattenDomainServiceSecurity(props.DomainSecuritySettings)); err != nil { - return fmt.Errorf("setting `security`: %+v", err) + if err := d.Set("security", flattenDomainServiceSecurity(props.DomainSecuritySettings)); err != nil { + return fmt.Errorf("setting `security`: %+v", err) + } } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceActiveDirectoryDomainServiceDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -517,32 +530,28 @@ func resourceActiveDirectoryDomainServiceDelete(d *pluginsdk.ResourceData, meta return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("deleting %s: %+v", id, err) - } + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.Name) - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } + if err := client.DeleteThenPoll(ctx, idsdk); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func domainServiceControllerRefreshFunc(ctx context.Context, client *aad.DomainServicesClient, id parse.DomainServiceId, deleting bool) pluginsdk.StateRefreshFunc { +func domainServiceControllerRefreshFunc(ctx context.Context, client *domainservices.DomainServicesClient, id parse.DomainServiceId, deleting bool) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { log.Printf("[DEBUG] Waiting for domain controllers to deploy...") - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, idsdk) if err != nil { return nil, "error", err } - if resp.DomainServiceProperties == nil || resp.DomainServiceProperties.ReplicaSets == nil || len(*resp.DomainServiceProperties.ReplicaSets) == 0 { + if model := resp.Model; model == nil || model.Properties == nil || model.Properties.ReplicaSets == nil || len(*model.Properties.ReplicaSets) == 0 { return nil, "error", fmt.Errorf("API error: `replicaSets` was not returned") } // Loop through all replica sets and ensure they are running and each have two available domain controllers - for _, repl := range *resp.DomainServiceProperties.ReplicaSets { + for _, repl := range *resp.Model.Properties.ReplicaSets { if repl.ServiceStatus == nil { return resp, "pending", nil } @@ -556,7 +565,7 @@ func domainServiceControllerRefreshFunc(ctx context.Context, client *aad.DomainS case !strings.EqualFold(*repl.ServiceStatus, "Running"): // If it's not yet running, it isn't ready return resp, "pending", nil - case repl.DomainControllerIPAddress == nil || len(*repl.DomainControllerIPAddress) < 2: + case repl.DomainControllerIpAddress == nil || len(*repl.DomainControllerIpAddress) < 2: // When a domain controller is online, its IP address will be returned. We're looking for 2 active domain controllers. return resp, "pending", nil } @@ -565,29 +574,30 @@ func domainServiceControllerRefreshFunc(ctx context.Context, client *aad.DomainS } } -func expandDomainServiceLdaps(input []interface{}) (ldaps *aad.LdapsSettings) { - ldaps = &aad.LdapsSettings{ - Ldaps: aad.LdapsDisabled, +func expandDomainServiceLdaps(input []interface{}) (ldaps *domainservices.LdapsSettings) { + state := domainservices.LdapsDisabled + ldaps = &domainservices.LdapsSettings{ + Ldaps: &state, } if len(input) > 0 { v := input[0].(map[string]interface{}) if v["enabled"].(bool) { - ldaps.Ldaps = aad.LdapsEnabled + *ldaps.Ldaps = domainservices.LdapsEnabled } ldaps.PfxCertificate = utils.String(v["pfx_certificate"].(string)) ldaps.PfxCertificatePassword = utils.String(v["pfx_certificate_password"].(string)) + access := domainservices.ExternalAccessDisabled if v["external_access_enabled"].(bool) { - ldaps.ExternalAccess = aad.Enabled - } else { - ldaps.ExternalAccess = aad.Disabled + access = domainservices.ExternalAccessEnabled } + ldaps.ExternalAccess = &access } return } -func expandDomainServiceNotifications(input []interface{}) *aad.NotificationSettings { +func expandDomainServiceNotifications(input []interface{}) *domainservices.NotificationSettings { if len(input) == 0 { return nil } @@ -601,61 +611,61 @@ func expandDomainServiceNotifications(input []interface{}) *aad.NotificationSett } } - notifyDcAdmins := aad.NotifyDcAdminsDisabled + notifyDcAdmins := domainservices.NotifyDcAdminsDisabled if n, ok := v["notify_dc_admins"]; ok && n.(bool) { - notifyDcAdmins = aad.NotifyDcAdminsEnabled + notifyDcAdmins = domainservices.NotifyDcAdminsEnabled } - notifyGlobalAdmins := aad.NotifyGlobalAdminsDisabled + notifyGlobalAdmins := domainservices.NotifyGlobalAdminsDisabled if n, ok := v["notify_global_admins"]; ok && n.(bool) { - notifyGlobalAdmins = aad.NotifyGlobalAdminsEnabled + notifyGlobalAdmins = domainservices.NotifyGlobalAdminsEnabled } - return &aad.NotificationSettings{ + return &domainservices.NotificationSettings{ AdditionalRecipients: &additionalRecipients, - NotifyDcAdmins: notifyDcAdmins, - NotifyGlobalAdmins: notifyGlobalAdmins, + NotifyDcAdmins: ¬ifyDcAdmins, + NotifyGlobalAdmins: ¬ifyGlobalAdmins, } } -func expandDomainServiceSecurity(input []interface{}) *aad.DomainSecuritySettings { +func expandDomainServiceSecurity(input []interface{}) *domainservices.DomainSecuritySettings { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - ntlmV1 := aad.NtlmV1Disabled - syncKerberosPasswords := aad.SyncKerberosPasswordsDisabled - syncNtlmPasswords := aad.SyncNtlmPasswordsDisabled - syncOnPremPasswords := aad.SyncOnPremPasswordsDisabled - tlsV1 := aad.TLSV1Disabled + ntlmV1 := domainservices.NtlmV1Disabled + syncKerberosPasswords := domainservices.SyncKerberosPasswordsDisabled + syncNtlmPasswords := domainservices.SyncNtlmPasswordsDisabled + syncOnPremPasswords := domainservices.SyncOnPremPasswordsDisabled + tlsV1 := domainservices.TlsV1Disabled if v["ntlm_v1_enabled"].(bool) { - ntlmV1 = aad.NtlmV1Enabled + ntlmV1 = domainservices.NtlmV1Enabled } if v["sync_kerberos_passwords"].(bool) { - syncKerberosPasswords = aad.SyncKerberosPasswordsEnabled + syncKerberosPasswords = domainservices.SyncKerberosPasswordsEnabled } if v["sync_ntlm_passwords"].(bool) { - syncNtlmPasswords = aad.SyncNtlmPasswordsEnabled + syncNtlmPasswords = domainservices.SyncNtlmPasswordsEnabled } if v["sync_on_prem_passwords"].(bool) { - syncOnPremPasswords = aad.SyncOnPremPasswordsEnabled + syncOnPremPasswords = domainservices.SyncOnPremPasswordsEnabled } if v["tls_v1_enabled"].(bool) { - tlsV1 = aad.TLSV1Enabled + tlsV1 = domainservices.TlsV1Enabled } - return &aad.DomainSecuritySettings{ - NtlmV1: ntlmV1, - SyncKerberosPasswords: syncKerberosPasswords, - SyncNtlmPasswords: syncNtlmPasswords, - SyncOnPremPasswords: syncOnPremPasswords, - TLSV1: tlsV1, + return &domainservices.DomainSecuritySettings{ + NtlmV1: &ntlmV1, + SyncKerberosPasswords: &syncKerberosPasswords, + SyncNtlmPasswords: &syncNtlmPasswords, + SyncOnPremPasswords: &syncOnPremPasswords, + TlsV1: &tlsV1, } } -func flattenDomainServiceLdaps(d *pluginsdk.ResourceData, input *aad.LdapsSettings, dataSource bool) []interface{} { +func flattenDomainServiceLdaps(d *pluginsdk.ResourceData, input *domainservices.LdapsSettings, dataSource bool) []interface{} { result := map[string]interface{}{ "enabled": false, "external_access_enabled": false, @@ -677,14 +687,14 @@ func flattenDomainServiceLdaps(d *pluginsdk.ResourceData, input *aad.LdapsSettin } if input != nil { - if input.ExternalAccess == aad.Enabled { + if input.ExternalAccess != nil && *input.ExternalAccess == domainservices.ExternalAccessEnabled { result["external_access_enabled"] = true } - if input.Ldaps == aad.LdapsEnabled { + if input.Ldaps != nil && *input.Ldaps == domainservices.LdapsEnabled { result["enabled"] = true } if v := input.CertificateNotAfter; v != nil { - result["certificate_expiry"] = v.Format(time.RFC3339) + result["certificate_expiry"] = *v } if v := input.CertificateThumbprint; v != nil { result["certificate_thumbprint"] = *v @@ -697,7 +707,7 @@ func flattenDomainServiceLdaps(d *pluginsdk.ResourceData, input *aad.LdapsSettin return []interface{}{result} } -func flattenDomainServiceNotifications(input *aad.NotificationSettings) []interface{} { +func flattenDomainServiceNotifications(input *domainservices.NotificationSettings) []interface{} { if input == nil { return make([]interface{}, 0) } @@ -710,17 +720,17 @@ func flattenDomainServiceNotifications(input *aad.NotificationSettings) []interf if input.AdditionalRecipients != nil { result["additional_recipients"] = *input.AdditionalRecipients } - if input.NotifyDcAdmins == aad.NotifyDcAdminsEnabled { + if input.NotifyDcAdmins != nil && *input.NotifyDcAdmins == domainservices.NotifyDcAdminsEnabled { result["notify_dc_admins"] = true } - if input.NotifyGlobalAdmins == aad.NotifyGlobalAdminsEnabled { + if input.NotifyGlobalAdmins != nil && *input.NotifyGlobalAdmins == domainservices.NotifyGlobalAdminsEnabled { result["notify_global_admins"] = true } return []interface{}{result} } -func flattenDomainServiceReplicaSets(input *[]aad.ReplicaSet) (ret []interface{}) { +func flattenDomainServiceReplicaSets(input *[]domainservices.ReplicaSet) (ret []interface{}) { if input == nil { return } @@ -734,20 +744,20 @@ func flattenDomainServiceReplicaSets(input *[]aad.ReplicaSet) (ret []interface{} "service_status": "", "subnet_id": "", } - if in.DomainControllerIPAddress != nil { - repl["domain_controller_ip_addresses"] = *in.DomainControllerIPAddress + if in.DomainControllerIpAddress != nil { + repl["domain_controller_ip_addresses"] = *in.DomainControllerIpAddress } - if in.ExternalAccessIPAddress != nil { - repl["external_access_ip_address"] = *in.ExternalAccessIPAddress + if in.ExternalAccessIpAddress != nil { + repl["external_access_ip_address"] = *in.ExternalAccessIpAddress } - if in.ReplicaSetID != nil { - repl["id"] = *in.ReplicaSetID + if in.ReplicaSetId != nil { + repl["id"] = *in.ReplicaSetId } if in.ServiceStatus != nil { repl["service_status"] = *in.ServiceStatus } - if in.SubnetID != nil { - repl["subnet_id"] = *in.SubnetID + if in.SubnetId != nil { + repl["subnet_id"] = *in.SubnetId } ret = append(ret, repl) } @@ -755,7 +765,7 @@ func flattenDomainServiceReplicaSets(input *[]aad.ReplicaSet) (ret []interface{} return } -func flattenDomainServiceSecurity(input *aad.DomainSecuritySettings) []interface{} { +func flattenDomainServiceSecurity(input *domainservices.DomainSecuritySettings) []interface{} { if input == nil { return make([]interface{}, 0) } @@ -767,19 +777,19 @@ func flattenDomainServiceSecurity(input *aad.DomainSecuritySettings) []interface "sync_on_prem_passwords": false, "tls_v1_enabled": false, } - if input.NtlmV1 == aad.NtlmV1Enabled { + if input.NtlmV1 != nil && *input.NtlmV1 == domainservices.NtlmV1Enabled { result["ntlm_v1_enabled"] = true } - if input.SyncKerberosPasswords == aad.SyncKerberosPasswordsEnabled { + if input.SyncKerberosPasswords != nil && *input.SyncKerberosPasswords == domainservices.SyncKerberosPasswordsEnabled { result["sync_kerberos_passwords"] = true } - if input.SyncNtlmPasswords == aad.SyncNtlmPasswordsEnabled { + if input.SyncNtlmPasswords != nil && *input.SyncNtlmPasswords == domainservices.SyncNtlmPasswordsEnabled { result["sync_ntlm_passwords"] = true } - if input.SyncOnPremPasswords == aad.SyncOnPremPasswordsEnabled { + if input.SyncOnPremPasswords != nil && *input.SyncOnPremPasswords == domainservices.SyncOnPremPasswordsEnabled { result["sync_on_prem_passwords"] = true } - if input.TLSV1 == aad.TLSV1Enabled { + if input.TlsV1 != nil && *input.TlsV1 == domainservices.TlsV1Enabled { result["tls_v1_enabled"] = true } diff --git a/internal/services/domainservices/active_directory_domain_service_test.go b/internal/services/domainservices/active_directory_domain_service_test.go index 87e0e8e03976..da7e5106e7de 100644 --- a/internal/services/domainservices/active_directory_domain_service_test.go +++ b/internal/services/domainservices/active_directory_domain_service_test.go @@ -5,6 +5,7 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" @@ -161,12 +162,14 @@ func (ActiveDirectoryDomainServiceResource) Exists(ctx context.Context, client * return nil, err } - resp, err := client.DomainServices.DomainServicesClient.Get(ctx, id.ResourceGroup, id.Name) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.Name) + + resp, err := client.DomainServices.DomainServicesClient.Get(ctx, idsdk) if err != nil { return nil, fmt.Errorf("reading DomainService: %+v", err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil && resp.Model.Id != nil), nil } func (ActiveDirectoryDomainServiceReplicaSetResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { @@ -175,17 +178,29 @@ func (ActiveDirectoryDomainServiceReplicaSetResource) Exists(ctx context.Context return nil, err } - resp, err := client.DomainServices.DomainServicesClient.Get(ctx, id.ResourceGroup, id.DomainServiceName) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) + + resp, err := client.DomainServices.DomainServicesClient.Get(ctx, idsdk) if err != nil { return nil, fmt.Errorf("reading DomainService: %+v", err) } - if resp.ReplicaSets == nil || len(*resp.ReplicaSets) == 0 { + model := resp.Model + if model == nil { + return nil, fmt.Errorf("DomainService response returned with nil model") + } + + props := model.Properties + if props == nil { + return nil, fmt.Errorf("DomainService response returned with nil properties") + } + + if props.ReplicaSets == nil || len(*props.ReplicaSets) == 0 { return nil, fmt.Errorf("DomainService response returned with nil or empty replicaSets") } - for _, replica := range *resp.ReplicaSets { - if replica.ReplicaSetID != nil && *replica.ReplicaSetID == id.ReplicaSetName { + for _, replica := range *props.ReplicaSets { + if replica.ReplicaSetId != nil && *replica.ReplicaSetId == id.ReplicaSetName { return utils.Bool(true), nil } } diff --git a/internal/services/domainservices/active_directory_domain_service_trust_resource.go b/internal/services/domainservices/active_directory_domain_service_trust_resource.go index 7578996f5588..90597673c00d 100644 --- a/internal/services/domainservices/active_directory_domain_service_trust_resource.go +++ b/internal/services/domainservices/active_directory_domain_service_trust_resource.go @@ -6,7 +6,8 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/parse" @@ -98,16 +99,23 @@ func (r DomainServiceTrustResource) Create() sdk.ResourceFunc { } id := parse.NewDomainServiceTrustID(dsid.SubscriptionId, dsid.ResourceGroup, dsid.Name, plan.Name) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) locks.ByName(id.DomainServiceName, DomainServiceResourceName) defer locks.UnlockByName(id.DomainServiceName, DomainServiceResourceName) - existing, err := client.Get(ctx, id.ResourceGroup, id.DomainServiceName) + existing, err := client.Get(ctx, idsdk) if err != nil { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } - existingTrusts := []aad.ForestTrust{} - if props := existing.DomainServiceProperties; props != nil { + + model := existing.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", idsdk) + } + + existingTrusts := []domainservices.ForestTrust{} + if props := model.Properties; props != nil { if fsettings := props.ResourceForestSettings; fsettings != nil { if settings := fsettings.Settings; settings != nil { existingTrusts = *settings @@ -120,28 +128,24 @@ func (r DomainServiceTrustResource) Create() sdk.ResourceFunc { } } - existingTrusts = append(existingTrusts, aad.ForestTrust{ + existingTrusts = append(existingTrusts, domainservices.ForestTrust{ TrustedDomainFqdn: utils.String(plan.TrustedDomainFqdn), TrustDirection: utils.String("Inbound"), FriendlyName: utils.String(id.TrustName), - RemoteDNSIps: utils.String(strings.Join(plan.TrustedDomainDnsIPs, ",")), + RemoteDnsIps: utils.String(strings.Join(plan.TrustedDomainDnsIPs, ",")), TrustPassword: utils.String(plan.Password), }) - params := aad.DomainService{ - DomainServiceProperties: &aad.DomainServiceProperties{ - ResourceForestSettings: &aad.ResourceForestSettings{ + params := domainservices.DomainService{ + Properties: &domainservices.DomainServiceProperties{ + ResourceForestSettings: &domainservices.ResourceForestSettings{ Settings: &existingTrusts, }, }, } - future, err := client.Update(ctx, id.ResourceGroup, id.DomainServiceName, params) - if err != nil { + if err := client.UpdateThenPoll(ctx, idsdk, params); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } metadata.SetID(id) return nil @@ -160,22 +164,27 @@ func (r DomainServiceTrustResource) Read() sdk.ResourceFunc { return err } - resourceErrorName := fmt.Sprintf("Domain Service (Name: %q, Resource Group: %q)", id.DomainServiceName, id.ResourceGroup) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) - existing, err := client.Get(ctx, id.ResourceGroup, id.DomainServiceName) + existing, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(existing.Response) { + if response.WasNotFound(existing.HttpResponse) { return metadata.MarkAsGone(id) } - return fmt.Errorf("retrieving %s: %+v", resourceErrorName, err) + return fmt.Errorf("retrieving %s: %+v", idsdk, err) + } + + model := existing.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", idsdk) } - props := existing.DomainServiceProperties + props := model.Properties if props == nil { - return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing properties", resourceErrorName) + return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing properties", idsdk) } - existingTrusts := []aad.ForestTrust{} + existingTrusts := []domainservices.ForestTrust{} if props != nil { if fsettings := props.ResourceForestSettings; fsettings != nil { if settings := fsettings.Settings; settings != nil { @@ -183,7 +192,7 @@ func (r DomainServiceTrustResource) Read() sdk.ResourceFunc { } } } - var trust *aad.ForestTrust + var trust *domainservices.ForestTrust for _, setting := range existingTrusts { existingTrust := setting if setting.FriendlyName != nil && *setting.FriendlyName == id.TrustName { @@ -197,17 +206,17 @@ func (r DomainServiceTrustResource) Read() sdk.ResourceFunc { // Retrieve the initial replica set id to construct the domain service id. replicaSets := flattenDomainServiceReplicaSets(props.ReplicaSets) if len(replicaSets) == 0 { - return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing replica set details", resourceErrorName) + return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing replica set details", idsdk) } initialReplicaSetId := replicaSets[0].(map[string]interface{})["id"].(string) - dsid := parse.NewDomainServiceID(client.SubscriptionID, id.ResourceGroup, id.DomainServiceName, initialReplicaSetId) + dsid := parse.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName, initialReplicaSetId) var state DomainServiceTrustModel if err := metadata.Decode(&state); err != nil { return err } - model := DomainServiceTrustModel{ + data := DomainServiceTrustModel{ DomainServiceId: dsid.ID(), Name: id.TrustName, // Setting the password from state as it is not returned by API. @@ -215,14 +224,14 @@ func (r DomainServiceTrustResource) Read() sdk.ResourceFunc { } if trust.TrustedDomainFqdn != nil { - model.TrustedDomainFqdn = *trust.TrustedDomainFqdn + data.TrustedDomainFqdn = *trust.TrustedDomainFqdn } - if trust.RemoteDNSIps != nil { - model.TrustedDomainDnsIPs = strings.Split(*trust.RemoteDNSIps, ",") + if trust.RemoteDnsIps != nil { + data.TrustedDomainDnsIPs = strings.Split(*trust.RemoteDnsIps, ",") } - return metadata.Encode(&model) + return metadata.Encode(&data) }, } } @@ -238,20 +247,25 @@ func (r DomainServiceTrustResource) Delete() sdk.ResourceFunc { return err } - resourceErrorName := fmt.Sprintf("Domain Service (Name: %q, Resource Group: %q)", id.DomainServiceName, id.ResourceGroup) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) locks.ByName(id.DomainServiceName, DomainServiceResourceName) defer locks.UnlockByName(id.DomainServiceName, DomainServiceResourceName) - existing, err := client.Get(ctx, id.ResourceGroup, id.DomainServiceName) + existing, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(existing.Response) { + if response.WasNotFound(existing.HttpResponse) { return metadata.MarkAsGone(id) } - return fmt.Errorf("retrieving %s: %+v", resourceErrorName, err) + return fmt.Errorf("retrieving %s: %+v", idsdk, err) + } + + model := existing.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", idsdk) } - existingTrusts := []aad.ForestTrust{} - if props := existing.DomainServiceProperties; props != nil { + existingTrusts := []domainservices.ForestTrust{} + if props := model.Properties; props != nil { if fsettings := props.ResourceForestSettings; fsettings != nil { if settings := fsettings.Settings; settings != nil { existingTrusts = *settings @@ -259,7 +273,7 @@ func (r DomainServiceTrustResource) Delete() sdk.ResourceFunc { } } var found bool - newTrusts := []aad.ForestTrust{} + newTrusts := []domainservices.ForestTrust{} for _, trust := range existingTrusts { if trust.FriendlyName != nil && *trust.FriendlyName == id.TrustName { found = true @@ -272,21 +286,17 @@ func (r DomainServiceTrustResource) Delete() sdk.ResourceFunc { return metadata.MarkAsGone(id) } - params := aad.DomainService{ - DomainServiceProperties: &aad.DomainServiceProperties{ - ResourceForestSettings: &aad.ResourceForestSettings{ + params := domainservices.DomainService{ + Properties: &domainservices.DomainServiceProperties{ + ResourceForestSettings: &domainservices.ResourceForestSettings{ Settings: &newTrusts, }, }, } - future, err := client.Update(ctx, id.ResourceGroup, id.DomainServiceName, params) - if err != nil { + if err := client.UpdateThenPoll(ctx, idsdk, params); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for removal of %s: %+v", id, err) - } return nil }, @@ -304,17 +314,23 @@ func (r DomainServiceTrustResource) Update() sdk.ResourceFunc { return err } - resourceErrorName := fmt.Sprintf("Domain Service (Name: %q, Resource Group: %q)", id.DomainServiceName, id.ResourceGroup) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) locks.ByName(id.DomainServiceName, DomainServiceResourceName) defer locks.UnlockByName(id.DomainServiceName, DomainServiceResourceName) - existing, err := client.Get(ctx, id.ResourceGroup, id.DomainServiceName) + existing, err := client.Get(ctx, idsdk) if err != nil { - return fmt.Errorf("retrieving %s: %+v", resourceErrorName, err) + return fmt.Errorf("retrieving %s: %+v", idsdk, err) + } + + model := existing.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", idsdk) } - existingTrusts := []aad.ForestTrust{} - if props := existing.DomainServiceProperties; props != nil { + + existingTrusts := []domainservices.ForestTrust{} + if props := model.Properties; props != nil { if fsettings := props.ResourceForestSettings; fsettings != nil { if settings := fsettings.Settings; settings != nil { existingTrusts = *settings @@ -328,7 +344,7 @@ func (r DomainServiceTrustResource) Update() sdk.ResourceFunc { } var found bool - newTrusts := []aad.ForestTrust{} + newTrusts := []domainservices.ForestTrust{} for _, trust := range existingTrusts { if trust.FriendlyName != nil && *trust.FriendlyName == id.TrustName { found = true @@ -336,7 +352,7 @@ func (r DomainServiceTrustResource) Update() sdk.ResourceFunc { trust.TrustedDomainFqdn = utils.String(plan.TrustedDomainFqdn) } if metadata.ResourceData.HasChange("trusted_domain_dns_ips") { - trust.RemoteDNSIps = utils.String(strings.Join(plan.TrustedDomainDnsIPs, ",")) + trust.RemoteDnsIps = utils.String(strings.Join(plan.TrustedDomainDnsIPs, ",")) } trust.TrustPassword = utils.String(plan.Password) } @@ -346,21 +362,17 @@ func (r DomainServiceTrustResource) Update() sdk.ResourceFunc { return fmt.Errorf("%s not exists: %+v", id, err) } - params := aad.DomainService{ - DomainServiceProperties: &aad.DomainServiceProperties{ - ResourceForestSettings: &aad.ResourceForestSettings{ + params := domainservices.DomainService{ + Properties: &domainservices.DomainServiceProperties{ + ResourceForestSettings: &domainservices.ResourceForestSettings{ Settings: &newTrusts, }, }, } - future, err := client.Update(ctx, id.ResourceGroup, id.DomainServiceName, params) - if err != nil { + if err := client.UpdateThenPoll(ctx, idsdk, params); err != nil { return fmt.Errorf("updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of %s: %+v", id, err) - } return nil }, } diff --git a/internal/services/domainservices/active_directory_domain_service_trust_resource_test.go b/internal/services/domainservices/active_directory_domain_service_trust_resource_test.go index bd18f105253e..421c20aeffc2 100644 --- a/internal/services/domainservices/active_directory_domain_service_trust_resource_test.go +++ b/internal/services/domainservices/active_directory_domain_service_trust_resource_test.go @@ -6,7 +6,8 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" @@ -116,15 +117,23 @@ func (r DomainServiceTrustResource) Exists(ctx context.Context, clients *clients return nil, err } - resp, err := client.Get(ctx, id.ResourceGroup, id.DomainServiceName) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) + + resp, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, err } - existingTrusts := []aad.ForestTrust{} - if props := resp.DomainServiceProperties; props != nil { + + model := resp.Model + if model == nil { + return nil, fmt.Errorf("reading %s: returned with null model", idsdk) + } + + existingTrusts := []domainservices.ForestTrust{} + if props := model.Properties; props != nil { if fsettings := props.ResourceForestSettings; fsettings != nil { if settings := fsettings.Settings; settings != nil { existingTrusts = *settings diff --git a/internal/services/domainservices/client/client.go b/internal/services/domainservices/client/client.go index e3f16a08a108..93103266b92f 100644 --- a/internal/services/domainservices/client/client.go +++ b/internal/services/domainservices/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - DomainServicesClient *aad.DomainServicesClient + DomainServicesClient *domainservices.DomainServicesClient } func NewClient(o *common.ClientOptions) *Client { - domainServicesClient := aad.NewDomainServicesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + domainServicesClient := domainservices.NewDomainServicesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&domainServicesClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/_meta.json deleted file mode 100644 index a747a6c64ba4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/domainservices/resource-manager/readme.md", - "tag": "package-2020-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/domainservices/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/client.go deleted file mode 100644 index 910b84b2297b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package aad implements the Azure ARM Aad service API version 2020-01-01. -// -// The AAD Domain Services API. -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Aad - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Aad. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainserviceoperations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainserviceoperations.go deleted file mode 100644 index d64ff6d3d9e5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainserviceoperations.go +++ /dev/null @@ -1,141 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DomainServiceOperationsClient is the the AAD Domain Services API. -type DomainServiceOperationsClient struct { - BaseClient -} - -// NewDomainServiceOperationsClient creates an instance of the DomainServiceOperationsClient client. -func NewDomainServiceOperationsClient(subscriptionID string) DomainServiceOperationsClient { - return NewDomainServiceOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainServiceOperationsClientWithBaseURI creates an instance of the DomainServiceOperationsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewDomainServiceOperationsClientWithBaseURI(baseURI string, subscriptionID string) DomainServiceOperationsClient { - return DomainServiceOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the available Domain Services operations. -func (client DomainServiceOperationsClient) List(ctx context.Context) (result OperationEntityListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceOperationsClient.List") - defer func() { - sc := -1 - if result.oelr.Response.Response != nil { - sc = result.oelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.oelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "List", resp, "Failure sending request") - return - } - - result.oelr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "List", resp, "Failure responding to request") - return - } - if result.oelr.hasNextLink() && result.oelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DomainServiceOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.AAD/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServiceOperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DomainServiceOperationsClient) ListResponder(resp *http.Response) (result OperationEntityListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client DomainServiceOperationsClient) listNextResults(ctx context.Context, lastResults OperationEntityListResult) (result OperationEntityListResult, err error) { - req, err := lastResults.operationEntityListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainServiceOperationsClient) ListComplete(ctx context.Context) (result OperationEntityListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceOperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainservices.go b/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainservices.go deleted file mode 100644 index fd6c17a2b871..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainservices.go +++ /dev/null @@ -1,629 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DomainServicesClient is the the AAD Domain Services API. -type DomainServicesClient struct { - BaseClient -} - -// NewDomainServicesClient creates an instance of the DomainServicesClient client. -func NewDomainServicesClient(subscriptionID string) DomainServicesClient { - return NewDomainServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainServicesClientWithBaseURI creates an instance of the DomainServicesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDomainServicesClientWithBaseURI(baseURI string, subscriptionID string) DomainServicesClient { - return DomainServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate the Create Domain Service operation creates a new domain service with the specified parameters. If -// the specific service already exists, then any patchable properties will be updated and any immutable properties will -// remain unchanged. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// domainService - properties supplied to the Create or Update a Domain Service operation. -func (client DomainServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (result DomainServicesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.DomainServicesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainServiceName, domainService) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), - autorest.WithJSON(domainService), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) CreateOrUpdateSender(req *http.Request) (future DomainServicesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) CreateOrUpdateResponder(resp *http.Response) (result DomainService, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete the Delete Domain Service operation deletes an existing Domain Service. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -func (client DomainServicesClient) Delete(ctx context.Context, resourceGroupName string, domainServiceName string) (result DomainServicesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.DomainServicesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, domainServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) DeleteSender(req *http.Request) (future DomainServicesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get the Get Domain Service operation retrieves a json representation of the Domain Service. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -func (client DomainServicesClient) Get(ctx context.Context, resourceGroupName string, domainServiceName string) (result DomainService, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.DomainServicesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, domainServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, domainServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) GetResponder(resp *http.Response) (result DomainService, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List the List Domain Services in Subscription operation lists all the domain services available under the given -// subscription (and across all resource groups within that subscription). -func (client DomainServicesClient) List(ctx context.Context) (result DomainServiceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.List") - defer func() { - sc := -1 - if result.dslr.Response.Response != nil { - sc = result.dslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.dslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "List", resp, "Failure sending request") - return - } - - result.dslr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "List", resp, "Failure responding to request") - return - } - if result.dslr.hasNextLink() && result.dslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DomainServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AAD/domainServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) ListResponder(resp *http.Response) (result DomainServiceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client DomainServicesClient) listNextResults(ctx context.Context, lastResults DomainServiceListResult) (result DomainServiceListResult, err error) { - req, err := lastResults.domainServiceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainServicesClient) ListComplete(ctx context.Context) (result DomainServiceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup the List Domain Services in Resource Group operation lists all the domain services available -// under the given resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -func (client DomainServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DomainServiceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dslr.Response.Response != nil { - sc = result.dslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.DomainServicesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dslr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dslr.hasNextLink() && result.dslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DomainServicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) ListByResourceGroupResponder(resp *http.Response) (result DomainServiceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client DomainServicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DomainServiceListResult) (result DomainServiceListResult, err error) { - req, err := lastResults.domainServiceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainServicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DomainServiceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// Update the Update Domain Service operation can be used to update the existing deployment. The update call only -// supports the properties listed in the PATCH body. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// domainService - properties supplied to the Update a Domain Service operation. -func (client DomainServicesClient) Update(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (result DomainServicesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.DomainServicesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, domainServiceName, domainService) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DomainServicesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), - autorest.WithJSON(domainService), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) UpdateSender(req *http.Request) (future DomainServicesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) UpdateResponder(resp *http.Response) (result DomainService, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/enums.go deleted file mode 100644 index 3c0900cccb82..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/enums.go +++ /dev/null @@ -1,157 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ExternalAccess enumerates the values for external access. -type ExternalAccess string - -const ( - // Disabled ... - Disabled ExternalAccess = "Disabled" - // Enabled ... - Enabled ExternalAccess = "Enabled" -) - -// PossibleExternalAccessValues returns an array of possible values for the ExternalAccess const type. -func PossibleExternalAccessValues() []ExternalAccess { - return []ExternalAccess{Disabled, Enabled} -} - -// FilteredSync enumerates the values for filtered sync. -type FilteredSync string - -const ( - // FilteredSyncDisabled ... - FilteredSyncDisabled FilteredSync = "Disabled" - // FilteredSyncEnabled ... - FilteredSyncEnabled FilteredSync = "Enabled" -) - -// PossibleFilteredSyncValues returns an array of possible values for the FilteredSync const type. -func PossibleFilteredSyncValues() []FilteredSync { - return []FilteredSync{FilteredSyncDisabled, FilteredSyncEnabled} -} - -// Ldaps enumerates the values for ldaps. -type Ldaps string - -const ( - // LdapsDisabled ... - LdapsDisabled Ldaps = "Disabled" - // LdapsEnabled ... - LdapsEnabled Ldaps = "Enabled" -) - -// PossibleLdapsValues returns an array of possible values for the Ldaps const type. -func PossibleLdapsValues() []Ldaps { - return []Ldaps{LdapsDisabled, LdapsEnabled} -} - -// NotifyDcAdmins enumerates the values for notify dc admins. -type NotifyDcAdmins string - -const ( - // NotifyDcAdminsDisabled ... - NotifyDcAdminsDisabled NotifyDcAdmins = "Disabled" - // NotifyDcAdminsEnabled ... - NotifyDcAdminsEnabled NotifyDcAdmins = "Enabled" -) - -// PossibleNotifyDcAdminsValues returns an array of possible values for the NotifyDcAdmins const type. -func PossibleNotifyDcAdminsValues() []NotifyDcAdmins { - return []NotifyDcAdmins{NotifyDcAdminsDisabled, NotifyDcAdminsEnabled} -} - -// NotifyGlobalAdmins enumerates the values for notify global admins. -type NotifyGlobalAdmins string - -const ( - // NotifyGlobalAdminsDisabled ... - NotifyGlobalAdminsDisabled NotifyGlobalAdmins = "Disabled" - // NotifyGlobalAdminsEnabled ... - NotifyGlobalAdminsEnabled NotifyGlobalAdmins = "Enabled" -) - -// PossibleNotifyGlobalAdminsValues returns an array of possible values for the NotifyGlobalAdmins const type. -func PossibleNotifyGlobalAdminsValues() []NotifyGlobalAdmins { - return []NotifyGlobalAdmins{NotifyGlobalAdminsDisabled, NotifyGlobalAdminsEnabled} -} - -// NtlmV1 enumerates the values for ntlm v1. -type NtlmV1 string - -const ( - // NtlmV1Disabled ... - NtlmV1Disabled NtlmV1 = "Disabled" - // NtlmV1Enabled ... - NtlmV1Enabled NtlmV1 = "Enabled" -) - -// PossibleNtlmV1Values returns an array of possible values for the NtlmV1 const type. -func PossibleNtlmV1Values() []NtlmV1 { - return []NtlmV1{NtlmV1Disabled, NtlmV1Enabled} -} - -// SyncKerberosPasswords enumerates the values for sync kerberos passwords. -type SyncKerberosPasswords string - -const ( - // SyncKerberosPasswordsDisabled ... - SyncKerberosPasswordsDisabled SyncKerberosPasswords = "Disabled" - // SyncKerberosPasswordsEnabled ... - SyncKerberosPasswordsEnabled SyncKerberosPasswords = "Enabled" -) - -// PossibleSyncKerberosPasswordsValues returns an array of possible values for the SyncKerberosPasswords const type. -func PossibleSyncKerberosPasswordsValues() []SyncKerberosPasswords { - return []SyncKerberosPasswords{SyncKerberosPasswordsDisabled, SyncKerberosPasswordsEnabled} -} - -// SyncNtlmPasswords enumerates the values for sync ntlm passwords. -type SyncNtlmPasswords string - -const ( - // SyncNtlmPasswordsDisabled ... - SyncNtlmPasswordsDisabled SyncNtlmPasswords = "Disabled" - // SyncNtlmPasswordsEnabled ... - SyncNtlmPasswordsEnabled SyncNtlmPasswords = "Enabled" -) - -// PossibleSyncNtlmPasswordsValues returns an array of possible values for the SyncNtlmPasswords const type. -func PossibleSyncNtlmPasswordsValues() []SyncNtlmPasswords { - return []SyncNtlmPasswords{SyncNtlmPasswordsDisabled, SyncNtlmPasswordsEnabled} -} - -// SyncOnPremPasswords enumerates the values for sync on prem passwords. -type SyncOnPremPasswords string - -const ( - // SyncOnPremPasswordsDisabled ... - SyncOnPremPasswordsDisabled SyncOnPremPasswords = "Disabled" - // SyncOnPremPasswordsEnabled ... - SyncOnPremPasswordsEnabled SyncOnPremPasswords = "Enabled" -) - -// PossibleSyncOnPremPasswordsValues returns an array of possible values for the SyncOnPremPasswords const type. -func PossibleSyncOnPremPasswordsValues() []SyncOnPremPasswords { - return []SyncOnPremPasswords{SyncOnPremPasswordsDisabled, SyncOnPremPasswordsEnabled} -} - -// TLSV1 enumerates the values for tlsv1. -type TLSV1 string - -const ( - // TLSV1Disabled ... - TLSV1Disabled TLSV1 = "Disabled" - // TLSV1Enabled ... - TLSV1Enabled TLSV1 = "Enabled" -) - -// PossibleTLSV1Values returns an array of possible values for the TLSV1 const type. -func PossibleTLSV1Values() []TLSV1 { - return []TLSV1{TLSV1Disabled, TLSV1Enabled} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/models.go deleted file mode 100644 index fe31df5f8136..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/models.go +++ /dev/null @@ -1,1334 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" - -// CloudError an error response from the Domain Services. -type CloudError struct { - // Error - An error response from the Domain Services. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the Domain Services. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// ContainerAccount container Account Description -type ContainerAccount struct { - // AccountName - The account name - AccountName *string `json:"accountName,omitempty"` - // Spn - The account spn - Spn *string `json:"spn,omitempty"` - // Password - The account password - Password *string `json:"password,omitempty"` -} - -// DomainSecuritySettings domain Security Settings -type DomainSecuritySettings struct { - // NtlmV1 - A flag to determine whether or not NtlmV1 is enabled or disabled. Possible values include: 'NtlmV1Enabled', 'NtlmV1Disabled' - NtlmV1 NtlmV1 `json:"ntlmV1,omitempty"` - // TLSV1 - A flag to determine whether or not TlsV1 is enabled or disabled. Possible values include: 'TLSV1Enabled', 'TLSV1Disabled' - TLSV1 TLSV1 `json:"tlsV1,omitempty"` - // SyncNtlmPasswords - A flag to determine whether or not SyncNtlmPasswords is enabled or disabled. Possible values include: 'SyncNtlmPasswordsEnabled', 'SyncNtlmPasswordsDisabled' - SyncNtlmPasswords SyncNtlmPasswords `json:"syncNtlmPasswords,omitempty"` - // SyncKerberosPasswords - A flag to determine whether or not SyncKerberosPasswords is enabled or disabled. Possible values include: 'SyncKerberosPasswordsEnabled', 'SyncKerberosPasswordsDisabled' - SyncKerberosPasswords SyncKerberosPasswords `json:"syncKerberosPasswords,omitempty"` - // SyncOnPremPasswords - A flag to determine whether or not SyncOnPremPasswords is enabled or disabled. Possible values include: 'SyncOnPremPasswordsEnabled', 'SyncOnPremPasswordsDisabled' - SyncOnPremPasswords SyncOnPremPasswords `json:"syncOnPremPasswords,omitempty"` -} - -// DomainService domain service. -type DomainService struct { - autorest.Response `json:"-"` - // DomainServiceProperties - Domain service properties - *DomainServiceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Etag - Resource etag - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainService. -func (ds DomainService) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ds.DomainServiceProperties != nil { - objectMap["properties"] = ds.DomainServiceProperties - } - if ds.Location != nil { - objectMap["location"] = ds.Location - } - if ds.Tags != nil { - objectMap["tags"] = ds.Tags - } - if ds.Etag != nil { - objectMap["etag"] = ds.Etag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainService struct. -func (ds *DomainService) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var domainServiceProperties DomainServiceProperties - err = json.Unmarshal(*v, &domainServiceProperties) - if err != nil { - return err - } - ds.DomainServiceProperties = &domainServiceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ds.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ds.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ds.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ds.Etag = &etag - } - } - } - - return nil -} - -// DomainServiceListResult the response from the List Domain Services operation. -type DomainServiceListResult struct { - autorest.Response `json:"-"` - // Value - the list of domain services. - Value *[]DomainService `json:"value,omitempty"` - // NextLink - READ-ONLY; The continuation token for the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainServiceListResult. -func (dslr DomainServiceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dslr.Value != nil { - objectMap["value"] = dslr.Value - } - return json.Marshal(objectMap) -} - -// DomainServiceListResultIterator provides access to a complete listing of DomainService values. -type DomainServiceListResultIterator struct { - i int - page DomainServiceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DomainServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DomainServiceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DomainServiceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DomainServiceListResultIterator) Response() DomainServiceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DomainServiceListResultIterator) Value() DomainService { - if !iter.page.NotDone() { - return DomainService{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DomainServiceListResultIterator type. -func NewDomainServiceListResultIterator(page DomainServiceListResultPage) DomainServiceListResultIterator { - return DomainServiceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dslr DomainServiceListResult) IsEmpty() bool { - return dslr.Value == nil || len(*dslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dslr DomainServiceListResult) hasNextLink() bool { - return dslr.NextLink != nil && len(*dslr.NextLink) != 0 -} - -// domainServiceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dslr DomainServiceListResult) domainServiceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dslr.NextLink))) -} - -// DomainServiceListResultPage contains a page of DomainService values. -type DomainServiceListResultPage struct { - fn func(context.Context, DomainServiceListResult) (DomainServiceListResult, error) - dslr DomainServiceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DomainServiceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dslr) - if err != nil { - return err - } - page.dslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DomainServiceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DomainServiceListResultPage) NotDone() bool { - return !page.dslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DomainServiceListResultPage) Response() DomainServiceListResult { - return page.dslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DomainServiceListResultPage) Values() []DomainService { - if page.dslr.IsEmpty() { - return nil - } - return *page.dslr.Value -} - -// Creates a new instance of the DomainServiceListResultPage type. -func NewDomainServiceListResultPage(cur DomainServiceListResult, getNextPage func(context.Context, DomainServiceListResult) (DomainServiceListResult, error)) DomainServiceListResultPage { - return DomainServiceListResultPage{ - fn: getNextPage, - dslr: cur, - } -} - -// DomainServiceProperties properties of the Domain Service. -type DomainServiceProperties struct { - // Version - READ-ONLY; Data Model Version - Version *int32 `json:"version,omitempty"` - // TenantID - READ-ONLY; Azure Active Directory Tenant Id - TenantID *string `json:"tenantId,omitempty"` - // DomainName - The name of the Azure domain that the user would like to deploy Domain Services to. - DomainName *string `json:"domainName,omitempty"` - // DeploymentID - READ-ONLY; Deployment Id - DeploymentID *string `json:"deploymentId,omitempty"` - // SyncOwner - READ-ONLY; SyncOwner ReplicaSet Id - SyncOwner *string `json:"syncOwner,omitempty"` - // ReplicaSets - List of ReplicaSets - ReplicaSets *[]ReplicaSet `json:"replicaSets,omitempty"` - // LdapsSettings - Secure LDAP Settings - LdapsSettings *LdapsSettings `json:"ldapsSettings,omitempty"` - // ResourceForestSettings - Resource Forest Settings - ResourceForestSettings *ResourceForestSettings `json:"resourceForestSettings,omitempty"` - // DomainSecuritySettings - DomainSecurity Settings - DomainSecuritySettings *DomainSecuritySettings `json:"domainSecuritySettings,omitempty"` - // DomainConfigurationType - Domain Configuration Type - DomainConfigurationType *string `json:"domainConfigurationType,omitempty"` - // Sku - Sku Type - Sku *string `json:"sku,omitempty"` - // FilteredSync - Enabled or Disabled flag to turn on Group-based filtered sync. Possible values include: 'FilteredSyncEnabled', 'FilteredSyncDisabled' - FilteredSync FilteredSync `json:"filteredSync,omitempty"` - // NotificationSettings - Notification Settings - NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` - // ProvisioningState - READ-ONLY; the current deployment or provisioning state, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainServiceProperties. -func (dsp DomainServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsp.DomainName != nil { - objectMap["domainName"] = dsp.DomainName - } - if dsp.ReplicaSets != nil { - objectMap["replicaSets"] = dsp.ReplicaSets - } - if dsp.LdapsSettings != nil { - objectMap["ldapsSettings"] = dsp.LdapsSettings - } - if dsp.ResourceForestSettings != nil { - objectMap["resourceForestSettings"] = dsp.ResourceForestSettings - } - if dsp.DomainSecuritySettings != nil { - objectMap["domainSecuritySettings"] = dsp.DomainSecuritySettings - } - if dsp.DomainConfigurationType != nil { - objectMap["domainConfigurationType"] = dsp.DomainConfigurationType - } - if dsp.Sku != nil { - objectMap["sku"] = dsp.Sku - } - if dsp.FilteredSync != "" { - objectMap["filteredSync"] = dsp.FilteredSync - } - if dsp.NotificationSettings != nil { - objectMap["notificationSettings"] = dsp.NotificationSettings - } - return json.Marshal(objectMap) -} - -// DomainServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DomainServicesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainServicesClient) (DomainService, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DomainServicesCreateOrUpdateFuture.Result. -func (future *DomainServicesCreateOrUpdateFuture) result(client DomainServicesClient) (ds DomainService, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ds.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.DomainServicesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent { - ds, err = client.CreateOrUpdateResponder(ds.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", ds.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainServicesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainServicesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DomainServicesDeleteFuture.Result. -func (future *DomainServicesDeleteFuture) result(client DomainServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.DomainServicesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DomainServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainServicesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainServicesClient) (DomainService, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainServicesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DomainServicesUpdateFuture.Result. -func (future *DomainServicesUpdateFuture) result(client DomainServicesClient) (ds DomainService, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ds.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.DomainServicesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent { - ds, err = client.UpdateResponder(ds.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", ds.Response.Response, "Failure responding to request") - } - } - return -} - -// ForestTrust forest Trust Setting -type ForestTrust struct { - // TrustedDomainFqdn - Trusted Domain FQDN - TrustedDomainFqdn *string `json:"trustedDomainFqdn,omitempty"` - // TrustDirection - Trust Direction - TrustDirection *string `json:"trustDirection,omitempty"` - // FriendlyName - Friendly Name - FriendlyName *string `json:"friendlyName,omitempty"` - // RemoteDNSIps - Remote Dns ips - RemoteDNSIps *string `json:"remoteDnsIps,omitempty"` - // TrustPassword - Trust Password - TrustPassword *string `json:"trustPassword,omitempty"` -} - -// HealthAlert health Alert Description -type HealthAlert struct { - // ID - READ-ONLY; Health Alert Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Health Alert Name - Name *string `json:"name,omitempty"` - // Issue - READ-ONLY; Health Alert Issue - Issue *string `json:"issue,omitempty"` - // Severity - READ-ONLY; Health Alert Severity - Severity *string `json:"severity,omitempty"` - // Raised - READ-ONLY; Health Alert Raised DateTime - Raised *date.Time `json:"raised,omitempty"` - // LastDetected - READ-ONLY; Health Alert Last Detected DateTime - LastDetected *date.Time `json:"lastDetected,omitempty"` - // ResolutionURI - READ-ONLY; Health Alert TSG Link - ResolutionURI *string `json:"resolutionUri,omitempty"` -} - -// MarshalJSON is the custom marshaler for HealthAlert. -func (ha HealthAlert) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// HealthMonitor health Monitor Description -type HealthMonitor struct { - // ID - READ-ONLY; Health Monitor Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Health Monitor Name - Name *string `json:"name,omitempty"` - // Details - READ-ONLY; Health Monitor Details - Details *string `json:"details,omitempty"` -} - -// MarshalJSON is the custom marshaler for HealthMonitor. -func (hm HealthMonitor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LdapsSettings secure LDAP Settings -type LdapsSettings struct { - // Ldaps - A flag to determine whether or not Secure LDAP is enabled or disabled. Possible values include: 'LdapsEnabled', 'LdapsDisabled' - Ldaps Ldaps `json:"ldaps,omitempty"` - // PfxCertificate - The certificate required to configure Secure LDAP. The parameter passed here should be a base64encoded representation of the certificate pfx file. - PfxCertificate *string `json:"pfxCertificate,omitempty"` - // PfxCertificatePassword - The password to decrypt the provided Secure LDAP certificate pfx file. - PfxCertificatePassword *string `json:"pfxCertificatePassword,omitempty"` - // PublicCertificate - READ-ONLY; Public certificate used to configure secure ldap. - PublicCertificate *string `json:"publicCertificate,omitempty"` - // CertificateThumbprint - READ-ONLY; Thumbprint of configure ldaps certificate. - CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` - // CertificateNotAfter - READ-ONLY; NotAfter DateTime of configure ldaps certificate. - CertificateNotAfter *date.Time `json:"certificateNotAfter,omitempty"` - // ExternalAccess - A flag to determine whether or not Secure LDAP access over the internet is enabled or disabled. Possible values include: 'Enabled', 'Disabled' - ExternalAccess ExternalAccess `json:"externalAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for LdapsSettings. -func (ls LdapsSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ls.Ldaps != "" { - objectMap["ldaps"] = ls.Ldaps - } - if ls.PfxCertificate != nil { - objectMap["pfxCertificate"] = ls.PfxCertificate - } - if ls.PfxCertificatePassword != nil { - objectMap["pfxCertificatePassword"] = ls.PfxCertificatePassword - } - if ls.ExternalAccess != "" { - objectMap["externalAccess"] = ls.ExternalAccess - } - return json.Marshal(objectMap) -} - -// NotificationSettings settings for notification -type NotificationSettings struct { - // NotifyGlobalAdmins - Should global admins be notified. Possible values include: 'NotifyGlobalAdminsEnabled', 'NotifyGlobalAdminsDisabled' - NotifyGlobalAdmins NotifyGlobalAdmins `json:"notifyGlobalAdmins,omitempty"` - // NotifyDcAdmins - Should domain controller admins be notified. Possible values include: 'NotifyDcAdminsEnabled', 'NotifyDcAdminsDisabled' - NotifyDcAdmins NotifyDcAdmins `json:"notifyDcAdmins,omitempty"` - // AdditionalRecipients - The list of additional recipients - AdditionalRecipients *[]string `json:"additionalRecipients,omitempty"` -} - -// OperationDisplayInfo the operation supported by Domain Services. -type OperationDisplayInfo struct { - // Description - The description of the operation. - Description *string `json:"description,omitempty"` - // Operation - The action that users can perform, based on their permission level. - Operation *string `json:"operation,omitempty"` - // Provider - Service provider: Domain Services. - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` -} - -// OperationEntity the operation supported by Domain Services. -type OperationEntity struct { - // Name - Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - // Display - The operation supported by Domain Services. - Display *OperationDisplayInfo `json:"display,omitempty"` - // Origin - The origin of the operation. - Origin *string `json:"origin,omitempty"` -} - -// OperationEntityListResult the list of domain service operation response. -type OperationEntityListResult struct { - autorest.Response `json:"-"` - // Value - The list of operations. - Value *[]OperationEntity `json:"value,omitempty"` - // NextLink - READ-ONLY; The continuation token for the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationEntityListResult. -func (oelr OperationEntityListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oelr.Value != nil { - objectMap["value"] = oelr.Value - } - return json.Marshal(objectMap) -} - -// OperationEntityListResultIterator provides access to a complete listing of OperationEntity values. -type OperationEntityListResultIterator struct { - i int - page OperationEntityListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationEntityListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationEntityListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationEntityListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationEntityListResultIterator) Response() OperationEntityListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationEntityListResultIterator) Value() OperationEntity { - if !iter.page.NotDone() { - return OperationEntity{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationEntityListResultIterator type. -func NewOperationEntityListResultIterator(page OperationEntityListResultPage) OperationEntityListResultIterator { - return OperationEntityListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oelr OperationEntityListResult) IsEmpty() bool { - return oelr.Value == nil || len(*oelr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oelr OperationEntityListResult) hasNextLink() bool { - return oelr.NextLink != nil && len(*oelr.NextLink) != 0 -} - -// operationEntityListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oelr OperationEntityListResult) operationEntityListResultPreparer(ctx context.Context) (*http.Request, error) { - if !oelr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oelr.NextLink))) -} - -// OperationEntityListResultPage contains a page of OperationEntity values. -type OperationEntityListResultPage struct { - fn func(context.Context, OperationEntityListResult) (OperationEntityListResult, error) - oelr OperationEntityListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationEntityListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.oelr) - if err != nil { - return err - } - page.oelr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationEntityListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationEntityListResultPage) NotDone() bool { - return !page.oelr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationEntityListResultPage) Response() OperationEntityListResult { - return page.oelr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationEntityListResultPage) Values() []OperationEntity { - if page.oelr.IsEmpty() { - return nil - } - return *page.oelr.Value -} - -// Creates a new instance of the OperationEntityListResultPage type. -func NewOperationEntityListResultPage(cur OperationEntityListResult, getNextPage func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)) OperationEntityListResultPage { - return OperationEntityListResultPage{ - fn: getNextPage, - oelr: cur, - } -} - -// OuContainer resource for OuContainer. -type OuContainer struct { - autorest.Response `json:"-"` - // OuContainerProperties - OuContainer properties - *OuContainerProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Etag - Resource etag - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for OuContainer. -func (oc OuContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oc.OuContainerProperties != nil { - objectMap["properties"] = oc.OuContainerProperties - } - if oc.Location != nil { - objectMap["location"] = oc.Location - } - if oc.Tags != nil { - objectMap["tags"] = oc.Tags - } - if oc.Etag != nil { - objectMap["etag"] = oc.Etag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OuContainer struct. -func (oc *OuContainer) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var ouContainerProperties OuContainerProperties - err = json.Unmarshal(*v, &ouContainerProperties) - if err != nil { - return err - } - oc.OuContainerProperties = &ouContainerProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - oc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - oc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - oc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - oc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - oc.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - oc.Etag = &etag - } - } - } - - return nil -} - -// OuContainerCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type OuContainerCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(OuContainerClient) (OuContainer, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *OuContainerCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for OuContainerCreateFuture.Result. -func (future *OuContainerCreateFuture) result(client OuContainerClient) (oc OuContainer, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - oc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.OuContainerCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if oc.Response.Response, err = future.GetResult(sender); err == nil && oc.Response.Response.StatusCode != http.StatusNoContent { - oc, err = client.CreateResponder(oc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerCreateFuture", "Result", oc.Response.Response, "Failure responding to request") - } - } - return -} - -// OuContainerDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type OuContainerDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(OuContainerClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *OuContainerDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for OuContainerDeleteFuture.Result. -func (future *OuContainerDeleteFuture) result(client OuContainerClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.OuContainerDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// OuContainerListResult the response from the List OuContainer operation. -type OuContainerListResult struct { - autorest.Response `json:"-"` - // Value - The list of OuContainer. - Value *[]OuContainer `json:"value,omitempty"` - // NextLink - READ-ONLY; The continuation token for the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OuContainerListResult. -func (oclr OuContainerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oclr.Value != nil { - objectMap["value"] = oclr.Value - } - return json.Marshal(objectMap) -} - -// OuContainerListResultIterator provides access to a complete listing of OuContainer values. -type OuContainerListResultIterator struct { - i int - page OuContainerListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OuContainerListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OuContainerListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OuContainerListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OuContainerListResultIterator) Response() OuContainerListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OuContainerListResultIterator) Value() OuContainer { - if !iter.page.NotDone() { - return OuContainer{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OuContainerListResultIterator type. -func NewOuContainerListResultIterator(page OuContainerListResultPage) OuContainerListResultIterator { - return OuContainerListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oclr OuContainerListResult) IsEmpty() bool { - return oclr.Value == nil || len(*oclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oclr OuContainerListResult) hasNextLink() bool { - return oclr.NextLink != nil && len(*oclr.NextLink) != 0 -} - -// ouContainerListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oclr OuContainerListResult) ouContainerListResultPreparer(ctx context.Context) (*http.Request, error) { - if !oclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oclr.NextLink))) -} - -// OuContainerListResultPage contains a page of OuContainer values. -type OuContainerListResultPage struct { - fn func(context.Context, OuContainerListResult) (OuContainerListResult, error) - oclr OuContainerListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OuContainerListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.oclr) - if err != nil { - return err - } - page.oclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OuContainerListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OuContainerListResultPage) NotDone() bool { - return !page.oclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OuContainerListResultPage) Response() OuContainerListResult { - return page.oclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OuContainerListResultPage) Values() []OuContainer { - if page.oclr.IsEmpty() { - return nil - } - return *page.oclr.Value -} - -// Creates a new instance of the OuContainerListResultPage type. -func NewOuContainerListResultPage(cur OuContainerListResult, getNextPage func(context.Context, OuContainerListResult) (OuContainerListResult, error)) OuContainerListResultPage { - return OuContainerListResultPage{ - fn: getNextPage, - oclr: cur, - } -} - -// OuContainerProperties properties of the OuContainer. -type OuContainerProperties struct { - // TenantID - READ-ONLY; Azure Active Directory tenant id - TenantID *string `json:"tenantId,omitempty"` - // DomainName - READ-ONLY; The domain name of Domain Services. - DomainName *string `json:"domainName,omitempty"` - // DeploymentID - READ-ONLY; The Deployment id - DeploymentID *string `json:"deploymentId,omitempty"` - // ContainerID - READ-ONLY; The OuContainer name - ContainerID *string `json:"containerId,omitempty"` - // Accounts - The list of container accounts - Accounts *[]ContainerAccount `json:"accounts,omitempty"` - // ServiceStatus - READ-ONLY; Status of OuContainer instance - ServiceStatus *string `json:"serviceStatus,omitempty"` - // DistinguishedName - READ-ONLY; Distinguished Name of OuContainer instance - DistinguishedName *string `json:"distinguishedName,omitempty"` - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for OuContainerProperties. -func (ocp OuContainerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ocp.Accounts != nil { - objectMap["accounts"] = ocp.Accounts - } - return json.Marshal(objectMap) -} - -// OuContainerUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type OuContainerUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(OuContainerClient) (OuContainer, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *OuContainerUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for OuContainerUpdateFuture.Result. -func (future *OuContainerUpdateFuture) result(client OuContainerClient) (oc OuContainer, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - oc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.OuContainerUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if oc.Response.Response, err = future.GetResult(sender); err == nil && oc.Response.Response.StatusCode != http.StatusNoContent { - oc, err = client.UpdateResponder(oc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerUpdateFuture", "Result", oc.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicaSet replica Set Definition -type ReplicaSet struct { - // ReplicaSetID - READ-ONLY; ReplicaSet Id - ReplicaSetID *string `json:"replicaSetId,omitempty"` - // Location - Virtual network location - Location *string `json:"location,omitempty"` - // VnetSiteID - READ-ONLY; Virtual network site id - VnetSiteID *string `json:"vnetSiteId,omitempty"` - // SubnetID - The name of the virtual network that Domain Services will be deployed on. The id of the subnet that Domain Services will be deployed on. /virtualNetwork/vnetName/subnets/subnetName. - SubnetID *string `json:"subnetId,omitempty"` - // DomainControllerIPAddress - READ-ONLY; List of Domain Controller IP Address - DomainControllerIPAddress *[]string `json:"domainControllerIpAddress,omitempty"` - // ExternalAccessIPAddress - READ-ONLY; External access ip address. - ExternalAccessIPAddress *string `json:"externalAccessIpAddress,omitempty"` - // ServiceStatus - READ-ONLY; Status of Domain Service instance - ServiceStatus *string `json:"serviceStatus,omitempty"` - // HealthLastEvaluated - READ-ONLY; Last domain evaluation run DateTime - HealthLastEvaluated *date.TimeRFC1123 `json:"healthLastEvaluated,omitempty"` - // HealthMonitors - READ-ONLY; List of Domain Health Monitors - HealthMonitors *[]HealthMonitor `json:"healthMonitors,omitempty"` - // HealthAlerts - READ-ONLY; List of Domain Health Alerts - HealthAlerts *[]HealthAlert `json:"healthAlerts,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicaSet. -func (rs ReplicaSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rs.Location != nil { - objectMap["location"] = rs.Location - } - if rs.SubnetID != nil { - objectMap["subnetId"] = rs.SubnetID - } - return json.Marshal(objectMap) -} - -// Resource the Resource model definition. -type Resource struct { - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Etag - Resource etag - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - if r.Etag != nil { - objectMap["etag"] = r.Etag - } - return json.Marshal(objectMap) -} - -// ResourceForestSettings settings for Resource Forest -type ResourceForestSettings struct { - // Settings - List of settings for Resource Forest - Settings *[]ForestTrust `json:"settings,omitempty"` - // ResourceForest - Resource Forest - ResourceForest *string `json:"resourceForest,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontainer.go b/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontainer.go deleted file mode 100644 index 9416da9675ed..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontainer.go +++ /dev/null @@ -1,521 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OuContainerClient is the the AAD Domain Services API. -type OuContainerClient struct { - BaseClient -} - -// NewOuContainerClient creates an instance of the OuContainerClient client. -func NewOuContainerClient(subscriptionID string) OuContainerClient { - return NewOuContainerClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOuContainerClientWithBaseURI creates an instance of the OuContainerClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOuContainerClientWithBaseURI(baseURI string, subscriptionID string) OuContainerClient { - return OuContainerClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create the Create OuContainer operation creates a new OuContainer under the specified Domain Service instance. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// ouContainerName - the name of the OuContainer. -// containerAccount - container Account Description. -func (client OuContainerClient) Create(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string, containerAccount ContainerAccount) (result OuContainerCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.OuContainerClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, domainServiceName, ouContainerName, containerAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client OuContainerClient) CreatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string, containerAccount ContainerAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "ouContainerName": autorest.Encode("path", ouContainerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}", pathParameters), - autorest.WithJSON(containerAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerClient) CreateSender(req *http.Request) (future OuContainerCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client OuContainerClient) CreateResponder(resp *http.Response) (result OuContainer, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete the Delete OuContainer operation deletes specified OuContainer. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// ouContainerName - the name of the OuContainer. -func (client OuContainerClient) Delete(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string) (result OuContainerDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.OuContainerClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, domainServiceName, ouContainerName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client OuContainerClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "ouContainerName": autorest.Encode("path", ouContainerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerClient) DeleteSender(req *http.Request) (future OuContainerDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client OuContainerClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get OuContainer in DomainService instance. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// ouContainerName - the name of the OuContainer. -func (client OuContainerClient) Get(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string) (result OuContainer, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.OuContainerClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, domainServiceName, ouContainerName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OuContainerClient) GetPreparer(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "ouContainerName": autorest.Encode("path", ouContainerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client OuContainerClient) GetResponder(resp *http.Response) (result OuContainer, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List the List of OuContainers in DomainService instance. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -func (client OuContainerClient) List(ctx context.Context, resourceGroupName string, domainServiceName string) (result OuContainerListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.List") - defer func() { - sc := -1 - if result.oclr.Response.Response != nil { - sc = result.oclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.OuContainerClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, domainServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.oclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "List", resp, "Failure sending request") - return - } - - result.oclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "List", resp, "Failure responding to request") - return - } - if result.oclr.hasNextLink() && result.oclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OuContainerClient) ListPreparer(ctx context.Context, resourceGroupName string, domainServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Aad/domainServices/{domainServiceName}/ouContainer", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OuContainerClient) ListResponder(resp *http.Response) (result OuContainerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OuContainerClient) listNextResults(ctx context.Context, lastResults OuContainerListResult) (result OuContainerListResult, err error) { - req, err := lastResults.ouContainerListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "aad.OuContainerClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "aad.OuContainerClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OuContainerClient) ListComplete(ctx context.Context, resourceGroupName string, domainServiceName string) (result OuContainerListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, domainServiceName) - return -} - -// Update the Update OuContainer operation can be used to update the existing OuContainers. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// ouContainerName - the name of the OuContainer. -// containerAccount - container Account Description. -func (client OuContainerClient) Update(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string, containerAccount ContainerAccount) (result OuContainerUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.OuContainerClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, domainServiceName, ouContainerName, containerAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client OuContainerClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string, containerAccount ContainerAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "ouContainerName": autorest.Encode("path", ouContainerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}", pathParameters), - autorest.WithJSON(containerAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerClient) UpdateSender(req *http.Request) (future OuContainerUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client OuContainerClient) UpdateResponder(resp *http.Response) (result OuContainer, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontaineroperations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontaineroperations.go deleted file mode 100644 index 7a362cc3a67e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontaineroperations.go +++ /dev/null @@ -1,141 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OuContainerOperationsClient is the the AAD Domain Services API. -type OuContainerOperationsClient struct { - BaseClient -} - -// NewOuContainerOperationsClient creates an instance of the OuContainerOperationsClient client. -func NewOuContainerOperationsClient(subscriptionID string) OuContainerOperationsClient { - return NewOuContainerOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOuContainerOperationsClientWithBaseURI creates an instance of the OuContainerOperationsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewOuContainerOperationsClientWithBaseURI(baseURI string, subscriptionID string) OuContainerOperationsClient { - return OuContainerOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the available OuContainer operations. -func (client OuContainerOperationsClient) List(ctx context.Context) (result OperationEntityListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerOperationsClient.List") - defer func() { - sc := -1 - if result.oelr.Response.Response != nil { - sc = result.oelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.oelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "List", resp, "Failure sending request") - return - } - - result.oelr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "List", resp, "Failure responding to request") - return - } - if result.oelr.hasNextLink() && result.oelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OuContainerOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Aad/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerOperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OuContainerOperationsClient) ListResponder(resp *http.Response) (result OperationEntityListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OuContainerOperationsClient) listNextResults(ctx context.Context, lastResults OperationEntityListResult) (result OperationEntityListResult, err error) { - req, err := lastResults.operationEntityListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OuContainerOperationsClient) ListComplete(ctx context.Context) (result OperationEntityListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerOperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/version.go deleted file mode 100644 index 69ad8c5ded28..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package aad - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " aad/2020-01-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/README.md new file mode 100644 index 000000000000..a647b8b032c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices` Documentation + +The `domainservices` SDK allows for interaction with the Azure Resource Manager Service `aad` (API Version `2020-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices" +``` + + +### Client Initialization + +```go +client := domainservices.NewDomainServicesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DomainServicesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := domainservices.NewDomainServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "domainServiceValue") + +payload := domainservices.DomainService{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DomainServicesClient.Delete` + +```go +ctx := context.TODO() +id := domainservices.NewDomainServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "domainServiceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DomainServicesClient.Get` + +```go +ctx := context.TODO() +id := domainservices.NewDomainServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "domainServiceValue") + +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: `DomainServicesClient.List` + +```go +ctx := context.TODO() +id := domainservices.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DomainServicesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := domainservices.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: `DomainServicesClient.Update` + +```go +ctx := context.TODO() +id := domainservices.NewDomainServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "domainServiceValue") + +payload := domainservices.DomainService{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/client.go new file mode 100644 index 000000000000..b9d16aba9187 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/client.go @@ -0,0 +1,18 @@ +package domainservices + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DomainServicesClient struct { + Client autorest.Client + baseUri string +} + +func NewDomainServicesClientWithBaseURI(endpoint string) DomainServicesClient { + return DomainServicesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/constants.go new file mode 100644 index 000000000000..000ced62559e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/constants.go @@ -0,0 +1,286 @@ +package domainservices + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExternalAccess string + +const ( + ExternalAccessDisabled ExternalAccess = "Disabled" + ExternalAccessEnabled ExternalAccess = "Enabled" +) + +func PossibleValuesForExternalAccess() []string { + return []string{ + string(ExternalAccessDisabled), + string(ExternalAccessEnabled), + } +} + +func parseExternalAccess(input string) (*ExternalAccess, error) { + vals := map[string]ExternalAccess{ + "disabled": ExternalAccessDisabled, + "enabled": ExternalAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExternalAccess(input) + return &out, nil +} + +type FilteredSync string + +const ( + FilteredSyncDisabled FilteredSync = "Disabled" + FilteredSyncEnabled FilteredSync = "Enabled" +) + +func PossibleValuesForFilteredSync() []string { + return []string{ + string(FilteredSyncDisabled), + string(FilteredSyncEnabled), + } +} + +func parseFilteredSync(input string) (*FilteredSync, error) { + vals := map[string]FilteredSync{ + "disabled": FilteredSyncDisabled, + "enabled": FilteredSyncEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FilteredSync(input) + return &out, nil +} + +type Ldaps string + +const ( + LdapsDisabled Ldaps = "Disabled" + LdapsEnabled Ldaps = "Enabled" +) + +func PossibleValuesForLdaps() []string { + return []string{ + string(LdapsDisabled), + string(LdapsEnabled), + } +} + +func parseLdaps(input string) (*Ldaps, error) { + vals := map[string]Ldaps{ + "disabled": LdapsDisabled, + "enabled": LdapsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Ldaps(input) + return &out, nil +} + +type NotifyDcAdmins string + +const ( + NotifyDcAdminsDisabled NotifyDcAdmins = "Disabled" + NotifyDcAdminsEnabled NotifyDcAdmins = "Enabled" +) + +func PossibleValuesForNotifyDcAdmins() []string { + return []string{ + string(NotifyDcAdminsDisabled), + string(NotifyDcAdminsEnabled), + } +} + +func parseNotifyDcAdmins(input string) (*NotifyDcAdmins, error) { + vals := map[string]NotifyDcAdmins{ + "disabled": NotifyDcAdminsDisabled, + "enabled": NotifyDcAdminsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotifyDcAdmins(input) + return &out, nil +} + +type NotifyGlobalAdmins string + +const ( + NotifyGlobalAdminsDisabled NotifyGlobalAdmins = "Disabled" + NotifyGlobalAdminsEnabled NotifyGlobalAdmins = "Enabled" +) + +func PossibleValuesForNotifyGlobalAdmins() []string { + return []string{ + string(NotifyGlobalAdminsDisabled), + string(NotifyGlobalAdminsEnabled), + } +} + +func parseNotifyGlobalAdmins(input string) (*NotifyGlobalAdmins, error) { + vals := map[string]NotifyGlobalAdmins{ + "disabled": NotifyGlobalAdminsDisabled, + "enabled": NotifyGlobalAdminsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotifyGlobalAdmins(input) + return &out, nil +} + +type NtlmV1 string + +const ( + NtlmV1Disabled NtlmV1 = "Disabled" + NtlmV1Enabled NtlmV1 = "Enabled" +) + +func PossibleValuesForNtlmV1() []string { + return []string{ + string(NtlmV1Disabled), + string(NtlmV1Enabled), + } +} + +func parseNtlmV1(input string) (*NtlmV1, error) { + vals := map[string]NtlmV1{ + "disabled": NtlmV1Disabled, + "enabled": NtlmV1Enabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NtlmV1(input) + return &out, nil +} + +type SyncKerberosPasswords string + +const ( + SyncKerberosPasswordsDisabled SyncKerberosPasswords = "Disabled" + SyncKerberosPasswordsEnabled SyncKerberosPasswords = "Enabled" +) + +func PossibleValuesForSyncKerberosPasswords() []string { + return []string{ + string(SyncKerberosPasswordsDisabled), + string(SyncKerberosPasswordsEnabled), + } +} + +func parseSyncKerberosPasswords(input string) (*SyncKerberosPasswords, error) { + vals := map[string]SyncKerberosPasswords{ + "disabled": SyncKerberosPasswordsDisabled, + "enabled": SyncKerberosPasswordsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SyncKerberosPasswords(input) + return &out, nil +} + +type SyncNtlmPasswords string + +const ( + SyncNtlmPasswordsDisabled SyncNtlmPasswords = "Disabled" + SyncNtlmPasswordsEnabled SyncNtlmPasswords = "Enabled" +) + +func PossibleValuesForSyncNtlmPasswords() []string { + return []string{ + string(SyncNtlmPasswordsDisabled), + string(SyncNtlmPasswordsEnabled), + } +} + +func parseSyncNtlmPasswords(input string) (*SyncNtlmPasswords, error) { + vals := map[string]SyncNtlmPasswords{ + "disabled": SyncNtlmPasswordsDisabled, + "enabled": SyncNtlmPasswordsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SyncNtlmPasswords(input) + return &out, nil +} + +type SyncOnPremPasswords string + +const ( + SyncOnPremPasswordsDisabled SyncOnPremPasswords = "Disabled" + SyncOnPremPasswordsEnabled SyncOnPremPasswords = "Enabled" +) + +func PossibleValuesForSyncOnPremPasswords() []string { + return []string{ + string(SyncOnPremPasswordsDisabled), + string(SyncOnPremPasswordsEnabled), + } +} + +func parseSyncOnPremPasswords(input string) (*SyncOnPremPasswords, error) { + vals := map[string]SyncOnPremPasswords{ + "disabled": SyncOnPremPasswordsDisabled, + "enabled": SyncOnPremPasswordsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SyncOnPremPasswords(input) + return &out, nil +} + +type TlsV1 string + +const ( + TlsV1Disabled TlsV1 = "Disabled" + TlsV1Enabled TlsV1 = "Enabled" +) + +func PossibleValuesForTlsV1() []string { + return []string{ + string(TlsV1Disabled), + string(TlsV1Enabled), + } +} + +func parseTlsV1(input string) (*TlsV1, error) { + vals := map[string]TlsV1{ + "disabled": TlsV1Disabled, + "enabled": TlsV1Enabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TlsV1(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/id_domainservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/id_domainservice.go new file mode 100644 index 000000000000..aeb7add024c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/id_domainservice.go @@ -0,0 +1,124 @@ +package domainservices + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DomainServiceId{} + +// DomainServiceId is a struct representing the Resource ID for a Domain Service +type DomainServiceId struct { + SubscriptionId string + ResourceGroupName string + DomainServiceName string +} + +// NewDomainServiceID returns a new DomainServiceId struct +func NewDomainServiceID(subscriptionId string, resourceGroupName string, domainServiceName string) DomainServiceId { + return DomainServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DomainServiceName: domainServiceName, + } +} + +// ParseDomainServiceID parses 'input' into a DomainServiceId +func ParseDomainServiceID(input string) (*DomainServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(DomainServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DomainServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DomainServiceName, ok = parsed.Parsed["domainServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'domainServiceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDomainServiceIDInsensitively parses 'input' case-insensitively into a DomainServiceId +// note: this method should only be used for API response data and not user input +func ParseDomainServiceIDInsensitively(input string) (*DomainServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(DomainServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DomainServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DomainServiceName, ok = parsed.Parsed["domainServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'domainServiceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDomainServiceID checks that 'input' can be parsed as a Domain Service ID +func ValidateDomainServiceID(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 := ParseDomainServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Domain Service ID +func (id DomainServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AAD/domainServices/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DomainServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Domain Service ID +func (id DomainServiceId) 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("staticMicrosoftAAD", "Microsoft.AAD", "Microsoft.AAD"), + resourceids.StaticSegment("staticDomainServices", "domainServices", "domainServices"), + resourceids.UserSpecifiedSegment("domainServiceName", "domainServiceValue"), + } +} + +// String returns a human-readable description of this Domain Service ID +func (id DomainServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Domain Service Name: %q", id.DomainServiceName), + } + return fmt.Sprintf("Domain Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_createorupdate_autorest.go new file mode 100644 index 000000000000..92c527b0a3fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package domainservices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c DomainServicesClient) CreateOrUpdate(ctx context.Context, id DomainServiceId, input DomainService) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c DomainServicesClient) CreateOrUpdateThenPoll(ctx context.Context, id DomainServiceId, input DomainService) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DomainServicesClient) preparerForCreateOrUpdate(ctx context.Context, id DomainServiceId, input DomainService) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DomainServicesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_delete_autorest.go new file mode 100644 index 000000000000..ddb42746d3e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_delete_autorest.go @@ -0,0 +1,78 @@ +package domainservices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DomainServicesClient) Delete(ctx context.Context, id DomainServiceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DomainServicesClient) DeleteThenPoll(ctx context.Context, id DomainServiceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DomainServicesClient) preparerForDelete(ctx context.Context, id DomainServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DomainServicesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_get_autorest.go new file mode 100644 index 000000000000..07f944bda93c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_get_autorest.go @@ -0,0 +1,67 @@ +package domainservices + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DomainService +} + +// Get ... +func (c DomainServicesClient) Get(ctx context.Context, id DomainServiceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DomainServicesClient) preparerForGet(ctx context.Context, id DomainServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DomainServicesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_list_autorest.go new file mode 100644 index 000000000000..9331419d43c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_list_autorest.go @@ -0,0 +1,187 @@ +package domainservices + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]DomainService + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []DomainService +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c DomainServicesClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c DomainServicesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, DomainServiceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DomainServicesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DomainServiceOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]DomainService, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForList prepares the List request. +func (c DomainServicesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AAD/domainServices", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c DomainServicesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c DomainServicesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []DomainService `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..e454a0fc1702 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package domainservices + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]DomainService + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []DomainService +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c DomainServicesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c DomainServicesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, DomainServiceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DomainServicesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate DomainServiceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]DomainService, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c DomainServicesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AAD/domainServices", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c DomainServicesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c DomainServicesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []DomainService `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_update_autorest.go new file mode 100644 index 000000000000..1d68fb3aa81a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/method_update_autorest.go @@ -0,0 +1,79 @@ +package domainservices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c DomainServicesClient) Update(ctx context.Context, id DomainServiceId, input DomainService) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c DomainServicesClient) UpdateThenPoll(ctx context.Context, id DomainServiceId, input DomainService) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c DomainServicesClient) preparerForUpdate(ctx context.Context, id DomainServiceId, input DomainService) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c DomainServicesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_domainsecuritysettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_domainsecuritysettings.go new file mode 100644 index 000000000000..615c6db89039 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_domainsecuritysettings.go @@ -0,0 +1,12 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DomainSecuritySettings struct { + NtlmV1 *NtlmV1 `json:"ntlmV1,omitempty"` + SyncKerberosPasswords *SyncKerberosPasswords `json:"syncKerberosPasswords,omitempty"` + SyncNtlmPasswords *SyncNtlmPasswords `json:"syncNtlmPasswords,omitempty"` + SyncOnPremPasswords *SyncOnPremPasswords `json:"syncOnPremPasswords,omitempty"` + TlsV1 *TlsV1 `json:"tlsV1,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_domainservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_domainservice.go new file mode 100644 index 000000000000..358faf586a70 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_domainservice.go @@ -0,0 +1,14 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DomainService struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DomainServiceProperties `json:"properties,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/aad/2020-01-01/domainservices/model_domainserviceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_domainserviceproperties.go new file mode 100644 index 000000000000..98090afe2d7c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_domainserviceproperties.go @@ -0,0 +1,22 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DomainServiceProperties struct { + DeploymentId *string `json:"deploymentId,omitempty"` + DomainConfigurationType *string `json:"domainConfigurationType,omitempty"` + DomainName *string `json:"domainName,omitempty"` + DomainSecuritySettings *DomainSecuritySettings `json:"domainSecuritySettings,omitempty"` + FilteredSync *FilteredSync `json:"filteredSync,omitempty"` + LdapsSettings *LdapsSettings `json:"ldapsSettings,omitempty"` + MigrationProperties *MigrationProperties `json:"migrationProperties,omitempty"` + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ReplicaSets *[]ReplicaSet `json:"replicaSets,omitempty"` + ResourceForestSettings *ResourceForestSettings `json:"resourceForestSettings,omitempty"` + Sku *string `json:"sku,omitempty"` + SyncOwner *string `json:"syncOwner,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + Version *int64 `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_foresttrust.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_foresttrust.go new file mode 100644 index 000000000000..270e5b7f2416 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_foresttrust.go @@ -0,0 +1,12 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForestTrust struct { + FriendlyName *string `json:"friendlyName,omitempty"` + RemoteDnsIps *string `json:"remoteDnsIps,omitempty"` + TrustDirection *string `json:"trustDirection,omitempty"` + TrustPassword *string `json:"trustPassword,omitempty"` + TrustedDomainFqdn *string `json:"trustedDomainFqdn,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_healthalert.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_healthalert.go new file mode 100644 index 000000000000..f38f86b0c668 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_healthalert.go @@ -0,0 +1,44 @@ +package domainservices + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HealthAlert struct { + Id *string `json:"id,omitempty"` + Issue *string `json:"issue,omitempty"` + LastDetected *string `json:"lastDetected,omitempty"` + Name *string `json:"name,omitempty"` + Raised *string `json:"raised,omitempty"` + ResolutionUri *string `json:"resolutionUri,omitempty"` + Severity *string `json:"severity,omitempty"` +} + +func (o *HealthAlert) GetLastDetectedAsTime() (*time.Time, error) { + if o.LastDetected == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastDetected, "2006-01-02T15:04:05Z07:00") +} + +func (o *HealthAlert) SetLastDetectedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastDetected = &formatted +} + +func (o *HealthAlert) GetRaisedAsTime() (*time.Time, error) { + if o.Raised == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Raised, "2006-01-02T15:04:05Z07:00") +} + +func (o *HealthAlert) SetRaisedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Raised = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_healthmonitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_healthmonitor.go new file mode 100644 index 000000000000..602cdc4bda64 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_healthmonitor.go @@ -0,0 +1,10 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HealthMonitor struct { + Details *string `json:"details,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_ldapssettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_ldapssettings.go new file mode 100644 index 000000000000..1256ec4a9d7b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_ldapssettings.go @@ -0,0 +1,32 @@ +package domainservices + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LdapsSettings struct { + CertificateNotAfter *string `json:"certificateNotAfter,omitempty"` + CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` + ExternalAccess *ExternalAccess `json:"externalAccess,omitempty"` + Ldaps *Ldaps `json:"ldaps,omitempty"` + PfxCertificate *string `json:"pfxCertificate,omitempty"` + PfxCertificatePassword *string `json:"pfxCertificatePassword,omitempty"` + PublicCertificate *string `json:"publicCertificate,omitempty"` +} + +func (o *LdapsSettings) GetCertificateNotAfterAsTime() (*time.Time, error) { + if o.CertificateNotAfter == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CertificateNotAfter, "2006-01-02T15:04:05Z07:00") +} + +func (o *LdapsSettings) SetCertificateNotAfterAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CertificateNotAfter = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_migrationprogress.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_migrationprogress.go new file mode 100644 index 000000000000..6bcb5b611869 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_migrationprogress.go @@ -0,0 +1,9 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationProgress struct { + CompletionPercentage *float64 `json:"completionPercentage,omitempty"` + ProgressMessage *string `json:"progressMessage,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_migrationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_migrationproperties.go new file mode 100644 index 000000000000..e8aeabfbe832 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_migrationproperties.go @@ -0,0 +1,10 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationProperties struct { + MigrationProgress *MigrationProgress `json:"migrationProgress,omitempty"` + OldSubnetId *string `json:"oldSubnetId,omitempty"` + OldVnetSiteId *string `json:"oldVnetSiteId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_notificationsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_notificationsettings.go new file mode 100644 index 000000000000..b7d1bd46d734 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_notificationsettings.go @@ -0,0 +1,10 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationSettings struct { + AdditionalRecipients *[]string `json:"additionalRecipients,omitempty"` + NotifyDcAdmins *NotifyDcAdmins `json:"notifyDcAdmins,omitempty"` + NotifyGlobalAdmins *NotifyGlobalAdmins `json:"notifyGlobalAdmins,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_replicaset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_replicaset.go new file mode 100644 index 000000000000..75b766bf109c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_replicaset.go @@ -0,0 +1,17 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReplicaSet struct { + DomainControllerIpAddress *[]string `json:"domainControllerIpAddress,omitempty"` + ExternalAccessIpAddress *string `json:"externalAccessIpAddress,omitempty"` + HealthAlerts *[]HealthAlert `json:"healthAlerts,omitempty"` + HealthLastEvaluated *string `json:"healthLastEvaluated,omitempty"` + HealthMonitors *[]HealthMonitor `json:"healthMonitors,omitempty"` + Location *string `json:"location,omitempty"` + ReplicaSetId *string `json:"replicaSetId,omitempty"` + ServiceStatus *string `json:"serviceStatus,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` + VnetSiteId *string `json:"vnetSiteId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_resourceforestsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_resourceforestsettings.go new file mode 100644 index 000000000000..5a9f02dc80ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/model_resourceforestsettings.go @@ -0,0 +1,9 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceForestSettings struct { + ResourceForest *string `json:"resourceForest,omitempty"` + Settings *[]ForestTrust `json:"settings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/predicates.go new file mode 100644 index 000000000000..180f3360ea5b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/predicates.go @@ -0,0 +1,34 @@ +package domainservices + +type DomainServiceOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p DomainServiceOperationPredicate) Matches(input DomainService) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.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/aad/2020-01-01/domainservices/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/version.go new file mode 100644 index 000000000000..983028832103 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices/version.go @@ -0,0 +1,12 @@ +package domainservices + +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 = "2020-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/domainservices/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/applicationinsights/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/applicationinsights/README.md index e67de93e11a0..8080cc0ccaf5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/applicationinsights/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/applicationinsights/README.md @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := applicationinsights.NewResourceGroupID() +id := applicationinsights.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") // alternatively `client.WorkbooksListByResourceGroup(ctx, id, applicationinsights.DefaultWorkbooksListByResourceGroupOperationOptions())` can be used to do batched pagination items, err := client.WorkbooksListByResourceGroupComplete(ctx, id, applicationinsights.DefaultWorkbooksListByResourceGroupOperationOptions()) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := applicationinsights.NewSubscriptionID() +id := applicationinsights.NewSubscriptionID("12345678-1234-9876-4563-123456789012") // alternatively `client.WorkbooksListBySubscription(ctx, id, applicationinsights.DefaultWorkbooksListBySubscriptionOperationOptions())` can be used to do batched pagination items, err := client.WorkbooksListBySubscriptionComplete(ctx, id, applicationinsights.DefaultWorkbooksListBySubscriptionOperationOptions()) diff --git a/vendor/modules.txt b/vendor/modules.txt index 7db8b191f03b..fe74053f8dd0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -21,7 +21,6 @@ github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns -github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2021-12-01/eventgrid github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac @@ -195,6 +194,7 @@ github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage # github.com/hashicorp/go-azure-sdk v0.20220719.1202339 ## explicit; go 1.18 +github.com/hashicorp/go-azure-sdk/resource-manager/aad/2020-01-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores